Curt Posted September 27, 2009 Posted September 27, 2009 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 Quote
Dave Posted September 27, 2009 Posted September 27, 2009 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. Quote
Curt Posted September 27, 2009 Author Posted September 27, 2009 thanks, ill search the site for an example...i have never used timestamps.. Quote
seanybob Posted September 28, 2009 Posted September 28, 2009 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.");} Quote
Curt Posted September 28, 2009 Author Posted September 28, 2009 thanks alot seanybob, that works perfectly... :thumbsup: Quote
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.