plintu Posted June 24, 2009 Share Posted June 24, 2009 okay on the mod I made it to where a user can buy speed, steroids, and pcp to increase agility, strength, and guard for 15 mins, I just need help with the cron part, I need it to only update the userstats where the users speed, or steroids or pcp is at 1. here is what I tried but it updates everybody!!! LOL $ef=$db->query("SELECT * FROM users WHERE userid > 0"); $eff=$db->fetch_row($ef); $db->query("UPDATE `users` SET speed=speed-1 WHERE `speed` > 0"); $db->query("UPDATE `users` SET steroids=steroids-1 WHERE `steroids` > 0"); $db->query("UPDATE `users` SET pcp=pcp-1 WHERE `pcp` > 0"); $db->query("UPDATE `userstats` SET agility=agility/2 WHERE {$eff['speed']}='1'"); $db->query("UPDATE `userstats` SET guard=guard/2 WHERE {$eff['pcp']}='1'"); $db->query("UPDATE `userstats` SET strength=strength/2 WHERE {$eff['steroids']}='1'"); If you get this working for me I will send you the whole scripts. the rest of it works perfectly, I made it to where you create the speed pcp and steroids as items and they go in the item type drug and can be used like regular items!! Please help so I can get this out there ;) I suck at having to read from two different tables for updates :( I will get the hang of that soon :D Quote Link to comment Share on other sites More sharing options...
Haunted Dawg Posted June 24, 2009 Share Posted June 24, 2009 Re: I need help with an update script for a little mod I did mysql_query('UPDATE `users` SET `speed` = LEAST(`speed` - 1, 0), `steroids` = LEAST(`steroids` - 1, 0), `pcp` = LEAST(`pcp` - 1, 0)' ); //PCP $pcp = mysql_query('SELECT `userid` FROM `users` WHERE `pcp` > 0'); while($pcps = mysql_fetch_assoc($pcp)) { mysql_query('UPDATE `userstats` SET `guard` = (`guard` / 2) WHERE `userid` = ' , $pcps['userid']); } //Speed $speed = mysql_query("SELECT `userid` FROM `users` WHERE `speed` > 0"); while($speeds = mysql_fetch_assoc($speed)) { mysql_query('UPDATE `userstats` SET `agility` = (`agility` / 2) WHERE `userid` = ' , $speeds['userid']); } //Sterioids $steriod = mysql_query('SELECT `userid` FROM `users` WHERE `sterioids` > 0'); while($steriods = mysql_fetch_assoc($steriod)) { mysql_query('UPDATE `userstats` SET `strength` = (`strength` / 2) WHERE `userid` = ' , $steriods['userid']); } From your script, that will work. But where is it updating their strength, speed & guard back to normal? Quote Link to comment Share on other sites More sharing options...
plintu Posted June 24, 2009 Author Share Posted June 24, 2009 Re: I need help with an update script for a little mod I did yes I made it to where when they are on the drugs it doubles their stat (depending on which drugs they take) and when the 15 mins is up their strength goes back down to normal!! ;) Here I am gonna pull all the files you need and send them to ya ;) Quote Link to comment Share on other sites More sharing options...
mj12 Posted June 24, 2009 Share Posted June 24, 2009 Re: I need help with an update script for a little mod I did what happens if the person goes to the gym and trains there stats? Quote Link to comment Share on other sites More sharing options...
plintu Posted June 25, 2009 Author Share Posted June 25, 2009 Re: I need help with an update script for a little mod I did what happens if the person goes to the gym and trains there stats? well in my game the gym determines how much they gain like this: $gain+=(($ir['stamina']/100)+($_POST['amnt']/2)); so only stamina and the amount they train matters as to how much the will get so nothing will change with the training. also in the standard mccodes what they gain is determined by: $gain+=rand(1,3)/rand(800,1000)*rand(800,1000)*(($ir['will']+20)/150); so will is the determining factor so it would be the same thing, this will not affect training what-so-ever. but I did have to change the cron that Haunted dawg sent, that one was off just a tad but it is working now. Quote Link to comment Share on other sites More sharing options...
mj12 Posted June 25, 2009 Share Posted June 25, 2009 Re: I need help with an update script for a little mod I did Ok so in mc the current value of a stat has no effect whatsoever on how much of that stat you gain Quote Link to comment Share on other sites More sharing options...
plintu Posted June 26, 2009 Author Share Posted June 26, 2009 Re: I need help with an update script for a little mod I did Ok so in mc the current value of a stat has no effect whatsoever on how much of that stat you gain nope it doesn't multiply by how much strength or agility or whatever that you already have, it only adds to it! 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.