
legrolls
Members-
Posts
111 -
Joined
-
Last visited
Never
Content Type
Profiles
Forums
Events
Everything posted by legrolls
-
Re: If you are a certain gender you can do different things than another? This did not work, here's what I got: <? include "globals.php"; if ($ir['gender'] == 'Human') { // Meh... } else if ($ir['gender'] == 'Alien') { // Mehh? xD } ?> Please note that instead of Male and Female, it is Human and Alien
-
Re: exp bar goes over 100%? It's v2...and I think it was because I made a npc too easy...
-
Re: exp bar goes over 100%? And refreshing the page does nothing...
-
Re: exp bar goes over 100%? There currently is no property ingame...
-
This basic mod allows you to create your own crystal by buying materials. Once you create a crystal successfully, you also gain a small amount of exp. It's not that great, but I didn't see any up here, so I thought I might as well post mine. It's based off of a car racing mod around here, and it was the first mod I ever made. run this sql ALTER TABLE users ADD makecrystal INT(11) DEFAULT 0; makecrystalbuy.php <?php include "globals.php"; print "<h3>Buy materials for making crystals</h3> If you already have the materials, create a crystal [<u><a href='makecrystal.php'>Here</u>]"; print " <table border=2><th>Material</th><th>Price</th><th>Purchase</th> <tr> <td>Crystal Materials</td><td>$175</td><td>[url='makecrystalbuy.php?spend=materials']Buy[/url]</td></table>"; if($_GET['spend'] == 'materials') { if($ir['money'] <175) { print "You don't have enough money!"; } else { if($ir['money'] >174) { print "You bought the materials! [url='index.php']Go Home[/url] [url='makecrystal.php']Make a crystal[/url]"; $db->query("UPDATE users SET money=money-175,makecrystal=1 WHERE userid=$userid",$c); } } } $h->endpage(); ?> makecrystal.php <?php include "globals.php"; if($ir['makecrystal'] == 0) { die("Making a crystal without materials? Good luck!"); } else { if($ir['makecrystal'] == 1) { //set $win prize winings $win=rand(100,250); $loss=rand(100,300); if(rand(1,30) <= 14) { print "You build a crystal successfully and gain $win exp!"; $db->query("UPDATE users SET exp=exp+$win WHERE userid=$userid",$c); $db->query("UPDATE users SET crystals=crystals+1"); $sql = sprintf("UPDATE users SET makecrystal=0 WHERE userid=%s", $userid); mysql_query($sql); } else { if(rand(1,30) <= 15) { print "You build a crystal successfully and gain $win exp!"; $db->query("UPDATE users SET crystals=crystals+1"); $sql = sprintf("UPDATE users SET makecrystal=0 WHERE userid=%s", $userid); mysql_query($sql); } else { if(rand(1,30) <= 5) { print "You build a crystal but it falls apart..."; $sql = sprintf("UPDATE users SET makecrystal=0 WHERE userid=%s", $userid); mysql_query($sql); } } } } } ?> Somewhere, in the explore page, just link [url='makecrystalbuy.php']Make a crystal[/url] wherever you want it.
-
Re: exp bar goes over 100%? I'm horrible at that kind of stuff, I must say. I know this sounds very noob-like, but could you show me the if statement?
-
Well, a bunch of users have complained that my exp bar goes over 100% for some reason. For example, one person has his exp bar at 351%. How can I fix it back to normal again, or is that normal?
-
Re: Free secure forums? Wow, thanks for that help...
-
Re: day one If it doesn't advertise cron jobs, chances are it doesn't have it. Without cron jobs, anything related to time doesn't work, as far as I know.
-
Re: Free secure forums? How does one secure these forums?
-
Hi, I've been looking for free secure forums. Cronus made some, but the instructions aren't too clear. Are there any more free forums, or better instructions? It can't just be PhpBB or SMF, because I don't want them to sign up AGAIN.
-
Re: day one You need cron jobs.
-
Re: [mc code V2]Updated Lottery I was not credited money either...
-
Re: [V2]Basic Referal mod. Save it under whatever you want. Then just link to it...right?
-
Re: Help !!URGENT!! Your game is easily exploitable. Take down the installer, get a new cmarket and forums. After that, it should be fine.
-
Males only attack females and vice versa?
legrolls replied to legrolls's topic in General Discussion
Re: Males only attack females and vice versa? Wow, talk about a senior moment lol. It works like a charm now. Thanks +2 -
Males only attack females and vice versa?
legrolls replied to legrolls's topic in General Discussion
Re: Males only attack females and vice versa? I posted this right after php include "globals.php";, and it says "No." if you try to attack anything... -
Males only attack females and vice versa?
legrolls replied to legrolls's topic in General Discussion
Re: Males only attack females and vice versa? Still not working, no errors, but not working. This is the original file without the script added. attack.php <?php $menuhide=0; $atkpage=1; include "globals.php"; $user_class=$ir; $q=$db->query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid={$_GET['ID']}"); $attack_person=$db->fetch_row($q); $qo=$db->query("SELECT i.* FROM items i WHERE i.itmid={$user_class['equip_primary']}"); $user_class1=$db->fetch_row($qo); $q1=$db->query("SELECT i.* FROM items i WHERE i.itmid={$user_class['equip_armor']}"); $user_class2=$db->fetch_row($q1); $weapon= "{$user_class1['itmname']}"; if(mysql_num_rows($qo) == 0) { $weapon="Fists"; } $eq=$db->query("SELECT i.* FROM items i WHERE i.itmid IN({$attack_person['equip_primary']})"); if(mysql_num_rows($eq) == 0) { $wep="Fists"; } else { $cnt=0; while($r=$db->fetch_row($eq)) { $enweps[]=$r; $cnt++; } $weptouse=rand(0,$cnt-1); $wep=$enweps[$weptouse]['itmname']; } $enperc=(int) ($ir['energy']/$ir['maxenergy']*100); $gq=$db->query("SELECT * FROM gangs WHERE gangID={$attack_person['gang']}"); $ga=$db->fetch_row($gq); $error = ($enperc < 25) ? "You need to have at least 25% of your energy if you want to attack someone." : $error; $error = ($user_class['jail'] > 0) ? "You can't attack someone if you are in jail." : $error; $error = ($user_class['hospital'] > 0) ? "You can't attack someone if you are in the hospital." : $error; $error = ($_GET['ID'] == "") ? "You didn't choose someone to attack." : $error; $error = ($_GET['ID'] == $userid) ? "You can't attack yourself." : $error; $error = ($attack_person['location'] != $user_class['location']) ? "You must be in the same city as the person you are attacking. Duh." : $error; $error = ($attack_person['username'] == "") ? "That person doesn't exist." : $error; $error = ($attack_person['hospital'] > 0) ? "You can't attack someone that is in the hospital." : $error; $error = ($attack_person['jail'] > 0) ? "You can't attack someone that is in jail." : $error; //$error = ($user_class['level'] > 5 && $attack_person['level'] < 6) ? "You can't attack someone that is level 5 or below because you are higher than level 5." : $error; ////////////// ^^ if you like to have it so noobs stay alive longer ?><div id="main " style="a"><center><?PHP if (isset($error)){ echo ($error); $h->endpage(); exit; } if ($user_class['energy'] >= $user_class['maxenergy']/4) { $user_class['energy']-= floor($user_class['maxenergy']/4); $me=floor($user_class['maxenergy']/4); $db->query("UPDATE users SET energy=energy- {$me} WHERE userid=$userid"); $_SESSION['attacklog']=""; $_SESSION['attackdmg']=0; } $yourhp = $user_class['hp']; $theirhp = $attack_person['hp']; $damagestat = number_format($user_class['strength']) ; $itstat = $user_class1['weapon']; $damplu = $damagestat * ($itstat*100); $ratio=($user_class['level']*100)/($attack_person['level']*100); print "<center>Attack <font color=yellow>The fight Ratio is ".$ratio."%</font> You are in a Battle with ".$attack_person['username']." </center>"; echo " You come in with your ".$weapon." With a Strenght of ".$damplu." (+".$itstat."%) "; $wait = ($user_class['agility'] > $attack_person['agility']) ? 1 : 0; $hospital = 600; $qo=$db->query("SELECT i.* FROM items i WHERE i.itmid IN({$attack_person['equip_primary']})"); $r1=$db->fetch_row($qo); $qo=$db->query("SELECT i.* FROM items i WHERE i.itmid IN({$attack_person['equip_primary']})"); $r2=$db->fetch_row($qo); $damage = (int) (($user_class1['weapon']*$user_class['strength']/($attack_person['guard']/1.5))); $theirdamage = (int) (($r1['weapon']*$attack_person['strength']/($user_class['guard']/1.5))); while($yourhp > 0 && $theirhp > 0){ $damage = ($damage < 1) ? 1 : $damage; $theirdamage = ($theirdamage < 1) ? 1 : $theirdamage; if($wait == 0){ $yourhp = $yourhp - $theirdamage; echo "<font color=red>".$attack_person['usename']."Takes their turn to swing at you!</font> "; echo $attack_person['username']. " hit you for " .number_format($theirdamage). " damage using their ".$wep.". "; } else { $wait = 0; } if($yourhp > 0) { $damage = (int) (($user_class1['weapon']*$user_class['strength']/($attack_person['guard']/1.5))); $damage = ($damage < 1) ? 1 : $damage; $theirhp = $theirhp - $damage; echo "<font color=green>You swing at them!</font> "; echo "You hit " .$attack_person['username']. " for " . number_format($damage) . " damage using your ".$weapon.". "; } if($theirhp <= 0){ // attacker won $winner = $user_class['ID']; $theirhp = 0; $moneywon = floor($attack_person['money'] /10); $expwon = 150 - (25 * ($user_class['level'] - $attack_person['level'])); $expwon = ($expwon < 0) ? 0 : $expwon; $hosptime=20; $hospreason = "Attacked by ".$user_class['username']."" ; $newexp = $expwon + $user_class['exp']; $newmoney = $user_class['money'] + $moneywon; $result = $db->query("UPDATE `users` SET `exp` = '".$newexp."', money = '".$newmoney."' WHERE `userid`='".$user_class['userid']."'"); $newmoney = $attack_person['money'] - $moneywon; $result = $db->query("UPDATE `users` SET `hp`= 1,`hospital` ='".$hosptime."', `money` = '".$newmoney."', `hospreason` = '".$hospreason."' WHERE `userid`='".$attack_person['userid']."'"); $atklog=mysql_escape_string($_SESSION['attacklog']); $db->query("INSERT INTO attacklogs VALUES('',".$user_class['userid'].",".$attack_person['userid'].",'won',unix_timestamp(),".$moneywon.",'$atklog');"); event_add($attack_person['userid'], "You were hospitalized by ".$user_class['username']." for 20 minutes."); $final ="<center>You hospitalized " .$attack_person['username']. ". You gain $expwon exp and stole $".$moneywon." from " .$attack_person['username']. ". </center>"; $pwnd =""; $warq=$db->query("SELECT * FROM gangwars WHERE (warDECLARER={$user_class['gang']} AND warDECLARED={$attack_person['gang']}) OR (warDECLARED={$user_class['gang']} AND warDECLARER={$attack_person['gang']})"); if ($db->num_rows($warq) > 0) { $war=$db->fetch_row($warq); $db->query("UPDATE gangs SET gangRESPECT=gangRESPECT-2 WHERE gangID={$attack_person['gang']}"); $ga['gangRESPECT']-=2; $db->query("UPDATE gangs SET gangRESPECT=gangRESPECT+2 WHERE gangID={$user_class['gang']}"); $pwnd =" You earnt 2 respect for your gang!"; } if ($ga['gangRESPECT']<=0 && $attack_person['gang']) { $db->query("UPDATE users SET gang=0 WHERE gang={$attack_person['gang']}"); $db->query("DELETE FROM gangs WHERE gangRESPECT<='0'"); $db->query("DELETE FROM gangwars WHERE warDECLARER={$ga['gangID']} or warDECLARED={$ga['gangID']}"); } $bots=array(96,94,5,97,98,99,142,138,138,140,141,146,143,144,145);//Your Battle Tent Bots $moneys=array(96 =>5000,94 =>5000,5 => 500,97 => 5000, 98 => 500, 99 => 10000, 142 => 1500,138 =>10000,140 =>10000,141 =>10000,146 =>20000,143 =>15000,144 =>15000,145 =>15000); if(in_array($attack_person['userid'],$bots)) { $gain=$moneys[$attack_person['userid']]; $db->query("UPDATE users SET money=money+$gain WHERE userid=$userid",$c); $finalbot =""; $finalbot =" Congrats, for beating the Challenge Bot {$attack_person['username']}, you have earnt \$$gain!"; } } if($yourhp <= 0){ // defender won $winner = $attack_person['ID']; $yourhp = 0; $moneywon = floor($user_class['money'] /10); $expwon = 100 - (25 * ($attack_person['level'] - $user_class['level'])); $expwon = ($expwon < 0) ? 0 : $expwon; $hosplost = "Lost to ".$attack_person['username']."" ; $hosptime=20; $newexp = $expwon + $attack_person['exp']; $newmoney = $attack_person['money'] + $moneywon; $result = $db->query("UPDATE `users` SET `exp` = '".$newexp."', money = '".$newmoney."' WHERE `userid`='".$attack_person['userid']."'"); $newmoney = $user_class['money'] - $moneywon; $result = $db->query("UPDATE `users` SET `hp`= 1,`hospital` ='".$hosptime."' ,`money` = '".$newmoney."', `hospreason` = '".$hosplost."' WHERE `userid`='".$user_class['userid']."'"); $atklog=mysql_escape_string($_SESSION['attacklog']); $db->query("INSERT INTO attacklogs VALUES('',".$attack_person['userid'].",".$user_class['userid'].",'won',unix_timestamp(),".$moneywon.",'$atklog');"); $final = $attack_person2 . " beat you and stole $".$moneywon." from you."; $pwnd =""; $warq=$db->query("SELECT * FROM gangwars WHERE (warDECLARER={$user_class['gang']} AND warDECLARED={$attack_person['gang']}) OR (warDECLARED={$user_class['gang']} AND warDECLARER={$attack_person['gang']})"); if ($db->num_rows($warq) > 0) { $war=$db->fetch_row($warq); $db->query("UPDATE gangs SET gangRESPECT=gangRESPECT+1 WHERE gangID={$attack_person['gang']}"); $db->query("UPDATE gangs SET gangRESPECT=gangRESPECT-1 WHERE gangID={$user_class['gang']}"); $pwnd =" You lost 1 respect for your gang!"; } } } echo "$final"; echo "$pwnd "; echo "$finalbot"; $h->endpage(); ?></div></center> -
Males only attack females and vice versa?
legrolls replied to legrolls's topic in General Discussion
Re: Males only attack females and vice versa? I see...*strokes invisible beard* If it was gender, just replace the race with gender? -
How would I be able to do this? It's pretty important for my game, which Humans have to fight Aliens. Basically, instead of Male and Female, there are just Human and Alien. I need to make sure Humans don't fight other Humans and Aliens don't fight other Aliens.
-
How would I do it so you wouldn't have to log in to view the highscores or forum? You couldn't post in the forum due to you not being able to be logged in, but if you logged in, you could post again. And the highscores, which I'm sure are much easier...how would I make it so you don't have to log in to view them. Obviously, every time you would try to link it, the globals.php redirects you to the login page, so how would I make it still post them?
-
Re: Something other than male/female? FINISHED. THANK'S EVERYONE! (It was none of your suggestions, though...thanks anyway!)
-
Re: Something other than male/female? When I put it in globals.php, it gave me an error. Here is the globals.php <?php /*--------------------------------- -- MCCodes 2.0 -- By Dabomstew ---------------------------------*/ session_start(); ob_start(); if(get_magic_quotes_gpc() == 0) { foreach($_POST as $k => $v) { $_POST[$k]=addslashes($v); } foreach($_GET as $k => $v) { $_GET[$k]=addslashes($v); } } require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; include "config.php"; global $_CONFIG; define("MONO_ON", 1); require "class/class_db_{$_CONFIG['driver']}.php"; $db=new database; $db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']); $db->connect(); $c=$db->connection_id; $set=array(); $settq=$db->query("SELECT * FROM settings"); while($r=$db->fetch_row($settq)) { $set[$r['conf_name']]=$r['conf_value']; } $domain=$_SERVER['HTTP_HOST']; global $jobquery, $housequery; if($jobquery) { $is=$db->query("SELECT u.*,us.*,j.*,jr.* FROM 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 jr.jrID=u.jobrank WHERE u.userid=$userid"); } else if($housequery) { $is=$db->query("SELECT u.*,us.*,h.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN houses h ON h.hWILL=u.maxwill WHERE u.userid=$userid"); } else { $is=$db->query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid"); } $ir=$db->fetch_row($is); if($ir['force_logout']) { $db->query("UPDATE users SET force_logout=0 WHERE userid=$userid"); session_unset(); session_destroy(); header("Location: login.php"); exit; } global $macropage; if($macropage && !$ir['verified'] && $set['validate_on']==1) { header("Location: macro1.php?refer=$macropage"); exit; } check_level(); $h = new headers; $h->startheaders(); $fm=money_formatter($ir['money']); $cm=money_formatter($ir['crystals'],''); $lv=date('F j, Y, g:i a',$ir['laston']); global $atkpage; if($atkpage) { $h->userdata($ir,$lv,$fm,$cm,0); } else { $h->userdata($ir,$lv,$fm,$cm); } global $menuhide; if(!$menuhide) { $h->menuarea(); } ?>