Jump to content

Leveecius

Members
  • Posts

    94
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Leveecius's Achievements

Member

Member (2/5)

0

Reputation

  1. Hey guys, I've been trying to add something new to my game, but can't quite seem to figure out why it's not working. Here is my code (sorry if it's kinda sloppy): if ($family == '0'){ if ($_POST['Create']){ $familyname=strip_tags($_POST['familyname']); $size=strip_tags($_POST['size']); if($cnt>10){ die("No more family spaces available!"); } $blahhh = mysql_query("SELECT * FROM `family` WHERE name = '$familyname'"); if($familyname = '$blahhh') { die('There is already a family with this name'); } if (!$familyname){ echo "You need to enter a name for your family."; }elseif ($familyname){ if ($family != '0'){ echo "You are already in a family."; }elseif ($family == '0'){ if ($size == 3){ $price = 2500000; $users = 10; }elseif ($size == 2){ $price = 10000000; $users = 25; }elseif ($size == 3){ $price = 20000000; $users = 100; }elseif ($size == 4){ $price = 30000000; $users = 150; } Now, the problem I keep running into is that it keeps telling me there is already a family with that name, however, there are no families in my game, NOR are there even any in my database. Any ideas?
  2. Leveecius

    Odd

    Hey guys, I'm editing my game right now trying to make it so that when you want to search for someone on the game, it limits the amount of people you can search for. It's not working, and wasn't sure if you might be able to tell me why.. if (strip_tags($_POST['hunt_button']) && strip_tags($_POST['hunt_username'])){ $hunt_item=strip_tags($_POST['hunt_item']); $hunt_username=strip_tags($_POST['hunt_username']); $huntlevel = mysql_query("SELECT userlevel FROM users WHERE username='$hunt_username'"); if ($huntlevel >="3"){ print "You cannot search for staff!";} $sql2="SELECT * from search WHERE username='$username'"; $result2=mysql_query($sql2); $num_true2=mysql_num_rows($result2); if ($num_true2 >= 6){ echo "You can not have more than 6 searches out, This is to stop Mass-Killings!";} This code gives me an error - Unexpected T_string in line 148, to which has NOTHING to do with this code. Here is the section which includes line 148. ///////// Tramp ///////// if (($killer_rank == "Tramp")&&($usrrank == "Tramp")){$add = "7000"; } if (($killer_rank == "Tramp")&&($usrrank == "Thief")){$add = "8500"; } if (($killer_rank == "Tramp")&&($usrrank == "Hooligan")){$add = "17000"; } if (($killer_rank == "Tramp")&&($usrrank == "Criminal")){$add = "19500"; } if (($killer_rank == "Tramp")&&($usrrank == "Gangster")){$add Users="24000"; } if (($killer_rank == "Tramp")&&($usrrank == "Boss")){$add ="31500"; } if (($killer_rank == "Tramp")&&($usrrank == "Supreme Boss")){$add = "45000"; } if (($killer_rank == "Tramp")&&($usrrank == "Don")){$add = "60000"; } if (($killer_rank == "Tramp")&&($usrrank == "Legendary Don")){$add = "82000"; } if (($killer_rank == "Tramp")&&($usrrank == "Godfather")){$add = "100000"; } That is lines 142-148. however if I remove my if with the 6 searches only, this error goes away :?
  3. That worked! Thanks man! I'll continue testing it to see if it works fully.
  4. How would I go about doing that? That has always worked for me in the past. :S The id value is automatically incremented in my db so I don't need to add a value. I have since then removed it.
  5. :-\ Ok now I'm getting an unexpected $end in line 333, to which I know means there is something not ended right, but I can't see it. Here is the full rank function to my game. See if there is something you can see that I can't. function rankcheck(){ $username=$_SESSION['username']; $query=mysql_query("SELECT * FROM users WHERE username='$username' LIMIT 1"); $info = mysql_fetch_object($query); $date = gmdate('Y-m-d h:i:s'); if ($info->rank == "High School Punk" && $info->rankpoints >= "400"){ $newrank="School Bully"; $done="1"; } elseif ($info->rank == "School Bully" && $info->rankpoints >= "12300"){ $newrank="Package Boy"; $done="1"; } elseif ($info->rank == "Package Boy" && $info->rankpoints >= "2000"){ $newrank="Street Runner"; $done="1"; } elseif ($info->rank == "Street Runner" && $info->rankpoints >= "4320"){ $newrank="Soldier"; $done="1"; } elseif ($info->rank == "Soldier" && $info->rankpoints >= "6258"){ $newrank="Criminal"; $done="1"; } elseif ($info->rank == "Criminal" && $info->rankpoints >= "9600"){ $newrank="Apprentice"; $done="1"; } elseif ($info->rank == "Apprentice" && $info->rankpoints >= "15073"){ $newrank="Collector"; $done="1"; } elseif ($info->rank == "Collector" && $info->rankpoints >= "22512"){ $newrank="Assassin"; $done="1"; } elseif ($info->rank == "Assassin" && $info->rankpoints >= "34005"){ $newrank="Known Assassin"; $done="1"; } elseif ($info->rank == "Known Assassin" && $info->rankpoints >= "65511"){ $newrank="Racket Boss"; $done="1"; } elseif ($info->rank == "Racket Boss" && $info->rankpoints >= "80106"){ $newrank="Advisor"; $done="1"; } elseif ($info->rank == "Advisor" && $info->rankpoints >= "110020"){ $newrank="Trusted Advisor"; $done="1"; } elseif ($info->rank == "Trusted Advisor" && $info->rankpoints >= "140109"){ $newrank="Respected Criminal"; $done="1"; } elseif ($info->rank == "Respected Criminal" && $info->rankpoints >= "180000"){ $newrank="Mobster"; $done="1"; } elseif ($info->rank == "Mobster" && $info->rankpoints >= "240133"){ $newrank="Feared Mobster"; $done="1"; } elseif ($info->rank == "Feared Mobster" && $info->rankpoints >= "300602"){ $newrank="Regional Leader"; $done="1"; } elseif ($info->rank == "Regional Leader" && $info->rankpoints >= "500000"){ $newrank="Consligere"; $done="1"; } elseif ($info->rank == "Consligere" && $info->rankpoints >= "750000"){ $newrank="Godfather"; $done="1"; } elseif ($info->rank == "Godfather" && $info->rankpoints >= "1250000"){ $newrank="Feared Godfather"; $done="1"; } elseif ($info->rank == "Feared Godfather" && $info->rankpoints >= "1500000"){ $newrank="Don"; $done="1"; } elseif ($info->rank == "Don" && $info->rankpoints >= "2000000"){ $newrank="Respected Don"; $done="1"; } elseif ($info->rank == "Respected Don" && $info->rankpoints >= "2250000"){ $newrank="Underboss"; $done="1"; } elseif ($info->rank == "Underboss" && $info->rankpoints >= "2500000"){ $newrank="Boss"; $done="1"; } elseif ($info->rank == "Boss" && $info->rankpoints >= "3000000"){ $newrank="Regional Head"; $done="1"; } elseif ($info->rank == "Regional Head" && $info->rankpoints >= "3500000"){ $newrank="International Head"; $done="1"; } elseif ($info->rank == "International Head" && $info->rankpoints >= "4000000"){ $newrank="Right Hand Man"; $done="1"; } elseif ($info->rank == "Right Hand Man" && $info->rankpoints >= "5000000"){ $newrank="Family Head"; $done="1"; } elseif ($info->rank == "Family Head" && $info->rankpoints >= "7500000"){ $newrank="Syndicate Underboss"; $done="1"; } elseif ($info->rank == "Syndicate Underboss" && $info->rankpoints >= "10000000"){ $newrank="[b]Syndicate Boss[/b]"; $done="0"; } if (!$done){ $done="0"; } if ($done == "1"){ $crewchk = mysql_query("SELECT crew FROM users WHERE username='$username'"); $crewboss = mysql_query("SELECT owner FROM crews WHERE owner='$owner'"); mysql_query("INSERT INTO `inbox` ( `id` , `to` , `from` , `message` , `date` , `read` , `saved` , `event_id` ) VALUES ( '', '$crewboss', '$username', 'You have a member ready to be promoted to $newrank! Let him rank?', '$date', '0', '0', '0' )"); } if ($crewchk == "0"){ mysql_query("UPDATE users SET rank='$newrank' WHERE username='$username'"); mysql_query("INSERT INTO `inbox` ( `id` , `to` , `from` , `message` , `date` , `read` , `saved` , `event_id` ) VALUES ( '', '$username', '$username', 'You have been promoted to $newrank your doing well!', '$date', '0', '0', '0' )"); } rankcheck();
  6. I have a quick question about a query I'm trying to figure out. I'm trying to do something in my game that i can't seem to get down. What I am trying to do is make it so that when a person in my game makes enough rankpoints to advance it does one of 2 different things. The first thing it does is it checks to see if you are in a crew. If you are in a crew it sends a message to your crew staff and informs them that you are ready to be ranked (basically getting rid of automatic ranking). so I know I use the if and else command, but here is what I have and it's not working. it keeps telling me I have been promoted and it's not checking for my crew. Can you check to see if there is a problem with my coding? Here is the coding if (!$done){ $done="0"; } if ($done == "1"){ $crewchk = mysql_query("SELECT crew FROM users WHERE username='$username'"); $crewboss = mysql_query("SELECT owner FROM crews WHERE owner='$owner'"); mysql_query("INSERT INTO `inbox` ( `id` , `to` , `from` , `message` , `date` , `read` , `saved` , `event_id` ) VALUES ( '', '$crewboss', '$username', 'You have a member ready to be promoted to $newrank! Let him rank?', '$date', '0', '0', '0' )"); }elseif ($crewchk == "0"); mysql_query("UPDATE users SET rank='$newrank' WHERE username='$username'"); mysql_query("INSERT INTO `inbox` ( `id` , `to` , `from` , `message` , `date` , `read` , `saved` , `event_id` ) VALUES ( '', '$username', '$username', 'You have been promoted to $newrank your doing well!', '$date', '0', '0', '0' )"); }[code]
  7. got it now. family was supposed to be famname. thanks for the help guys!
  8. ok, updated and got this: SELECT * from users WHERE family='Da Corleone\'s' Unknown column 'family' in 'where clause'
  9. ok, I was looking at it a little more careful now and got this. I hanged the coding around a little and renamed the family, and got this: SELECT * from users WHERE famname=DaCorleones Unknown column 'DaCorleones' in 'where clause'
  10. ok, I think I know what you were saying, I changed it to not have the quotes around $famname2 and got this: SELECT * from users WHERE family=Da Corleones You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Corleones' at line 1
  11. this makes no sense: SELECT * from users WHERE family='Da Corleone's' You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's'' at line 1
  12. Hey guys, I am getting 2 of the same errors on lines 205 and 216 Here is the error I'm getting: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/klrbal/public_html/Mafia-test/families.php on line 205 Here is the code: <? session_start(); if (!(isset($_SESSION["real_name"]))) { //echo "I'm not logged in"; header('Location: index.php'); } else { echo ""; } ?> <html> <head> <title>Mafia Syndicate BETA .::. Families</title></head> <link REL="stylesheet" TYPE="text/css" HREF="main.css"> <script language=javascript src=Menus.js></script> <body background="wallpaper.jpg"> <center> <table border="0" cellspacing="0" cellpadding="0" align="center" width="95%" class="cat"> <TR> <TD width="150" background="tdbg3.jpg" bgcolor="#222222" valign="top"> <?php include("leftmenu.php");?> </TD> <td width="100%" valign="top"> <br> <?php $fetch=mysql_fetch_object(mysql_query("SELECT * FROM family WHERE name='$name' LIMIT 1")); echo "$name"; ////CREATE Family///// if ($_POST['createfamily'] && $_POST['familyname']){ $familyname == $_POST['familyname']; if ($rankpoints <= 2250000){ echo "You must be an Underboss before you can make a family!"; }else{ if ($famlevel==0){ $finalcash = $cash - 10000000000000 ; if ($finalcash <0){ echo "You do not have enough cash!"; }elseif ($finalcash >=0){ $num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE id >1")); if ($num_true >= 6){ echo "There are already 6 Family Slots!"; }else{ $num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE name='$name'")); if ($num_true >= 1){ echo "There is already a family with that name!"; }else{ function change($msg){ $post = $msg; $post = str_replace("'", "`", $post); return $post; } $new=change($familyname); mysql_query("INSERT INTO `family` ( `id` , `owner` , `name` , `bank` , `quote` , `news` , `slot` ) VALUES ('', '$username', '$new', '0', 'No Quote!', 'You have no family news8)', '10')"); mysql_query("UPDATE users SET famlevel='9' WHERE username='$username'"); mysql_query("UPDATE users SET cash='$finalcash', family='$new' WHERE username='$username'"); mysql_query("INSERT INTO `logs` ( `id` , `who` , `action` , `date` , `ip`) VALUES ('', '$username', 'Formed a family named <b>$new</b>!', '$date', '$realip')"); echo "You have created the Family <b>$new!</b>"; } } } } } } if ($_POST['cancelapply']){ mysql_query("DELETE FROM familyreq WHERE username='$username'"); echo "You have cancelled your application!"; } if ($_POST['leave'] && $famlevel >=2 && $famlevel <7){ if ($famlevel <= 0) { echo "You are not in a Family!"; }else{ if ($famlevel >= 4) { echo "You can not leave your Family!"; }else{ $healthloose=rand(85,95); if ($health - $healthloose <=0){ mysql_query("UPDATE users SET family='None', famlevel='0', `health`='1' WHERE username='$username'"); }else{ mysql_query("UPDATE users SET family='None', famlevel='0', `health`=`health`-'$healthloose' WHERE username='$username'"); echo "You left your family and lost $health% health!"; }}}} if ($_POST['change'] && strip_tags($_POST['newfamname']) && strip_tags($_POST['famid']) && $userlevel >=2){ $newfamname = $_POST['newfamname']; $newfamname = strip_tags($newfamname); $famid = $_POST['famid']; $famid = strip_tags($famid); $sql="SELECT * from families WHERE id='$famid'"; $result=mysql_query($sql); while($rows=mysql_fetch_array($result)){ // Start looping table row $oname = $rows['name']; } $num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE name='$newfamname'")); if ($num_true >= 1){ echo "There is already a Family with that name!"; }else{ function change($msg) { $post = $msg; $post = str_replace("'", "`", $post); return $post; } $newfamname=change($newfamname); mysql_query("UPDATE users SET family='$newfamname' WHERE family='$oname'"); mysql_query("UPDATE familyreq SET famid='$newfamname' WHERE family='$oname'"); mysql_query("UPDATE forum_answer SET place='$newfamname' WHERE place='$oname'"); mysql_query("UPDATE forum_question SET place='$newfamname' WHERE place='$oname'"); mysql_query("UPDATE family_donations SET family='$newfamname' WHERE family='$oname'"); mysql_query("UPDATE family SET name='$newfamname' WHERE id='$crewid'"); mysql_query("UPDATE BG SET family='$newfamname' WHERE family='$oname'"); echo "You changed the family $oname to $newfamname!"; }} ?> <table border="1" class="sub2" align="center" cellspacing="0" cellpadding="1" bordercolor=black width=81%> <tr> <td align="center" colspan="5" class="header">Families</td> </tr> <? include "includes/db_connect.php"; $sql="SELECT * FROM family ORDER by id ASC"; $result=mysql_query($sql); while($rows=mysql_fetch_array($result)){ // Start looping table row $name=$rows['owner']; $famname=$rows['id']; $famname2=$rows['name']; $sql2="SELECT * from users WHERE family='$famname2'"; $result2=mysql_query($sql2); $num=mysql_num_rows($result2); ?> <tr> <td width="70%"><a href="viewfamprofile.php?viewfamily=<? echo $famname ?>"><? echo $rows['name']; ?></a></td><td width="20%"><a href="viewprofile.php?viewuser=<? echo $name ?>"><? echo $rows['owner']; ?></a></td><td width="10%"><? echo "$num"; ?></td> </tr> <? } ?> <tr> <td colspan="5" align="right"><? $num_true=mysql_num_rows(mysql_query("SELECT * FROM families WHERE id >1")); echo "$num_true"; ?>/6 Families</td> </tr> </table> <br> <br> <? if ($famlevel == 0) { ?> <form method="post" action="families.php"> <table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2"> <tr> <td class="header" colspan="2" align="center">Create Family </td> </tr> <tr> <td> <p><font color="blue"><b>Making a Family will Cost $10,000,000,000,000. You must be ranked Underboss + to make a Family.</b></font></p></td> </tr> <tr> <td width="92%" bgcolor="#3c3025" border="0"> <center> Family Name:<br> <input type="text" style="border:1px solid black;" name="familyname"> <br><br> <input type="submit" value="Create Family" name="createfamily"></center> </td> </tr> <? $num_true=mysql_num_rows(mysql_query("SELECT * FROM familyreq WHERE username='$username'")); if ($num_true == 1){ ?> <tr> <td class="header" colspan="2" align="center">Pending Application</td> </tr> <? include "includes/db_connect.php"; $sql="SELECT * FROM crewapply WHERE username='$username'"; $result=mysql_query($sql); while($rows=mysql_fetch_array($result)){ // Start looping table row ?> <tr> <td colspan="2" align="center"> You have applied to <b><? echo $rows['family']; ?></b><br><br> <input type="submit" value="Cancel Application" name="cancelapply"></td> </tr> <? }} ?> </table></form> <? } ?> <br> <table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2"> <tr> <td class="header" colspan="2" align="center">Leave Family</td> </tr> <tr> <td colspan="2" align="center"><font color="red"><b>Note: Leaving Family can result in you losing 85-95% health</b></font> <br> <br> <input type="submit" value="Leave Family" name="leave"> </td> </tr> <? if ($famlevel >=7 && $fetch->slot <200){ ?> <tr> <td class="header" colspan="2" align="center">Upgrade Family Size</td> </tr> <tr> <td align="center"> <? if ($fetch->slot ==100){$next=250; $upgradecost=10000000000;} elseif ($fetch->slot ==250){$next=500; $upgradecost=15000000000;} elseif ($fetch->slot ==500){$next=1000; $upgradecost=20000000000;} elseif ($fetch->slot ==1000){$next=2000; $upgradecost=30000000000;} ?> Your family's current size is <b><? echo $fetch->slot ; ?></b>, it will cost $<? echo number_format($upgradecost); ?> to upgrade it to <? echo $next ;?>.<br> <input type="submit" name="upgrade" value="Upgrade"> </td> </tr> <? } ?> </form> <? if ($userlevel >= 5) { ?> <form method="post" action=""> <table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2"> <tr> <td class="header" colspan="2" align="center">Change Family Name</td> </tr> <tr> <td width="90%" align="center">Family ID:<br><input style="border:1px solid black;" type="text" name="famid"><br></td> </tr> <tr> <td align="center">New Family Name:<br><input type="text" style="border:1px solid black;" name="newfamname"><br><br> <input type="submit" value="Change" name="change"> </td> </tr> </table> </form> <br><br> <? } ?> <? if ($userlevel >= 15) { ?> <form method="post" action=""> <table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2"> <tr> <td class="header" colspan="2" align="center">Drop Family</td> </tr> <tr> <td width="90%" align="center"><br> <center><select name="famnamedrop"> <? include "includes/db_connect.php"; $sql="SELECT * FROM family ORDER by id"; $result=mysql_query($sql); while($rows=mysql_fetch_array($result)){ // Start looping table row ?> <option><? echo $rows['name']; ?></option> <? } ?> </select> <br><br> <input type="submit" value="Drop Family" name="dropfamily"></center> </td> </tr> </table> </form> <? } ?> <br><br> </td> <TD width="150" valign="top"> <?php include("rightmenu.php");?> </TD> </TR> </table> </center> </body> </html>
  13. Well here is the scripting I have for it right now, it doesn't really work. It just displays the echo, but doesn't do anything else. <?php mysql_query("SELECT * FROM users WHERE username='$username'"); $purchase = ($cash-10000); $heal = ($health+1); if ($_POST['amount']){ $amount = ($_POST['amount']); $healing = ($heal*$amount); $cashloss = ($purchase*$amount); mysql_query("UPDATE users WHERE health='$healing', cash='$cashloss'");} ?>
  14. I haven't added it yet. I'm trying to make it so that in the hospital in my game, they have the option of buying health rather than stay in the hospital for anytime.
  15. Anyone?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.