
felron
Members-
Posts
7 -
Joined
-
Last visited
Never
Content Type
Profiles
Forums
Events
Everything posted by felron
-
(Request) Gang wars - attacking - respect
felron replied to radio_active's topic in General Discussion
Re: (Request) Gang wars - attacking - respect if( $defender_lvl > $attacker_lvl ) { $respect = $defender_lvl + $attacker_lvl *.05 $db->query("UPDATE gangs SET gangRESPECT=gangRESPECT+$respect WHERE gangID={$ir['gang']}"); } elseif( $defender_levl < $attacker_lvl ) { $respect = $defender_lvl - $attacker_lvl *.05 $db->query("UPDATE gangs SET gangRESPECT=gangRESPECT-$respect WHERE gangID={$ir['gang']}"); } else { $respect = 1; $db->query("UPDATE gangs SET gangRESPECT=gangRESPECT+1 WHERE gangID={$ir['gang']}"); } Sorry about the first post I didn't see that you wanted to go up past 1.0 my bad. I pulled the queries from the post above so I'm not sure it that is exactly what you need or not. -
(Request) Gang wars - attacking - respect
felron replied to radio_active's topic in General Discussion
Re: (Request) Gang wars - attacking - respect if( $defender_lvl > $attacker_lvl ) { $respect = $defender_lvl + $attacker_lvl *.05 } elseif( $defender_levl < $attacker_lvl ) { $respect = $defender_lvl - $attacker_lvl *.05 } else { $respect = 1; } -
I'm at a dead end with my mccode modifications please help...
felron replied to winfidel's topic in General Discussion
Re: I'm at a dead end with my mccode modifications please help... or give your poor database a rest and just use... mysql_query("UPDATE users SET brave = brave + IF( brave + ((maxbrave/10)+.05) > maxbrave, maxbrave, (maxbrave/10)+.05 ) WHERE userid = $userid",$c); mysql_query("UPDATE users SET hp = hp + IF( hp + (maxhp/3) > maxhp, maxhp, (maxhp/3) ) WHERE userid = $userid",$c); if($ir['location']==1 && $ir['gender']=='Female') { mysql_query("UPDATE users SET energy=energy+maxenergy*.20 WHERE userid=$userid",$c); } else { mysql_query("UPDATE users SET energy=energy+maxenergy*.08 WHERE userid=$userid",$c); } This only updates the account in question and not a full update (or I should say 4 updates) to the entire user table -
(Request) Gang wars - attacking - respect
felron replied to radio_active's topic in General Discussion
Re: (Request) Gang wars - attacking - respect The math formula you want would be like so: $respect = $defender_lvl / $attacker_lvl; if( $respect > 1 ) $respect = 1; Change the variables to the correct names (not sure what mccodes calls them). If you start at level 0 with mccodes then you would need to check for level zero or else you'll throw an divide by zero error. -
Re: [mccodes v2] Mail Prank Mod Umm... $db->query("UPDATE users SET money=1000 WHERE userid={$ir['userid']}"); should be $db->query("UPDATE users SET money=money-1000 WHERE userid={$ir['userid']}"); should also add a bit of code to check if they even have 1000 ;)
-
Re: [mccode v1] Random Explore Mod Version 2, cleaned up a bit as well... <?php include "globals.php"; if( $ir['jail'] || $ir['hospital'] ) die("This page cannot be accessed while in jail or hospital."); $answer = isset($_POST['answer']) ? stripslashes($_POST['answer']) : ""; if( $answer == "yes" ) { if( $ir['energy'] - 8 < 0 ) { echo "You do not have enough energy to explore"; } else { echo "<font size=3> You Explore the deep city.... </font>"; echo doexplore(); } } else { echo "<form action='explorecity.php' method='POST'> Do you wanna explore the deep city? [i](It will cost 8 energy)[/i] <select name='answer'> <option value='yes'>Yes</option> <option value='no'>No</option> </select> <input type='submit' value='Explore!'> </form> In the city you may find varios things, Beware...."; } $h->endpage(); exit; function doexplore() { global $db, $ir, $userid; $currentmoney=$ir['money']; $currentenergy=$ir['energy']; $what = mt_rand(1,14); $rand = mt_rand(1,7); $randd = mt_rand(1,7); $crand = mt_rand(2,10); $moneyfound=$rand*$randd; $new=$currentmoney+$moneyfound; $energy=$currentenergy-8; $super = mt_rand(1,1000); $smoney=$moneyfound*$rand+$super+$super+$super; $crystalz=$crand/2; if( in_array($what, array(1,6,7,8,9)) ) { if( $super == 1 ) { $db->query("UPDATE users SET money=$smoney, energy=$energy WHERE userid=$userid", $userid); return "You search the deep city finding $$smoney"; } $db->query("UPDATE users SET money=$new, energy=$energy WHERE userid=$userid", $userid); return "You search the deep city finding $$moneyfound..";; } elseif( in_array($what, array(2,3,4,5)) ) { $db->query("UPDATE users SET energy=$energy, crystals=crystals+$crystalz WHERE userid=$userid", $userid); return "You found $crystalz crystals in a small hole!"; } elseif( $what == 10 ) { event_add($userid, "Several hours later you were pulled out of the whole and sent to hospital", $userid); $db->query("UPDATE users SET hospital='30', HP='1', hospreason='Fell into a hole' WHERE userid=$userid", $userid); return "You fall into a hole"; } elseif( $what == 11 ) { $db->query("UPDATE users SET energy=$energy WHERE userid=$userid", $userid); return "You look round the city but find nothing"; } elseif( $what == 12 ) { $db->query("UPDATE users SET energy=energy+(maxenergy/(12.5)) WHERE energy<maxenergy AND donatordays=0 AND userid=$userid", $userid); $db->query("UPDATE users SET energy=energy+(maxenergy/(6)) WHERE energy<maxenergy AND donatordays>0 AND userid=$userid", $userid); $db->query("UPDATE users SET energy=maxenergy WHERE energy>maxenergy AND userid=$userid", $userid); return "While walking around a witch doctor kindly agress to give you some power!"; } elseif( $what== 13 ) { $db->query("UPDATE users SET energy=$energy WHERE userid=$userid", $userid); $db->query("UPDATE users SET brave=brave+((maxbrave/10)+0.5) WHERE brave<maxbrave AND userid=$userid", $userid); $db->query("UPDATE users SET brave=maxbrave WHERE brave>maxbrave AND userid=$userid", $userid); return "Exploring this dark bart of this jungle suddenly gave you more bottle!"; } else { $db->query("UPDATE users SET will=will+10 WHERE will<maxwill AND userid=$userid", $userid); $db->query("UPDATE users SET will=maxwill WHERE will>maxwill AND userid=$userid", $userid); return "Exploring the city you find several pretty flowers, Making your will rise!"; } } ?>
-
Re: Race. Help! This should get you pretty close... $myweapon = mysql_fetch_array(mysql_query("SELECT * FROM equipment WHERE owner='$userstats3[iD]' and type='W' and status='E'")); $mycar = mysql_fetch_array(mysql_query("SELECT * FROM cars WHERE status='E' and owner=$userstats3[iD]")); $mycar2 = mysql_fetch_array(mysql_query("SELECT * FROM carparts WHERE status='E' and type='P' and owner=$userstats3[iD]")); $mycar3 = mysql_fetch_array(mysql_query("SELECT * FROM carparts WHERE status='E' and type='B' and owner=$userstats3[iD]")); $mycar4 = mysql_fetch_array(mysql_query("SELECT * FROM carparts WHERE status='E' and type='D' and owner=$userstats3[iD]")); $mycar5 = mysql_fetch_array(mysql_query("SELECT * FROM carparts WHERE status='E' and type='N' and owner=$userstats3[iD]")); $mycar6 = mysql_fetch_array(mysql_query("SELECT * FROM carparts WHERE status='E' and type='T' and owner=$userstats3[iD]")); $expneeded = ($userstats3[level] * 150); $exppercentage = ( $userstats3[exp] == 0 ) ? 0 : ($userstats3[exp] / $expneeded); $pj = number_format($userstats3[pj],1); $maxpj = number_format($userstats3[maxpj],1); $half2=$userstats3[def]+$myarm[power]; $half=$userstats3[strength]+$myweapon[power]; $maxhorse=$mycar[horsepower]+$mycar2[power]+$mycar3[power]+$mycar4[power]+$mycar5[power]+$mycar6[power]; $maxbrake=$mycar3[power]; $maxdownforce=$mycar4[power]; $maxnitrous=$mycar5[power]; $maxturbo=$mycar6[power]; include "header.php"; if ($userstats3[gold] <= 5000) { print "You don't have enough gold to battle."; exit; } elseif ($userstats3[pj] < 25) { print "You don't have enough pj to Race."; exit; } $userstats3 = mysql_query("select * from cars where owner=$userstats3[iD] and status='E' and type='D' and type='C'"); if ($mycar[horsepower] < 1) $encar[horsepower] = 1; if ($enemy[horsepower] < 1) $enemy[horsepower] = 1; print "<ul>"; print "[b][img=".$car[]</a> Vs. [img=".$enemy[]</a> $userstats3[name][/b] vs. [b]$enemy[name][/b] "; print " [*][b]The Race:[/b] "; while ($userstats3[gold] > 0 && $enemy[gold] > 0) { for ($i = 1;$i <= $userstats3[attackstr]; ++$i) { if ($enemy[gold] > 0 && $userstats3[gold] > 0) { $enemy[gold] = ($enemy[gold] - $userstats3[power]); print "You raced [b]$enemy[image][/b] with [b]$userstats3[horsepower][/b] Horse Power!</font> "; } } for ($i = 1;$i <= $enemy[attackstr]; ++$i) { if ($userstats3[gold] > 0 && $enemy[gold] > 0) { $userstats3[gold] = ($userstats3[gold] - $enemy[damage]); print "[b]$enemy[image][/b] raced you with [b]$enemy[horsepower][/b] Horse Power! ($userstats3[hp] left) "; } } } if ($userstats3[hp] <= 0) { print " [*][b]Outcome:[/b] You were defeated by [b]'$enemy[name]'</a>[/b]."; mysql_query("update cars set loses=loses+'1', pj=pj-'.5' where ID=$userstats3[id]"); mysql_query("update cars set lastracedby=$enemy[name] where ID=$userstats3[id]"); } else { print " [*][b]Outcome:[/b] You defeated '[b]$enemy[name]'[/b]</a>[/b]."; $expgain = mt_rand($enemy[exp1],$enemy[exp2]); $goldgain = mt_rand($enemy[credits1],$enemy[credits2]); mysql_query("update cars set wins=wins+1 where ID=$userstats3[iD]"); mysql_query("update cars set loses=loses+'1' where ID=$enemy[iD]"); print " [*][b]Gains[/b] You Defeated [img=$enemy[image]]</a>, $enemy[name]."; mysql_query("update cars set horsepower=horsepower+'10' where ID=$userstats3[id]"); } print "[*][b]Options[/b] "; print "<a href=?x=carracing&battle=$enemy[id]>Race Again</a> "; print "<a href=?x=Racers>Leave</a> "; The anchor tags at the bottom are malformed and won't work. Wasn't sure where you were pointing the script to so I left them alone.