...

View Full Version : jail script show users from all



TheLethal
02-04-2007, 02:16 PM
hey basicly on my game theres like 5 different countrys and each has a jail where players go if they get caught. at the moment it only shows the users in jail in the country your in.was wondering how i could doit to show users in jail in all countrys
heres my jail code
link
http://www.brownboyzltd.com/mafia/jail.php

script



<?php
session_start();
include "includes/db_connect.php";
include "includes/functions.php";
logincheck();
$username=$_SESSION['username'];

$find = mysql_query("SELECT * FROM users WHERE username='$username'");
$fetch=mysql_fetch_object($find);

$nums = mysql_num_rows(mysql_query("SELECT * FROM jail WHERE username='$username'"));



$bust = strip_tags($_GET['bust']);
if($bust) {

if ($nums == "0"){
$info_jail=mysql_fetch_object(mysql_query("SELECT * FROM jail WHERE id='$bust'"));

if ($info_jail->bust_able == "1"){
echo "This user is unbreakable.";
}elseif ($info_jail->bust_able == "0"){
$rand = rand(1,100) + $fetch->jail_points;
if ($rand < "45"){
$reason = "Jail busting";
require_once"includes/failed.php";
}

if ($rand > "65"){

mysql_query("INSERT INTO `inbox` ( `id` , `to` , `from` , `message` , `date` , `read` , `saved` , `event_id` )
VALUES (
'', '$info_jail->username', '$info_jail->username', '<b>$username</b> busted you out of jail.', '$date', '0', '0', '0'
)");


echo "You busted him/her out.";
$rand1 = rand(6,20) - 5;
$nrank = $fetch->rankpoints + $rand1;
$njail = rand(5,10) + $fetch->jail_points;


mysql_query("UPDATE users SET rankpoints='$nrank', jail_points='$njail' WHERE username='$username'");
mysql_query("UPDATE info SET busts=busts+1 WHERE username='$username'");


mysql_query("DELETE FROM jail WHERE id='$bust'");
echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=jail.php\">";
}
}}
}
if (strip_tags($_GET['mission']) == "do" && $fetch->mission == "3" && $fetch->location == "Mexico"){
$rand=rand(1,100);
$nums1 = mysql_num_rows(mysql_query("SELECT * FROM jail WHERE username='$username'"));
if ($nums1 == "0"){
if ($rand > 95){
echo "You busted him out of jail!";
$new_money=$fetch->money + 1000000;
$new_bullets=$fetch->bullets+5000;
$new_rank=$fetch->rankpoints+rand(5,10);
mysql_query("UPDATE users SET money='$new_money',bullets='$new_bullets', rankpoints='$new_rank', mission='4' WHERE username='$username'");
mysql_query("INSERT INTO `inbox` ( `id` , `to` , `from` , `message` , `date` , `read` , `saved` , `event_id` )
VALUES (
'', '$username', '$username', 'Thanks man..<br> I almost went insane in there!<br><b>Your rewards:</b> 1,000,000 <br>5000 Bullets ', '$date', '0', '0', '0'
)");
}else{
echo "You failed! and was put in jail";
$jail_time=time() + rand(120,400);
mysql_query("INSERT INTO `jail` ( `id` , `username` , `location` , `time_left` , `reason` , `bust_able` )
VALUES (
'', '$username', '$fetch->location', '$jail_time', 'Attempted jail busting', '1'
)");
}
}}

echo "

<table width=90% border=1 align=center cellpadding=2 cellspacing=0 class=thinline bordercolor=black>
<tr>
<td colspan=6 background=includes/grad.jpg><center>Jail</center></td></tr>
<tr bgcolor=#FFFFFF>
<td align=center width=16% class=tip>Name</td>
<td align=center width=16% class=tip>Rank</td>
<td align=center width=16% class=tip>Jailed For</td>
<td align=center width=16% class=tip>Crew</td>
<td align=center width=16% class=tip>Bust Out</td>
<td align=center width=16% class=tip>Seconds Left</td>
</tr>";
$query=mysql_query("SELECT * FROM jail WHERE location='$fetch->location'");

$num=mysql_num_rows($query);
if ($num == "0" && $fetch->mission != "3"){ echo "<TD align=middle colSpan=6><div align=center><B>The
is no one in this jail.</B></div></TD>"; }
if ($fetch->mission == "3" && $fetch->location == "Mexico"){
echo "<tr><td><b>Jhon booti</b></td> <td>Don</td> <td>Organised crime</td> <td>The Mafia</td> <td><a href='http://www.brownboyzltd.com/mafia/jail.php?mission=do'>Bust!</a></td> <td>15 Years</td></tr>";

}
while($inf = mysql_fetch_object($query)){
if ($inf->bust_able == "1"){
$it="*";
}else{
$it="";
}


$per_in = mysql_query("SELECT * FROM users WHERE username='$inf->username'");
$per = mysql_fetch_object($per_in);
$left = $inf->time_left - time();
echo "<tr><td>$it<a href='profile.php?viewuser=$inf->username'>$inf->username</a></td> <td>$per->rank</td> <td>$inf->reason</td> <td>$per->crew</td> <td><a href='http://www.brownboyzltd.com/mafia/jail.php?bust=$inf->id'>Bust!</a></td> <td>$left Seconds</td></tr>";


}
?>






</table> <br>
<table width="39%" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor=black class=thinline>
<tr>
<td background=includes/grad.jpg><div align="center">The Key</div></td>
</tr>
<tr>
<td><div align="center">*Unbreakable</div></td>
</tr>
</table>
<p>
<?php include_once"includes/footer.php"; ?>

koyama
02-04-2007, 02:48 PM
It will be quite difficult to tell without any info about the tables in your database. Which columns denote what? The link you gave is not of much value to us since one is prompted to login.

Looking at your code I suspect you should be looking at this part:


$query=mysql_query("SELECT * FROM jail WHERE location='$fetch->location'");
Is the column 'location' containing country info? If so, probably you should remove the where clause:


$query=mysql_query("SELECT * FROM jail");

TheLethal
02-04-2007, 02:51 PM
yeah the location column shows the countrys that a user is in on the user table

TheLethal
02-04-2007, 02:53 PM
what tables shud i post u/

TheLethal
02-04-2007, 02:54 PM
jail table



CREATE TABLE `jail` (
`id` int(11) NOT NULL auto_increment,
`username` varchar(40) NOT NULL default '',
`location` enum('England','Japan','Colombia','Usa','South Africa','Mexico') NOT NULL default 'England',
`time_left` varchar(100) NOT NULL default '',
`reason` varchar(100) NOT NULL default '',
`bust_able` enum('0','1') NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=382 ;

--
-- Dumping data for table `jail`
--

INSERT INTO `jail` VALUES (381, 'cookie', 'England', '1170600546', 'GTA', '0');



users table


--
-- Table structure for table `users`
--

CREATE TABLE `users` (
`id` int(11) NOT NULL auto_increment,
`username` varchar(40) NOT NULL default '',
`password` varchar(60) NOT NULL default '',
`activated` enum('0','1') NOT NULL default '1',
`money` varchar(100) NOT NULL default '10000',
`online` varchar(100) NOT NULL default '',
`crimechance` varchar(100) NOT NULL default '0-0-0-0-0-0-0',
`lastcrime` varchar(100) NOT NULL default '',
`rankpoints` varchar(100) NOT NULL default '0',
`userlevel` enum('0','1','2','3','4','5','6') NOT NULL default '0',
`lasttop` varchar(100) NOT NULL default '',
`status` enum('Alive','Dead','Banned') NOT NULL default 'Alive',
`regged` datetime NOT NULL default '0000-00-00 00:00:00',
`rank` enum('Scum','Package Boy','Pee Wee','Thug','Crook','Thief','Local Boss','Boss','Respectable Boss','Don','Respectable Don','Legendary Don','Godfather','Godmother','Modarator','Help Desk Oparator','Administrator','Head Administrator') NOT NULL default 'Scum',
`layout` varchar(100) NOT NULL default '17',
`email` varchar(100) NOT NULL default '',
`quote` text NOT NULL,
`gender` enum('Not Sure','Male','Female') NOT NULL default 'Not Sure',
`msnmessenger` text NOT NULL,
`image` varchar(100) NOT NULL default 'images/default.jpg',
`location` enum('England','Japan','Colombia','Usa','South Africa','Mexico','Russia','Italy','Cuba','Madagascar') NOT NULL default 'England',
`bullets` int(11) NOT NULL default '0',
`gtachance` varchar(100) NOT NULL default '0-0-0',
`lastgta` varchar(100) NOT NULL default '',
`lasttravel` varchar(100) NOT NULL default '',
`bank` int(40) NOT NULL default '0',
`banktime` varchar(100) NOT NULL default '',
`last_race` varchar(100) NOT NULL default '',
`fban` enum('0','1') NOT NULL default '0',
`music` mediumtext NOT NULL,
`crew` varchar(60) NOT NULL default '0',
`get_away_time` varchar(100) NOT NULL default '',
`get_away` enum('0','1') NOT NULL default '0',
`health` int(3) NOT NULL default '100',
`energy` int(3) NOT NULL default '100',
`last_ext` varchar(100) NOT NULL default '',
`lasttran` varchar(100) NOT NULL default '',
`drugprices` varchar(100) NOT NULL default '0-0-0-0-0',
`drugs` varchar(100) NOT NULL default '0-0-0-0-0',
`l_ip` varchar(15) NOT NULL default 'Default',
`crew_invite` int(11) NOT NULL default '0',
`referral` int(11) NOT NULL default '0',
`weapon` enum('None','Sig Sauer P229','Jackhammer automatic shotgun','Heckler und Koch MP-5k','FN SCAR','Browning M2HB','Dragunov') NOT NULL default 'None',
`mission` int(11) NOT NULL default '1',
`points` int(11) NOT NULL default '0',
`lpv` varchar(32) NOT NULL default '',
`page` varchar(10) NOT NULL default '',
`editor` enum('0','1') NOT NULL default '0',
`helper` enum('0','1') NOT NULL default '0',
`food_chance` varchar(100) NOT NULL default '0-0-0',
`last_food` varchar(100) NOT NULL default '',
`last_order` varchar(100) NOT NULL default '',
`freinds` varchar(40) NOT NULL default 'None billy no mates',
`protection` enum('None','Doberman','Body Guard','Armoured Car','House','Safehouse','Armoured Limo') NOT NULL default 'None',
`plane` enum('None','Fokker','Boeing 777','LV-AZF','PR-GOC','F-HSUN') NOT NULL default 'None',
`married` varchar(100) NOT NULL default '0',
`oc` enum('0','1') NOT NULL default '0',
`last_oc` varchar(100) NOT NULL default '',
`atm` enum('False','True') NOT NULL default 'False',
`last_bank` varchar(100) NOT NULL default '',
`last_attempted` varchar(100) NOT NULL default '',
`last_kill` varchar(100) NOT NULL default '',
`ver_code` varchar(20) NOT NULL default '456',
`last_script_check` varchar(100) NOT NULL default '',
`global` enum('0','1') NOT NULL default '0',
`poll` varchar(100) NOT NULL default '',
`clicks` int(11) NOT NULL default '0',
`click_rate` varchar(100) NOT NULL default '',
`tut` enum('0','1') NOT NULL default '0',
`drugs_from` varchar(40) NOT NULL default '',
`total_drugs_mission` int(11) NOT NULL default '0',
`city` enum('Cambridgeshire','news','hdo') NOT NULL default 'Cambridgeshire',
`notes` text NOT NULL,
`last_chase` varchar(100) NOT NULL default '',
`choice` varchar(40) NOT NULL default '0',
`bar` enum('1','2') NOT NULL default '1',
`backfire` int(11) NOT NULL default '0',
`crewappl` varchar(100) NOT NULL default '',
`stocks` varchar(100) NOT NULL default '0-0-0-0',
`stock_price` varchar(100) NOT NULL default '0-0-0-0',
`forumpic` varchar(100) NOT NULL default 'no.jpg',
`forumquote` varchar(100) NOT NULL default 'Default',
`forank` enum('Forum Bum','Forum Watcher','Forum Abuse','Forum Spam','Forum God') NOT NULL default 'Forum Bum',
PRIMARY KEY (`id`),
KEY `userlevel` (`userlevel`),
FULLTEXT KEY `username` (`username`),
FULLTEXT KEY `username_2` (`username`),
FULLTEXT KEY `username_3` (`username`),
FULLTEXT KEY `username_4` (`username`),
FULLTEXT KEY `username_5` (`username`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=12882 ;

koyama
02-04-2007, 02:58 PM
Alright, then try to make the change I suggested above replacing that single line. And let us know if you succeeded.

TheLethal
02-04-2007, 03:07 PM
looks like it may have worked :) actualy :)
thank you

any chance could help me on my second jail problem.. i have a table called user_info and theres a a BUSTS on it
and when sumone busts a player it doesnt write to it. want it to be able to record number of busts

heres the userinfo table


--
-- Table structure for table `user_info`
--

CREATE TABLE `user_info` (
`id` int(11) NOT NULL auto_increment,
`username` varchar(40) NOT NULL default '',
`crimes` int(100) NOT NULL default '0',
`gtas` int(100) NOT NULL default '0',
`busts` int(100) NOT NULL default '0',
`get_aways` int(11) NOT NULL default '0',
`food_crimes` int(40) NOT NULL default '0',
`ocs` int(11) NOT NULL default '0',
`kill_skill` int(11) NOT NULL default '0',
`wl` varchar(40) NOT NULL default '0:0',
`exp` int(3) NOT NULL default '0',
`level` int(11) NOT NULL default '0',
`last_train` varchar(100) NOT NULL default '',
`jewl` varchar(40) NOT NULL default '',
`foot` varchar(40) NOT NULL default '',
`jail_able` enum('0','1') NOT NULL default '0',
`last_bribe` varchar(100) NOT NULL default '',
`jail_untill` varchar(100) NOT NULL default '',
`lang` enum('English','Dutch') NOT NULL default 'English',
`respect` int(11) NOT NULL default '0',
`respect_rec` varchar(11) NOT NULL default '0',
`last_respect` varchar(100) NOT NULL default '',
`mem_gym` enum('0','1') NOT NULL default '0',
`dealing` int(11) NOT NULL default '0',
`boat` int(32) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=506 ;

koyama
02-04-2007, 03:27 PM
I suppose this a bug you want to correct and not an added feature?

In that case you must first locate find script where a user gets 'busted'. What script is supposed to handle updating the 'busts' column? I guess it doesn't have anything to do with the jail?

Then you must post this script if we should be able to find an error.

TheLethal
02-04-2007, 03:32 PM
the jail script handles the busts.but i dont think the bust count part has been added to it.

jail.php?bust=14593

^^it busts like that

koyama
02-04-2007, 03:51 PM
so what is this line doing:


mysql_query("UPDATE info SET busts=busts+1 WHERE username='$username'");

Do you have an 'info' table? You only showed us a 'user_info' table. Maybe it should have been 'user_info' instead of 'info'?


mysql_query("UPDATE user_info SET busts=busts+1 WHERE username='$username'");

TheLethal
02-04-2007, 04:13 PM
ah i see yeah its user_info the table i do have,and inside it is busts
ah i see.i will try it now

TheLethal
02-04-2007, 04:20 PM
worked :) so now to show it i do


$fetch->busts

that correct :s

TheLethal
02-04-2007, 04:25 PM
i done it thank u for all help

TheLethal
02-04-2007, 04:30 PM
ah piss lol not sure how to get it to show on jail page. i got it to show on mystats like this,but when i try on jail i shows up error



<tr>
<td width="184" ><strong>Jail Busts</strong></td>
<td width="177"><?php echo "".makecomma($info->busts).""; ?></td>
</tr>

koyama
02-04-2007, 04:36 PM
I don't see $info defined anywhere. On the other hand I see $info_jail.

TheLethal
02-04-2007, 04:42 PM
well on my stats
$info->busts

that worked,but on jail it didnt i just got error. not sure how to fetch busts to the jail page :s

koyama
02-04-2007, 05:01 PM
Looks like you're just guessing things and trying stuff. You will have to actually look at the code to get what you want.

What are 'my stat busts' and what are 'jail busts'? Remember I don't have any knowledge about the game? I can only see the jail script.

To show busts on jail.php, try these three lines:


$result = mysql_query("SELECT * FROM user_info WHERE username='$username'");
$info = mysql_fetch_object($result);
echo $info->busts;

TheLethal
02-04-2007, 05:14 PM
ah i found in mystats and added




$query1=mysql_query("SELECT * FROM user_info WHERE username='$username'");
$info=mysql_fetch_object($query1);


and the code and it works,just need to put it where i like now realy

cheers mate (y)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum