Jump to content
MakeWebGames

Recommended Posts

Posted

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.

  • Like 1
Posted

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.

  • Like 3
Posted
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

  • Haha 1
Posted
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. 

Posted (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 by sniko
  • Haha 1
Posted
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!

Posted
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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...