Jump to content
MakeWebGames

Ragnar

Members
  • Posts

    150
  • Joined

  • Last visited

    Never

Everything posted by Ragnar

  1. Re: [V2] Reward the active. - Punish the inactive. If some one knows how to make this work, please post the code!! Something like.. if ($Inactive for five days) { Create this event mySQL query. } $db->query("INSERT INTO events VALUES('',$userid,unix_timestamp(),0,The Admin sent you a note. It says: Today you did not get bank interest. If you are inactive for X days, you won't start geting it until you log on again. Same goes for Street turns. Plus, on days you don't log in, you won't get paid for your job, or get credit for showing up to school. Also, you might of noticed you gain some money/crystals at the end of the day. You also won't get those if you havn't loged in in X days. On the plus side, if you're a doner, you won't lose a doner day on days you don't log in) WHERE daysinactive = 5"); This would be a nice way to let them know and hopefully get them to be more active.
  2. Re: Advanced Dating (v1) Does partner.php come with version 1, or did some one else make it? Cause it doesn't come with version 2 and it would be nice to have this work with version 2.
  3. Re: Crystal bank intrest   That won't work unless he installs the mod that adds daysinactive to the user table.
  4. Re: [mccode] Mining mod Working version 2, with the screwed up issues fixed.... mine.php   <?php include "globals.php"; switch($_GET['action']) { case 'mine': mine_1(); break; case 'minesub': mine_1_sub(); break; case 'mine2': mine_2(); break; case 'mine2sub': mine_2_sub(); break; case 'mine3': mine_3(); break; case 'mine3sub': mine_3_sub(); break; case 'mine4': mine_4(); break; case 'mine4sub': mine_4_sub(); break; case 'mine5': mine_5(); break; case 'mine5sub': mine_6_sub(); break; case 'mine6': mine_6(); break; case 'mine6sub': mine_6_sub(); break; default: mine_index(); break; } function mine_index() { global $ir,$c,$userid,$db; print "<center>Welcome to the mine shaft. There are 3 spots to go mining but thay are restricted depending on your mine level. Your mining level is {$ir['mine_level']} and you have {$ir['mine_exp']}/{$ir['mine_needed']} mining experience </center>"; print "<center> <u>Crystal Mines</u> [[url='mine.php?action=mine']Level 1 mine[/url]] [[url='mine.php?action=mine2']Level 20 mine[/url]] [[url='mine.php?action=mine3']Level 40 mine[/url]] <u>Money Mines</u> [[url='mine.php?action=mine4']Level 10 mine[/url]] [[url='mine.php?action=mine5']Level 30 mine[/url]] [[url='mine.php?action=mine6']Level 40 mine[/url]] </center>"; } $db->query("UPDATE users SET max_power=mine_level*10 WHERE userid=$userid",$c); $db->query("UPDATE users SET mine_level=mine_level+1 WHERE mine_exp > mine_needed AND userid=$userid",$c); $db->query("UPDATE users SET mine_exp=0 WHERE mine_needed < mine_exp AND userid=$userid",$c); $db->query("UPDATE users SET mine_needed=mine_level*1000 WHERE userid=$userid",$c); if ($ir['jailtime'] > 0){ print "<center>The mine is closed to jail birds come back when thay release you</center>"; exit; } if ($ir['hospital'] > 0){ print "<center>You cant go mining while in hospital</center>"; exit; } function mine_1() { global $ir,$c,$userid,$db; if($ir['power'] < 10){ print "You need 10 power to mine here your have {$ir['power']}"; exit; } $db->query("UPDATE users SET power=power-10 WHERE userid=$userid",$c); $rand_gems = rand(1,5); $rand_exp = rand(1,100); echo "<center>You begin mining in the level 1 mine and found $rand_gems crystal(s).</center> "; $db->query("UPDATE users SET crystals=crystals+'$rand_gems',mine_exp=mine_exp+'$rand_exp' WHERE userid=$userid",$c); print "<center>[[url='mine.php?action=mine']Mine again[/url]]</center> "; print "<center>[[url='mine.php']Back[/url]]</center> "; } function mine_2() { global $ir,$c,$userid,$db; if($ir['power'] < 15){ print "<center>You need 15 power to mine here your have {$ir['power']}</center>"; exit; } if($ir['mine_level'] < 20){ print "<center>You need to be mining level 20 to mine here you are mining level {$ir['mine_level']}</center>"; exit; } $db->query("UPDATE users SET power=power-15 WHERE userid=$userid",$c); $rand_gems = rand(1,20); $rand_exp = rand(1,300); echo "<center>You begin mining in the level 20 mine and found $rand_gems crystal(s).</center> "; $db->query("UPDATE users SET crystals=crystals+'$rand_gems',mine_exp+'$rand_exp' WHERE userid=$userid",$c); print "<center>[[url='mine.php?action=mine2']Mine again[/url]]</center> "; print "<center>[[url='mine.php']Back[/url]]</center> "; } function mine_3() { global $ir,$c,$userid,$db; if($ir['power'] < 25){ print "<center>You need 25 power to mine here your have {$ir['power']}</center>"; exit; } if($ir['mine_level'] < 40){ print "<center>You need to be mining level 40 to mine here you are mining level {$ir['mine_level']}</center>"; exit; } $db->query("UPDATE users SET power=power-25 WHERE userid=$userid",$c); $rand_gems = rand(1,40); $rand_exp = rand(1,600); echo "<center>You begin mining in the level 40 mine and found $rand_gems crystal(s).</center> "; $db->query("UPDATE users SET crystals=crystals+'$rand_gems',mine_exp+'$rand_exp' WHERE userid=$userid",$c); print "<center>[[url='mine.php?action=mine3']Mine again[/url]]</center> "; print "<center>[[url='mine.php']Back[/url]]</center> "; } function mine_4() { global $ir,$c,$userid,$db; if($ir['power'] < 10){ print "You need 10 power to mine here your have {$ir['power']}"; exit; } if($ir['mine_level'] < 10){ print "<center>You need to be mining level 10 to mine here you are mining level {$ir['mine_level']}</center>"; exit; } $db->query("UPDATE users SET power=power-10 WHERE userid=$userid",$c); $rand_money = rand(1,1000); $rand_exp = rand(1,100); echo "<center>You begin mining in the level 10 mine and found $$rand_money .</center> "; $db->query("UPDATE users SET money=money+'$rand_money',mine_exp=mine_exp+'$rand_exp' WHERE userid=$userid",$c); print "<center>[[url='mine.php?action=mine4']Mine again[/url]]</center> "; print "<center>[[url='mine.php']Back[/url]]</center> "; } function mine_5() { global $ir,$c,$userid,$db; if($ir['power'] < 15){ print "<center>You need 15 power to mine here your have {$ir['power']}</center>"; exit; } if($ir['mine_level'] < 30){ print "<center>You need to be mining level 30 to mine here you are mining level {$ir['mine_level']}</center>"; exit; } $db->query("UPDATE users SET power=power-15 WHERE userid=$userid",$c); $rand_money = rand(1,3000); $rand_exp = rand(1,300); echo "<center>You begin mining in the level 30 mine and found $$rand_money .</center> "; $db->query("UPDATE users SET money=money+'$rand_money',mine_exp+'$rand_exp' WHERE userid=$userid",$c); print "<center>[[url='mine.php?action=mine5']Mine again[/url]]</center> "; print "<center>[[url='mine.php']Back[/url]]</center> "; } function mine_6() { global $ir,$c,$userid,$db; if($ir['power'] < 25){ print "<center>You need 25 power to mine here your have {$ir['power']}</center>"; exit; } if($ir['mine_level'] < 40){ print "<center>You need to be mining level 40 to mine here you are mining level {$ir['mine_level']}</center>"; exit; } $db->query("UPDATE users SET power=power-25 WHERE userid=$userid",$c); $rand_money = rand(1,8000); $rand_exp = rand(1,600); echo "<center>You begin mining in the level 40 mine and found $$rand_money .</center> "; $db->query("UPDATE users SET money=money+'$rand_money',mine_exp+'$rand_exp' WHERE userid=$userid",$c); print "<center>[[url='mine.php?action=mine6']Mine again[/url]]</center> "; print "<center>[[url='mine.php']Back[/url]]</center> "; } ?>   In phpMyAdmin, if you already got the tables, first enter ALTER TABLE `users` DROP `mine_level` , DROP `mine_exp` , DROP `mine_needed` , DROP `power` , DROP `max_power` ; to delete them, and then re-add them using... ALTER TABLE `users` ADD `mine_level` int(11) NOT NULL default 1; ALTER TABLE `users` ADD `mine_exp` int(11) NOT NULL default 1; ALTER TABLE `users` ADD `mine_needed` int(11) NOT NULL default 1000; ALTER TABLE `users` ADD `power` int(11) NOT NULL default 10; ALTER TABLE `users` ADD `max_power` int(11) NOT NULL default 10; In cron_fivemins.php add $db->query("UPDATE users SET power=power+5 WHERE power<max_power"); In global_func.php replace function get_rank($stat, $mykey) with   function get_mine() { global $db,$ir,$userid; if($ir['mine_exp'] >= $ir['mine_needed']) { $power=(int) ($ir['power']/$ir['max_power']*100); $minexp=(int) ( $ir['mine_exp']/$ir['mine_needed']*100); $ir['mine_level']+=1; $ir['mine_exp']=$minexp; $ir['mine_needed']=(int) (($ir['mine_level']+1)*($ir['mine_level']+1)*($ir['mine_level']+1)*2.2); $db->query("UPDATE users SET mine_level=mine_level+1,mine_exp=$minexp,mine_needed=mine_needed+1000,max_power=max_power+10 where userid=$userid"); } } function get_rank($stat, $mykey)
  5. Re: [mccode] Mining mod To get the experience and leveling up stuff working for version 2, in mine.php, replace if ($ir['jailtime'] > 0){ with if ($ir['jailtime'] > 0){ $db->query("UPDATE users SET max_power=mine_level*10 WHERE userid=$userid",$c); $db->query("UPDATE users SET mine_level=mine_level+1 WHERE mine_exp > mine_needed AND userid=$userid",$c); $db->query("UPDATE users SET mine_exp=0 WHERE mine_needed < mine_exp AND userid=$userid",$c); $db->query("UPDATE users SET mine_needed=mine_level*1000 WHERE userid=$userid",$c);
  6. Re: who likes mccodes?   Case in point: I'm a php/mySQL n00bie. I bought version 2 only a week ago, with using it to learn php/mySQL as part of the reason, along with making a game, and today I posted my first mod that makes some nice changes to the game!!
  7. Re: [V2] Reward the active. - Punish the inactive. Remember, I'm a mySQL/php total n00bie. With this method, any one can figure it out, including us n00bies. While only you php/mySQL pros can figure out the timestamp stuff!
  8. Re: [V2] Reward the active. - Punish the inactive. For version 1... Find all the places where it says: $db->query And replace it with: mysql_query
  9. This is a bunch of different mods that you can choose from. You don't have to use them all. Note: Do a back-up first!! I'm a mySQL/php total n00bie! Heck, I've had the script for only a week and havn't even created my first town!! Though I've tested everything except the Supporter days part. Punish inactive players... 1. Players don't get bank interest if they have gone X days with out loging in. Once they log in again, they start geting the bank interest again. (A nice anti-inflation tool.) 2. Days remaining in the education course doesn't count down if you don't log in during the day. 3. Players don't get paid for working at the job for days they don't log in! (Welcome to the real world, how may I help you!!!) 4. Players don't get street steps if they have gone X days with out loging in. (Not needed if it get's reset each day.) Reward active players/supporters.... 1. Players get X crystals and/or cash if they loged in with in the last day. 2. If a donor doesn't log in, he doesn't lose a donor/supporter day. Run query ALTER TABLE `users` ADD `daysinactive` int(11) NOT NULL default 0; In authenticate.php replace $db->query("UPDATE users SET lastip_login='$IP',last_login=unix_timestamp() WHERE userid={$mem['userid']}"); with $db->query("UPDATE users SET lastip_login='$IP',last_login=unix_timestamp() WHERE userid={$mem['userid']}"); $db->query("UPDATE users SET daysinactive=0 WHERE userid={$mem['userid']}"); In cron_day.php replace $db->query("DELETE FROM fedjail WHERE fed_days=0"); with $db->query("DELETE FROM fedjail WHERE fed_days=0"); $db->query("UPDATE users SET daysinactive=daysinactive+1"); Now for the mods... Players only get bank interest if they have loged in with in the last X days. In cron_day.php replace $db->query("UPDATE users SET bankmoney=bankmoney+(bankmoney/50) where bankmoney>0"); $db->query("UPDATE users SET cybermoney=cybermoney+(cybermoney/100*7) where cybermoney>0"); with $db->query("UPDATE users SET bankmoney=bankmoney+(bankmoney/50) WHERE bankmoney>0 AND daysinactive < 5"); $db->query("UPDATE users SET cybermoney=cybermoney+(cybermoney/100*7) WHERE cybermoney>0 AND daysinactive < 5"); Change 5 to the number of days you want players to be inactive before they stop getting bank interest. And if you wanna let other players get the money after XX days, also add... $db->query("UPDATE users SET money=bankmoney+cybermoney+money AND daysinactive > 30"); $db->query("UPDATE users SET cybermoney=0 where daysinactive > 30"); $db->query("UPDATE users SET bankmoney=0 where daysinactive > 30"); Change 30 to the number of days you want players to be inactive before they get their money taken out of the bank so other players can attack them for the cash. Got inactive players with a ton of cash and want to generate some excitement with an announce of the time you'll do this?? In cron_minute.php add... $db->query("UPDATE users SET hp=maxhp WHERE daysinactive > 30"); $db->query("UPDATE users SET hospital=0 WHERE daysinactive > 30"); and all the players that haven't loged in with in 30 days will be in the hospital for just one minute and get out with all HP back. (If they ever log in, they will go back to normal, since 'daysinactive' will reset back to zero.) Only get credit for taking an education course if players have loged in during the day. In cron_day.php replace $db->query("UPDATE users SET cdays=cdays-1 WHERE course > 0"); with $db->query("UPDATE users SET cdays=cdays-1 WHERE course > 0 AND daysinactive < 1"); Players only get paid for showing up to work if they have loged in during the day. In cron_hour.php replace $db->query("UPDATE users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN jobs j ON j.jID=u.job LEFT JOIN jobranks jr ON u.jobrank=jr.jrID SET u.money=u.money+jr.jrPAY, u.exp=u.exp+(jr.jrPAY/20) WHERE u.job > 0 AND u.jobrank > 0"); $db->query("UPDATE userstats us LEFT JOIN users u ON u.userid=us.userid LEFT JOIN jobs j ON j.jID=u.job LEFT JOIN jobranks jr ON u.jobrank=jr.jrID SET us.strength=(us.strength+1)+jr.jrSTRG-1,us.labour=(us.labour+1)+jr.jrLABOURG-1,us.IQ=(us.IQ+1)+jr.jrIQG-1 WHERE u.job > 0 AND u.jobrank > 0"); with $db->query("UPDATE users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN jobs j ON j.jID=u.job LEFT JOIN jobranks jr ON u.jobrank=jr.jrID SET u.money=u.money+jr.jrPAY, u.exp=u.exp+(jr.jrPAY/20) WHERE u.job > 0 AND u.jobrank > 0 AND daysinactive < 1"); $db->query("UPDATE userstats us LEFT JOIN users u ON u.userid=us.userid LEFT JOIN jobs j ON j.jID=u.job LEFT JOIN jobranks jr ON u.jobrank=jr.jrID SET us.strength=(us.strength+1)+jr.jrSTRG-1,us.labour=(us.labour+1)+jr.jrLABOURG-1,us.IQ=(us.IQ+1)+jr.jrIQG-1 WHERE u.job > 0 AND u.jobrank > 0 AND daysinactive < 1"); Don't give out Street turns to players that havn't loged in in X days. If they keep their steps at the end of the day instead of being reset to say 100, replace $db->query("UPDATE users SET turns=turns+100"); with $db->query("UPDATE users SET turns=turns+100 where daysinactive < 5"); $db->query("UPDATE users SET turns=100 where daysinactive > 5"); $db->query("UPDATE users SET turns=turns where turns > 1000"); With 100 being the number of steps you give out each day, and 5 being how many days you want the players to be inactive to not get steps. Reward active players. In cron_day.php add $db->query("UPDATE users SET money=money+(level*1000) WHERE daysinactive < 5"); And change 1000 to how much cash you want to hand out per level and 5 to the max inactive days for a player to get it. And/or a crystal mass payment... Gain one crystal per day per level up to Level XX.... $db->query("UPDATE users SET crystals=crystals+(level*1) WHERE daysinactive < 5 AND level < 100"); Edit 100 to how many crystals they should get max a day. Level 100 or above, gain 100 crystals a day.... $db->query("UPDATE users SET crystals=crystals+100 WHERE daysinactive < 5 AND level > 99"); Edit 100 to how many crystals they should get max a day and the level where the daily payout stops. In both codes, make sure 100 is changed to the same number and the 99 is one number below the other number. Of course players will have to come on to keep other players from taking the crystals and cash. Supporter courtesy. Want to show courtesy for players that fork over cash but some times have a day where they don't log on to benefit from it? For donor days... In cron_day.php replace... $db->query("UPDATE users SET donatordays=donatordays-1 WHERE donatordays > 0"); with $db->query("UPDATE users SET donatordays=donatordays-1 WHERE donatordays > 0 AND daysinactive < 1"); Supporter days, in cron_day.php replace... $db->query("UPDATE users SET supporterdays=supporterdays-1 WHERE supporterdays > 0"); with $db->query("UPDATE users SET supporterdays=supporterdays-1 WHERE supporterdays > 0 AND daysinactive < 1"); Then, if they don't log on, they won't lose the donor/supporter days on days they don't log on and benefit from getting more energy. Of course if they get benefits like a higher bank interest rate, you don't wanna do one or both of these. Got any other mods that give players something each day?? Study the code and you can easily do this for those mods. AND daysinactive < 5 is less than five days and AND daysinactive > 5 is more than five days. :-o You didn't actually read all that, did you!!! tldr; :-o
  10. Re: [mccode] Steps market Thanks. That did it, a mass search and replace of global $ir,$c,$userid,$h; to global $ir,$c,$userid,$h,$db;
  11. Re: [mccode] Steps market What do you change on these lines to work with version 2? After converting the mod to version 2... $q=$db->query("SELECT steps.*, u.* FROM stepsmarket steps LEFT JOIN users u ON u.userid=steps.stepsADDER ORDER BY stepsPRICE/stepsQTY ASC",$c); generates Fatal error: Call to a member function on a non-object in /home/virtual/site7/fst/var/www/html/stepsmarket.php on line 32 and $db->query("INSERT INTO stepsmarket VALUES('',{$_POST['amnt']},$userid,$tp)", $c); $db->query("UPDATE users SET turns=turns-{$_POST['amnt']} WHERE userid=$userid", $c); generates Fatal error: Call to a member function on a non-object in /home/virtual/site7/fst/var/www/html/stepsmarket.php on line 99
  12. Re: [v1 & v2]Reset your users without deleating them Does this have any security feature to keep players from loading the page and reseting everyone!! I'm guessing it's best to only have this script uploaded when you actually want to do this!
  13. Re: Money,crystals cap How do you get rid of the decimal places in userstats? It makes it look ugly!! aka...90210.113222434154. When you start an account, with the lowest property, unless you change it to have even less will, it gives you 10 stat per train.
  14. Re: Creating crimes in V2 Is it possible to create crimes that give out stats like IQ?
  15. Re: Paid mod idea, v2: Server friendly Cronjobs.  
  16. Say you got 10,000 players and only 500 are active. That's a lot of needless server CPU being used every time the cron files go off that can slow the server down, which can especially be bad if you don't have a dedicated server. The five minutes one can be so slow that you can't do anything until it's finished. For cron_minute.php and cron_fivemins.php is there some way to move the Cronjobs to header.php and viewuser.php so the server only checks and if needed, updates the jail/hospital time for a player when he/she actually loads a page, and energy/HP/will on the first time he loads the page or another player views his profile, after 5, 10, 15...minutes after the hour and still gets the right amount back, so for example, if he next loads the page three hours later with out another player viewing his profile, he gains 100% HP and energy, and not what he would of normally got from one five minutes update? If any one can make this, it would be well worth it being a paid mod. And only spiting out daily bank interest/street turns...to players who have loged in with in the last say three days, would be a plus.
×
×
  • Create New...