
gurpreet
Members-
Posts
834 -
Joined
-
Last visited
-
Days Won
1
Content Type
Profiles
Forums
Events
Everything posted by gurpreet
-
Richards Business Mod--Fixed With a few Things added.
gurpreet replied to Joshua's topic in Free Modifications
Wouldn't • work? -
It checks if the user is on the hitlist. If they are then it should award the attacker the bounty (queries haven't been added yet, i wanted to check if this message appeared)
-
Oh ok, one last thing I can't get working is the attack bit. I'm using this but nothing comes up when I attack a person on the hitlist: $bounties = mysql_query("SELECT hl.*,u.userid,u.username FROM `hitlist` hl LEFT JOIN `users` u ON (u.userid = hl.hitADDED) WHERE u.userid={$r['userid']}", $c); while($bounty = mysql_fetch_object($bounties)) { if($bounty->hitADDED == $r['userid']) { echo "You have successfully killed {$r['username']}! Because they were on the hitlist, you have earned \${$bounty->hitBOUNTY}."; } } I've put that in all of my attack pages but it doesn't come up.
-
Then add that in your query at the top of your viewuser and then just add a line for it. For example if its 'married' in the users table add married into the query at the top and then $r['married']
-
There were a few errors to do with the fetch_object syntax ($row->field) but I found those quickly and it works perfectly. Once again many thanks SRB, just wondering is fetch_object better than fetch_array or is a personal preference?
-
What do you mean? I can't because I have to add the checks in the addhit function? This is how I've done it, and I've commented the erroneous parts <?php include "globals.php"; switch($_GET['action']) { case "addhit": addhit(); break; default: index(); break; } function index() { global $db,$ir,$c,$userid,$h; print " <a href='hitlist.php?action=addhit'><h3>Add a Hit!</h3></a><br> Hits that are up:<br> <table width='80%%' cellspacing='2' cellpadding='2' class='table' border='1'> <th>User</th> <th>Bounty</th> <th>Level</th> <th>Attack!</th> </tr> "; $SELECT = mysql_query(" SELECT hl.*, u.userid, u.username, u.level FROM hitlist AS hl LEFT JOIN users AS u ON (u.userid = hl.hitADDED) ORDER BY userid ASC" ); while($bounty=mysql_fetch_array($SELECT)) { print " <tr> <td>".finduser($bounty['userid'])." [{$bounty['userid']}]</td> <td>\$".number_format($bounty['hitBOUNTY'])."</td> <td>".number_format($bounty['level'])."</td> <td><a href='attack.php?ID={$bounty['userid']}'>Attack</a></td> </tr>"; } echo "</table>"; } function addhit() { global $db,$ir,$c,$userid,$h; $_POST['user'] = abs(@intval($_POST['user'])); if($_POST['user']) { $sel = mysql_query("SELECT hl.*, u.username, u.level, u.hospital, u.jail, u.userid FROM hitlist AS hl LEFT JOIN users AS u ON ({$_POST['user']} = hl.hitADDED) WHERE userid = {$_POST['user']}"); $row = $db->fetch_row($sel); $costrand = mt_rand(50000,70000); $cost = ($row['level'] * $costrand); if($_POST['user'] == $ir['userid']) { die("Why are you trying to place a hit on yourself?"); } else if($cost > $ir['money']) { die("You do not have enough money to place a hit on {$row['username']}"); } //This else if below is a bit messed up too. It outputs the die message when a user exists else if($db->num_rows($sel)==0) { die("No user exists with this ID!"); } else if($_POST['user'] == $row['hitADDED']) { die("{$row['username']} is already on the hitlist!"); } //The else if below this are the messed up ones else if($row['hospital'] > 0) { die("This user is in the hospital and therefore cannot be placed on the hitlist."); } else if($row['jail'] > 0) { die("This user is in jail so a hit cannot be placed on them."); } $db->query("INSERT INTO hitlist VALUES ('','{$ir['userid']}','{$_POST['user']}','$costrand')"); $db->query("UPDATE users SET money = money - $cost WHERE userid = {$ir['userid']}"); event_add($_POST['user'], "You were placed on the hitlist by ".finduser($ir['userid'])."!"); print "{$row['username']} added to the hitlist! The bounty is \$".number_format($cost)." and has been taken by the hitmen contractors.<br> <a href='hitlist.php'>> Back</a>"; } else { echo " Adding a hit:<br><br><br> <form action='hitlist.php?action=addhit' method='post'> <table width=50% border=2> <tr> <td>User ID:</td> <td><input type='text' name='user' /></td> </tr> <tr> <td colspan='2' align='center'><input type='submit' value='Add to hitlist!'></td> </tr> </table> </form> "; } } ?>
-
How about with old IE? Just in case some people use them like IE 5 or 6
-
Bump. Can anyone help? 2 problems here: 1) Sometimes it says "No user exists with this ID!" even though the user exists 2) I can't seem to add an else if to check if they are in hospital or jail, I just get a blank page. I've tried many different things, but none seem to work. My hitlist table has the following: hitID, hitADDER, hitADDED, hitBOUNTY.
-
I thought that too, but it needed a bit of tweaking.
-
Sounds really good! When I finish redoing my website and get it online I'll definitely submit my game!
-
So what's different with this? A collapsible menu?
-
I've added a few more stuff to this script, but I have a few problems: Sometimes it says No user exists with this ID! even though the user is there? I can't seem to add an else if to check if they are in hospital or jail, I just get a blank page. <?php include "globals.php"; switch($_GET['action']) { case "addhit": addhit(); break; default: index(); break; } function index() { global $db,$ir,$c,$userid,$h; print " <a href='hitlist.php?action=addhit'><h3>Add a Hit!</h3></a><br> Hits that are up:<br> <table width='80%%' cellspacing='2' cellpadding='2' class='table' border='1'> <th>User</th> <th>Bounty</th> <th>Level</th> <th>Attack!</th> </tr> "; $SELECT = mysql_query(" SELECT hl.*, u.userid, u.username, u.level FROM hitlist AS hl LEFT JOIN users AS u ON (u.userid = hl.hitADDED) ORDER BY userid ASC" ); while($bounty=mysql_fetch_array($SELECT)) { print " <tr> <td>".finduser($bounty['userid'])." [{$bounty['userid']}]</td> <td>\$".number_format($bounty['hitBOUNTY'])."</td> <td>".number_format($bounty['level'])."</td> <td><a href='attack.php?ID={$bounty['userid']}'>Attack</a></td> </tr>"; } echo "</table>"; } function addhit() { global $db,$ir,$c,$userid,$h; $_POST['user'] = abs(@intval($_POST['user'])); if($_POST['user']) { $sel = mysql_query("SELECT hl.*, u.username, u.level, u.userid FROM hitlist AS hl LEFT JOIN users AS u ON ({$_POST['user']} = hl.hitADDED) WHERE userid = {$_POST['user']}"); $row = $db->fetch_row($sel); $costrand = mt_rand(50000,70000); $cost = ($row['level'] * $costrand); if($_POST['user'] == $ir['userid']) { die("Why are you trying to place a hit on yourself?"); } else if($cost > $ir['money']) { die("You do not have enough money to place a hit on {$row['username']}"); } else if($db->num_rows($sel)==0) { die("No user exists with this ID!"); } else if($_POST['user'] == $row['hitADDED']) { die("{$row['username']} is already on the hitlist!"); } $db->query("INSERT INTO hitlist VALUES ('','{$ir['userid']}','{$_POST['user']}','$costrand')"); $db->query("UPDATE users SET money = money - $cost WHERE userid = {$ir['userid']}"); event_add($_POST['user'], "You were placed on the hitlist by ".finduser($ir['userid'])."!"); print "{$row['username']} added to the hitlist! The bounty is \$".number_format($cost)." and has been taken by the hitmen contractors.<br> <a href='hitlist.php'>> Back</a>"; } else { echo " Adding a hit:<br><br><br> <form action='hitlist.php?action=addhit' method='post'> <table width=50% border=2> <tr> <td>User ID:</td> <td><input type='text' name='user' /></td> </tr> <tr> <td colspan='2' align='center'><input type='submit' value='Add to hitlist!'></td> </tr> </table> </form> "; } } ?> Can anyone see anything wrong with this? The problems are all in the addhit() function
-
That's very nice! I used to love playing games like these, and they used to have thousands of active players daily. Keep it up!
-
I recently came across a website called codecademy, which is really good if you want to learn the basics of JS! It's basically an interactive way of learning JS as it gives you exercises to do, and you can earn points and such as you go through them. The only downside is that you can complete these very quickly, and I was wondering if anyone has come across similar sites, but for free. I've looked around and only found similar ones for a few hundred per language. If anyone has any comments or any other good sites please post them :)
-
Thanks all fixed now.
-
I'm trying to create a hitlist, but when I'm adding a hit I can add anyone to the hitlist, even if they dont exist.. Plus there's a few small bugs I can't figure out like when I try to change the userid into the username. I can't see anything wrong in the script but recently I've been missing lots of small stuff. Could anyone help me fix it? Also if I'm using any bad practices, could you tell me so I can use the better way. Thanks <?php include "globals.php"; switch($_GET['action']) { case "addhit": addhit(); break; default: index(); break; } function index() { global $db,$ir,$c,$userid,$h; print " <a href='hitlist.php?action=addhit'><h3>Add a Hit!</h3></a><br> Hits that are up:<br> <table width='100%' cellspacing='2' cellpadding='2' class='table' border='1'> <th>User</th> <th>Bounty</th> <th>Level</th> <th>Attack!</th> </tr> "; $SELECT = (" SELECT hl.*, u.userid, u.username, u.level FROM hitlist AS hl LEFT JOIN users AS u ON (u.userid = hl.hitADDED) ORDER BY userid ASC" ); $q = $db->query($SELECT); while($r=$db->fetch_row($q)) { print " <tr> <td>".finduser($r['userid'])."</td> <td>".number_format($r['hitBOUNTY'])."</td> <td>".number_format($r['level'])."</td> </tr> </table>"; } } function addhit() { global $db,$ir,$c,$userid,$h; $_POST['user'] = abs(@intval($_POST['user'])); if($_POST['user']) { $sel = $db->query("SELECT username, level, userid FROM users WHERE userid = {$_POST['user']}"); $row = $db->fetch_row($sel); $cost = "{$row['level']} * 50000"; if($cost > $ir['money']) { die("You do not have enough money to place a hit on {$_POST['user']}"); } else if(!$_POST['user']) { die("No user exists with this ID!"); } $db->query("INSERT INTO hitlist VALUES ('','{$ir['userid']}','{$_POST['user']}','$cost')"); $db->query("ALTER TABLE users SET money = money - $cost WHERE userid = {$ir['userid']}"); print "{$_POST['user']} added to the hitlist!<br> <a href='hitlist.php'>> Back</a>"; } else { echo " Adding a hit:<br><br><br> <form action='hitlist.php?action=addhit' method='post'> <table width=50% border=2> <tr> <td>User ID:</td> <td><input type='text' name='user' /></td> </tr> <tr> <td colspan='2' align='center'><input type='submit' value='Add to hitlist!'></td> </tr> </table> </form> "; } } ?>
-
Need help with fixes / bugs on my game site. Will pay
gurpreet replied to Hendrickson's topic in Requests & In Production
Try using MagicTallGuy's forum mod, it's perfect and I think the gang presidents and vice can make topics in their own part. -
What's different in this mod compared to the normal cyber bank? Different amounts of interest?
-
It means that another page has already got session_start(); in it. For example say your globals has it and you have this in a page: <?php include "globals.php"; session_start(); blah blah That will try to send out 2 session starts because 1 is in your globals.
-
So out of all that, which part gives the error? Put it in code tags aswell so it's much easier to read
-
Suggestion mod that was here earlier
gurpreet replied to gurpreet's topic in Requests & In Production
I thought it was that too, but even if I had those I don't have the second half of the script. Thanks for your post though -
I have half of the script for some reason of a suggestion mod that was posted here previously. However, I don't have the SQLs or the other half of the script (not sure why), so if anyone has it could they please post it? Here's what I got: <?php require "globals.php"; $sd=mysql_query("SELECT * FROM `suggestion` WHERE `s_from` = '$userid'",$c); if($_GET['x'] == "add" and mysql_num_rows($sd) < 7) { if($_POST['urgency'] and $_POST['description']) { //Secure the webpage. My favourite :> $_POST['description']=str_replace("/n", "<br />", strip_tags($_POST['description'])); $time=time(); //Insert the time log. $ip=$_SERVER['REMOTE_ADDR']; //The users IP - logged. ha ha! $nf="Not Added"; //The text for startup mysql_query("INSERT INTO `suggestion` (`s_id`, `s_posted`, `s_from`, `s_description`, `s_read`, `s_replyfrom`, `s_reply_one`, `s_replytext`, `s_urgency`, `s_iplogged`) VALUES ('NULL', '$time', '$userid', '$_POST[description]', '0', '0', '$nf', 'N/A', '$_POST[urgency]', '$ip');",$c) or die("Your suggestion couldn't be processed at the moment, Either contact a admin or wait until tommorrow.<br />Thanks and sorry for any inconvenience caused<br /><a href='suggestion.php'>Back</a><br />"); print "Your suggestion has initially been added!<br /> <a href='suggestion.php'>Back</a><br />"; $h->endpage(); exit(); } else { print "<b>Submit your suggestion</b><br /> <font color=red>Your IP logged: ".$_SERVER['REMOTE_ADDR']."</font><br /> <BR /> Your IP is logged for our benefits and yours, To make sure that you are posting a safe and clean spaced suggestion!<br /> Once suggestion has been prosesed, your suggestion will be shown as hidden to any other player except you.<br /> <br /> NOTE: This is only to report suggestions, If it's related to players open a player dispute. suggestions are adicions to the game that you feel it needs<br /> <form action='suggestion.php?x=add' method='post'> Urgency: <select name='urgency'><option value='Brief'>Brief</option> <option value='Basic'>Basic</option><option value='Vital'>Vital</option></select><br /> Description (include as much detail as possible, links will be a help aswell): <textarea name='description' cols=40 rows=11></textarea><br /> <input type=submit value='Submit Suggestion'></form><br />"; $h->endpage(); exit(); } } else if($ir['user_level'] > 1 and $_GET['x'] == "remove" and $_GET['report']) { mysql_query("DELETE FROM `suggestion` WHERE `s_id` = '$_GET[suggestion]'",$c); print "Suggestion Row Removed<br /> <a href='suggestion.php'>Back</a><br />"; $h->endpage(); exit(); } elseif($ir['user_level'] > 1 and $_GET['x'] == "reply" and $_GET['suggestion']) { if($_POST['text']) { //Make sure the text is ready to go, clean and safe. $text=str_replace(array("<",">","/n"),array("","",""),$_POST['text']); mysql_query("UPDATE `suggestion` SET `s_replyfrom` = '$userid', `s_replytext` = '$text' WHERE `s_id` = '$_GET[suggestion]'",$c); print "Suggestion Row Edited<br /> <a href='suggestion.php'>Back</a><br />"; $h->endpage(); exit(); } else { print "<b>Make a reply</b><br /> <form action='suggestion.php?x=reply&report=$_GET[suggestion]' method='post'> Reply: <textarea name='text' cols=40 rows=11>Your reply here...</textarea><br /> <input type=submit value='Submit Reply!'> </form>"; $h->endpage(); exit(); } } $_GET['st'] = abs((int) $_GET['st']); $st=($_GET['st']) ? $_GET['st'] : 0; print "<center><h3>Suggestions</h3>"; $sd=mysql_query("SELECT * FROM `suggestion` WHERE `s_from` = '$userid'",$c); if(mysql_num_rows($sd) < 7) { print "<a href='suggestion.php?x=add'>[Add A Suggestion]</a><br />"; } print "<b>You can record suggestion</b><br />"; if(!$_GET['selectSug']) { $reports=mysql_num_rows(mysql_query("SELECT * FROM `suggestion`",$c)); $shown=10; //How many rows should be shown in one row $pages=(int) ($suggestions/$shown)+1; if($membs % $shown == 1) { $pages--; } print "Pages: "; for($i=1;$i <= $pages;$i++) { $stl=($i-1)*$shown; print "<a href='suggestion.php?st=$stl'>$i</a> "; } } if($ir["user_level"] > 1) { $man="<th>Manage</th>"; $cols=8; mysql_query("UPDATE `suggestion` SET `s_read` = '1' WHERE `s_read` = '0'",$c); } else { $cols=7; } print "<br /><table width=90% border=1><tr><th colspan={$cols}>Viewing all suggestions - </th></tr> <tr><th>Suggestion ID</th><th>From</th><th>Urgency</th><th>Status</th><th>Reply Comments</th><th>Description</th><th>Read</th>".$man."</tr>"; if(!$_GET['selectBug']) { $q=mysql_query("SELECT * FROM `suggestion` ORDER BY `s_posted` DESC LIMIT $st,10",$c); } else { $q=mysql_query("SELECT * FROM `suggestion` WHERE `s_id` = '$_GET[selectSug]' LIMIT 1;",$c); } if(mysql_num_rows($q) == 0) { print "<tr><td colspan={$cols}>There are no current suggestions been posted.</td></tr>"; } while($r=mysql_fetch_array($q)) { if($r['s_from'] == $userid or $ir['user_level'] >= 2) { $user_q=mysql_query("SELECT * FROM `users` WHERE `userid` = '$r[s_from]'",$c); $p=mysql_fetch_array($user_q); if($r['s_replyfrom'] > 0) { $user_q2=mysql_query("SELECT * FROM `users` WHERE `userid` = '$r[s_from]'",$c); $d=mysql_fetch_array($user_q2); } If anyone can help please do.
-
This may sound stupid, but have you tried $db->query("UPDATE users SET stacct=open WHERE userid=$userid"); or $db->query("UPDATE users SET stacct="open" WHERE userid=$userid"); May not work but its worth a try
-
So basically get the image and any other info using AJAX and then add a mouseover on top of the item name in the inventory page? Would a new page be required for the AJAX or could it be added to the top of the inventory page?
-
I can't get this to work either, I'm calling it like this in inventory: print "<tr><td><a href='inventory.php#' rel='imgtip[0]'>[{$i['itmname']}]</a>"; And here's what I got in the js file: tooltips[0]=["images/$i['image']", "$i['itmname']", {background:"#FFFFFF", color:"black", border:"5px ridge darkblue"}] Am I doing something wrong there? I tried Lithium's method too and that didn't work