Jump to content
MakeWebGames

Recommended Posts

Posted

I created my own mugging event, all works fine but I am not sure how I would go about setting a time limit between muggings...like you can only mug someone every 30 seconds..

lol...i can mug someone 100 times in one minute :P

any help ? if so thank you...im sure this is a simple one...and remember you only have to show me once :P

Posted

Hey,

This is pretty simple once your done with someone mugging someone else you can either store the timestamp of when the mugging happened in a mysql field or as a session (I would personally use a session because its 30 seconds). Then simply check that the timestamp is longer then 30 seconds ago.

Thanks, David Macaulay.

Posted

quick fix:

Set up a new variable in the users table (lastmugging).

Add this to the page when someone gets mugged (attackmug.php? Not sure of your file names).

$db->query("UPDATE users SET lastmugging = unix_timestamp()");

Somewhere on attack.php, run a check on the last time they attacked someone.

$mu=$db->query("SELECT userid FROM users WHERE lastmugging > unix_timestamp()-30");

$mug=$db->num_rows();

if($mug){die("Sorry, mugged someone within last 30 seconds.");}

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