WarMad Posted March 1, 2019 Share Posted March 1, 2019 First go to viewuser.php and where you add all you links for send a message, attack, etc and add this You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Then make the file interact.php and in the file add this You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. And thats it. I have not tested this i made it for a game i used to own and converted it to v2 so sorry a head of time if i forgot anything. 1 Quote Link to comment Share on other sites More sharing options...
Dave Posted March 1, 2019 Share Posted March 1, 2019 This is neat, nice little addition, really reminds me of poking people on Facebook! You could wrap up your "is interact-able" logic into a single re-usable function. You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Then you can just execute this function before the event_add. In an ideal world a function shouldn't die but this is MCCodes so there's no other option really. 3 Quote Link to comment Share on other sites More sharing options...
Magictallguy Posted March 1, 2019 Share Posted March 1, 2019 3 minutes ago, Dave said: [...] In an ideal world a function shouldn't die but this is MCCodes so there's no other option really. You can, but you've gotta pass `$h->endpage()` to it or it'll break layouts on defaults templates. You could get around this by calling register_shutdown_function() and throwing a call to the endpage() in there 1 Quote Link to comment Share on other sites More sharing options...
Dave Posted March 1, 2019 Share Posted March 1, 2019 7 minutes ago, Magictallguy said: You could get around this by calling register_shutdown_function() and throwing a call to the endpage() in there I really dislike things that feel like magic, I'd rather have a hard dependency on the need to call endpage() rather than people struggling to find out what's going on! MCCodes could be much better with a few basic architectural improvements. Quote Link to comment Share on other sites More sharing options...
Magictallguy Posted March 1, 2019 Share Posted March 1, 2019 Aye, I'm a little bit of a control freak when it comes to code too. Though, sometimes, letting the code give a little something back ain't so bad :P Quote Link to comment Share on other sites More sharing options...
Dayo Posted March 1, 2019 Share Posted March 1, 2019 you could just use global $h within the function? Quote Link to comment Share on other sites More sharing options...
sniko Posted March 1, 2019 Share Posted March 1, 2019 (edited) 35 minutes ago, Dayo said: you could just use global $h within the function? Nah, injecting it into the function with a call parameter is much better. global should die. Edited March 1, 2019 by sniko 1 Quote Link to comment Share on other sites More sharing options...
Dave Posted March 1, 2019 Share Posted March 1, 2019 1 hour ago, sniko said: Nah, injecting it into the function with a call parameter is much better. global should die. Death to all globals! Quote Link to comment Share on other sites More sharing options...
Dayo Posted March 2, 2019 Share Posted March 2, 2019 15 hours ago, sniko said: Nah, injecting it into the function with a call parameter is much better. global should die. Normally i would agree but as this is mccodes v2 it's like putting a plaster over an amputated leg. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.