Mr-Scripts Posted July 10, 2013 Posted July 10, 2013 <?php session_start(); include 'includes/db_connect.php'; include 'includes/functions.php'; include 'includes/jail_check.php'; if ($info->last_script_check < time()){ include_once "probe.php"; } $username=$_SESSION['username']; $radiobutton=$_POST['radiobutton']; $above = mysql_query("SELECT * FROM users WHERE username='$username'"); $info = mysql_fetch_object($above); $chance = explode("-", $info->gtachance); if (strip_tags($_GET['reset'])){ $reset=strip_tags($_GET['reset']); if($info->points < "4"){ echo "<center><font color=red><b>You dont have enough credits to reset your gta timer!</td>"; }elseif($info->points >= "4"){ mysql_query("UPDATE users SET points=points-5, lastgta='' WHERE username='$username'"); echo "<center><font color=green><b>Your gta timer has now been reset!<br><meta http-equiv='refresh' content='1;url=gta.php'>"; }} if ($info->lastgta > time()){ $left = $info->lastgta - time(); echo "<script type='text/javascript' src='timer.js'></script><link href='style.css' rel='stylesheet' type='text/css'> <br><table width='30%' align='center' cellspacing='0' cellpadding=0 border=0 class='table'> <tr> <td colspan='6' class='header' align=left>Error!</center></td> </tr> <tr> <td align='center'>You have to wait <span id='crime5'></span><script type='text/javascript'>setTimer('crime5','$left', { 0: function () { window.location = 'gta.php' }}); </script> before you can commit another gta!<br><br><a href=?reset=gta>Reset Timer (Costs 5 Credits)!</a></label></td> </tr> </div></table>"; exit(); } if ($_POST['submit']){ $suc = $chance[$radiobutton]; $ran = rand(1,100); if ($ran <= $suc){ if ($radiobutton == "6"){ $success = $chance[0]; $cars = array('Vauxhall Nova','Vauxhall Corsa','Ford Fiesta ST','Renault Clio','Peugeot 206','Ford Focus ST','Nissan 350Z','Ford Mustang','Toyota Supra','Mitsubishi Evolution 7','Subaru Impreza WRX'); $quote="You Broke In To The House And Found The Keys To The Car"; ////NEXT RADIO }elseif ($radiobutton == "1"){ $success = $chance[1]; $cars = array('Vauxhall Nova','Vauxhall Corsa','Ford Fiesta ST','Renault Clio','Peugeot 206','Ford Focus ST','Nissan 350Z','Ford Mustang','Toyota Supra','Mitsubishi Evolution 7','Subaru Impreza WRX'); $quote="You Found A Car With Keys In It."; ////NExT RADIO }elseif ($radiobutton == "2"){ $success = $chance[2]; $cars = array('Vauxhall Nova','Vauxhall Corsa','Ford Fiesta ST','Renault Clio','Peugeot 206','Ford Focus ST','Nissan 350Z','Ford Mustang','Toyota Supra','Mitsubishi Evolution 7','Subaru Impreza WRX'); $quote="You Managed To Get The Sexy Model To Give You The Keys And You Drove Away."; ////NExT RADIO }elseif ($radiobutton == "4"){ $success = $chance[4]; $cars = array('Vauxhall Nova','Vauxhall Corsa','Ford Fiesta ST','Renault Clio','Peugeot 206','Ford Focus ST','Nissan 350Z','Ford Mustang','Toyota Supra','Mitsubishi Evolution 7','Subaru Impreza WRX'); $quote="You Drove The Car Out Of The Back Door With The Owner On The Bonnet"; ////NExT RADIO }elseif ($radiobutton == "5"){ $success = $chance[5]; $cars = array('Vauxhall Nova','Vauxhall Corsa','Ford Fiesta ST','Renault Clio','Peugeot 206','Ford Focus ST','Nissan 350Z','Ford Mustang','Toyota Supra','Mitsubishi Evolution 7','Subaru Impreza WRX'); $quote="You Got The Car Out Of The Crews Car Lot With Out Being Seen."; } $win=rand(0,12); if ($cars[$win] == "Vauxhall Nova"){ $na = "images/car/nova.jpg"; } elseif ($cars[$win] == "Vauxhall Corsa"){ $na = "images/car/corsa.jpg"; } elseif ($cars[$win] == "Ford Fiesta ST"){ $na = "images/car/fiesta.jpg"; } elseif ($cars[$win] == "Renault Clio"){ $na = "images/car/clio.jpg"; } elseif ($cars[$win] == "Peugeot 206"){ $na = "images/car/206.jpg"; } elseif ($cars[$win] == "Ford Focus ST"){ $na = "images/car/focus.jpg"; } elseif ($cars[$win] == "Nissan 350Z"){ $na = "images/car/350z.jpg"; } elseif ($cars[$win] == "Ford Mustang"){ $na = "images/car/mustang.jpg"; } elseif ($cars[$win] == "Toyota Supra"){ $na = "images/car/supra.jpg"; } elseif ($cars[$win] == "Mitsubishi Evolution 7"){ $na = "images/car/evo7.jpg"; } elseif ($cars[$win] == "Subaru Impreza WRX"){ $na = "images/car/wrx.jpg"; } echo "<link href='style.css' rel='stylesheet' type='text/css'><br><center> <table width='30%' align='center' cellspacing='0' cellpadding=0 border=0 class='table'> <tr> <td colspan='6' class='header' align=left>Succesful!</center></td> </tr> <tr> <td align='center'>You brake the window to the car and jump in a $cars[$win] well done!</label></td> </tr> </div></table>"; mysql_query("UPDATE user_info SET gtas=gtas+1 WHERE username='$username'"); mysql_query("UPDATE users SET GP=GP+1 WHERE username='$username'"); $time= time() + (60*5); if($site->doublexp == "ON"){ $newrank = $info->rankpoints + 22; $newrank2 = $info->rankpoints + 8; $newcomprank = $info->compxp + 22; $newcomprank2 = $info->compxp + 8; }else{ $newrank = $info->rankpoints + 12; $newrank2 = $info->rankpoints + 4; $newcomprank = $info->compxp + 12; $newcomprank2 = $info->compxp + 4; } $damage=rand(1,50); if ($cars[$win] == "Vauxhall Nova"){ $max="750"; if ($damage == "0"){ $for=$max; }elseif ($damage == "50"){ $for = "0"; }else{ $for = $max / $damage *2; } } ////////////////////////////////////// if ($cars[$win] == "Vauxhall Corsa"){ $max="3250"; if ($damage == "0"){ $for=$max; }elseif ($damage == "50"){ $for = "0"; }else{ $for = $max / $damage *2; } } ////////////////////////////////////// if ($cars[$win] == "Ford Fiesta ST"){ $max="3850"; if ($damage == "0"){ $for=$max; }elseif ($damage == "50"){ $for = "0"; }else{ $for = $max / $damage *2; } } ////////////////////////////////////// if ($cars[$win] == "Renault Clio"){ $max="4000"; if ($damage == "0"){ $for=$max; }elseif ($damage == "50"){ $for = "0"; }else{ $for = $max / $damage *2; } } ////////////////////////////////////// if ($cars[$win] == "Peugeot 206"){ $max="5000"; if ($damage == "0"){ $for=$max; }elseif ($damage == "50"){ $for = "0"; }else{ $for = $max / $damage *2; } } ////////////////////////////////////// if ($cars[$win] == "Ford Focus ST"){ $max="9000"; if ($damage == "0"){ $for=$max; }elseif ($damage == "50"){ $for = "0"; }else{ $for = $max / $damage *2; } } ////////////////////////////////////// if ($cars[$win] == "Nissan 350Z"){ $max="14000"; if ($damage == "0"){ $for=$max; }elseif ($damage == "50"){ $for = "0"; }else{ $for = $max / $damage *2; } } ////////////////////////////////////// if ($cars[$win] == "Ford Mustang"){ $max="15000"; if ($damage == "0"){ $for=$max; }elseif ($damage == "50"){ $for = "0"; }else{ $for = $max / $damage *2; } } ////////////////////////////////////// if ($cars[$win] == "Toyota Supra"){ $max="20000"; if ($damage == "0"){ $for=$max; }elseif ($damage == "50"){ $for = "0"; }else{ $for = $max / $damage *2; } } ////////////////////////////////////// if ($cars[$win] == "Mitsubishi Evolution 7"){ $max="20000"; if ($damage == "0"){ $for=$max; }elseif ($damage == "50"){ $for = "0"; }else{ $for = $max / $damage *2; } } ////////////////////////////////////// if ($cars[$win] == "Subaru Impreza WRX"){ $max="24000"; if ($damage == "0"){ $for=$max; }elseif ($damage == "50"){ $for = "0"; }else{ $for = $max / $damage *2; } } ////////////////////////////////////// $for=round($for); //print "$for!!"; mysql_query("INSERT INTO `garage` ( `id` , `owner` , `car` , `damage`,`origion`,`location`,`worth`) VALUES ( '', '$username', '$cars[$win]', '$damage','$info->location','$info->location','$max' )"); mysql_query("UPDATE users SET rankpoints='$newrank' WHERE username='$username'"); if ($site->xpcompstatus == "2"){ mysql_query("UPDATE users SET compxp=$newcomprank WHERE username='$username'"); } }else{ if ($radiobutton == "6"){ $quote="You Got No Way Near The Posh House The Dogs Scared You Away. You Got Away With Nothing"; }elseif ($radiobutton == "1"){ $quote="You Triped On The Curb And Set The Car Alarm Off. You Got Away With Nothing"; }elseif ($radiobutton == "2"){ $quote="You Got Caught Climbing In To The Car And You Were Taken Down By A Car Model. You Got Away With Nothing"; }elseif ($radiobutton == "4"){ $quote="The Car Lot Owner Saw You Go In To The Show Room After Dark And Followed You In. You Got Away With Nothing"; }elseif ($radiobutton == "5"){ $quote="The Crew Caught You Hiding In There Car Lot. You Got Away With Nothing"; } $reason = "Gta"; require_once "includes/failed.php"; echo "<link href='style.css' rel='stylesheet' type='text/css'><br><center> <table width='30%' align='center' cellspacing='0' cellpadding=0 border=0 class='table'> <tr> <td colspan='6' class='header' align=left>Failed!</center></td> </tr> <tr> <td align='center'>You tryed to steal the car but the police drove passed you failed to get away with a car!</label></td> </tr> </div></table>"; mysql_query("UPDATE user_info SET gtas=gtas+1 WHERE username='$username'"); } if($chance[0] == 1){$chance[1] = 1;} elseif(($chance[0] >= 1) && ($chance[0] <= 2)){$chance[0] = rand(1,$chance[0]);} elseif(($chance[0] >= 2) && ($chance[0] <= 10)){$chance[0] = rand(10,$chance[0]);} elseif(($chance[0] >= 5) && ($chance[0] <= 25)){$chance[0] = rand(25,$chance[0]);} elseif(($chance[0] >= 18) && ($chance[0] <= 36)){$chance[0] = rand(36,$chance[0]);} elseif(($chance[0] >= 25) && ($chance[0] <= 49)){$chance[0] = rand(49,$chance[0]);} elseif(($chance[0] >= 36) && ($chance[0] <= 58)){$chance[0] = rand(58,$chance[0]);} elseif(($chance[0] >= 49) && ($chance[0] <= 55)){$chance[0] = rand(55,$chance[0]);} elseif($chance[0] >= 55){$chance[0] = rand(55,$chance[0]);} if($chance[0] == 1){$chance[1] = 0;} elseif(($chance[0] >= 1) && ($chance[0] <= 2)){$chance[1] = rand(0,$chance[0]);} elseif(($chance[0] >= 3) && ($chance[0] <= 8)){$chance[1] = rand(7,$chance[0]);} elseif(($chance[0] >= 9) && ($chance[0] <= 15)){$chance[1] = rand(14,$chance[0]);} elseif(($chance[0] >= 16) && ($chance[0] <= 34)){$chance[1] = rand(33,$chance[0]);} elseif(($chance[0] >= 35) && ($chance[0] <= 74)){$chance[1] = rand(45,$chance[0]);} elseif($chance[0] >= 75){$chance[1] = rand(50,$chance[0]);} if($chance[0] == 1){$chance[2] = 0;} elseif(($chance[0] >= 1) && ($chance[0] <= 2)){$chance[2] = rand(0,$chance[0]);} elseif(($chance[0] >= 3) && ($chance[0] <= 8)){$chance[2] = rand(6,$chance[0]);} elseif(($chance[0] >= 9) && ($chance[0] <= 15)){$chance[2] = rand(13,$chance[0]);} elseif(($chance[0] >= 16) && ($chance[0] <= 34)){$chance[2] = rand(32,$chance[0]);} elseif(($chance[0] >= 35) && ($chance[0] <= 74)){$chance[2] = rand(60,$chance[0]);} elseif($chance[0] >= 75){$chance[2] = rand(85,$chance[0]);} if($chance[0] == 1){$chance[4] = 0;} elseif(($chance[0] >= 1) && ($chance[0] <= 2)){$chance[4] = rand(0,$chance[0]);} elseif(($chance[0] >= 3) && ($chance[0] <= 8)){$chance[4] = rand(6,$chance[0]);} elseif(($chance[0] >= 9) && ($chance[0] <= 15)){$chance[4] = rand(13,$chance[0]);} elseif(($chance[0] >= 16) && ($chance[0] <= 34)){$chance[4] = rand(32,$chance[0]);} elseif(($chance[0] >= 35) && ($chance[0] <= 74)){$chance[4] = rand(60,$chance[0]);} elseif($chance[0] >= 75){$chance[4] = rand(85,$chance[0]);} if($chance[0] == 1){$chance[5] = 0;} elseif(($chance[0] >= 1) && ($chance[0] <= 2)){$chance[5] = rand(0,$chance[0]);} elseif(($chance[0] >= 3) && ($chance[0] <= 8)){$chance[5] = rand(6,$chance[0]);} elseif(($chance[0] >= 9) && ($chance[0] <= 15)){$chance[5] = rand(13,$chance[0]);} elseif(($chance[0] >= 16) && ($chance[0] <= 34)){$chance[5] = rand(32,$chance[0]);} elseif(($chance[0] >= 35) && ($chance[0] <= 74)){$chance[5] = rand(60,$chance[0]);} elseif($chance[0] >= 75){$chance[5] = rand(85,$chance[0]);} if($chance[0] > 70){ $chance[0] = 40; } if($chance[1] > 70){ $chance[1] = 40; } if($chance[2] > 75){ $chance[2] = 40; } if($chance[4] > 85){ $chance[4] = 40; } if($chance[5] > 48){ $chance[5] = 40; } $chance[0]++; if ($chance[0] > 50){ $chance[0] = 40; } $arrayrates = array($chance[0], $chance[1], $chance[2], $chance[3], $chance[4], $chance[5]); $newrates = implode("-", $arrayrates); $tim = time() + (60*5); mysql_query("UPDATE users SET gtachance='$newrates',lastgta='$tim' WHERE username='$username'"); exit; } ?> <? if ($site->gupdate == "1"){ echo "<link href='style.css' rel='stylesheet' type='text/css'><center><div class='update'>$site->gupdatetext</div></center> <br>"; } ?> <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> try { var pageTracker = _gat._getTracker("UA-12456885-1"); pageTracker._trackPageview(); } catch(err) {}</script> <script type="text/javascript"> if(!top || top.frames.length < 4) { top.location="/index2.php";} </script> <link href="style.css" rel="stylesheet" type="text/css"> <script language=JavaScript> function so(dis) { for (i=0;i<dis.elements.length;i++){ if (dis.elements[i].type=='submit') dis.elements[i].style.visibility='hidden'; } if(fs==false){ fs=true; return true; }else return false; } function goaway() { for(i=0;i<document.forms.length;i++) document.forms[i].onsubmit = function() {return so(this);}; } </script> <style > .bar_cont { display: inline-block; vertical-align:middle; } .bar { position: relative; width: 150px; line-height: 11px; border: 1px solid #000; color: #000000; background: url('images/crimebg/red.jpg'); background-repeat: repeat-x; } .rg { position: relative; height: 11px; background-image: url('images/crimebg/green.jpg'); background-repeat: repeat-x; z-index: 2; } </style> </head> <body onLoad="goaway();"> <form name="form1" method="post" action=""> <table width="300" align="center" border="0" cellpadding="0" cellspacing="0" class="table"> <tr class="header"> <td colspan="2">GTA</td> </tr> <tr> <td align="center" width="20"><input type="radio" name="radiobutton" value="1"></td> <td>Street<br><div class="bar" align="left"><div class="per" align="left"><?php echo "$chance[1]"; ?>%</div><div class="rg" align="left" style="width:<?php echo "$chance[1]"; ?>%"></div></div></td> </tr> <tr> <td align="center"><input type="radio" name="radiobutton" value="2"></td> <td>Car Park: <div class="bar" align="left"><div class="per" align="left"><?php echo "$chance[2]"; ?>%</div><div class="rg" align="left" style="width:<?php echo "$chance[2]"; ?>%"></div></div></td> </tr> <tr> <td align="center"><input type="radio" name="radiobutton" value="3"></td> <td>Car Dealership: <div class="bar" align="left"><div class="per" align="left"><?php echo "$chance[4]"; ?>%</div><div class="rg" align="left" style="width:<?php echo "$chance[4]"; ?>%"></div></div></td> </tr> <tr> <td align="center"><input type="radio" name="radiobutton" value="4"></td> <td>Car manufacturer: <div class="bar" align="left"><div class="per" align="left"><?php echo "$chance[5]"; ?>%</div><div class="rg" align="left" style="width:<?php echo "$chance[5]"; ?>%"></div></div></td> </tr> <tr> <td colspan="2" align="center"> <div align="center"> <input name="submit" type="submit" class="button" id="submit" value="Steal Car"> </div></td> </tr> </table> </form> <p> </p> </html> shows a blank car so i think the random selection is wrong $win=rand(0,12); if ($cars[$win] == "Vauxhall Nova"){ $na = "images/car/nova.jpg"; } elseif ($cars[$win] == "Vauxhall Corsa"){ $na = "images/car/corsa.jpg"; } elseif ($cars[$win] == "Ford Fiesta ST"){ $na = "images/car/fiesta.jpg"; } elseif ($cars[$win] == "Renault Clio"){ $na = "images/car/clio.jpg"; } elseif ($cars[$win] == "Peugeot 206"){ $na = "images/car/206.jpg"; } elseif ($cars[$win] == "Ford Focus ST"){ $na = "images/car/focus.jpg"; } elseif ($cars[$win] == "Nissan 350Z"){ $na = "images/car/350z.jpg"; } elseif ($cars[$win] == "Ford Mustang"){ $na = "images/car/mustang.jpg"; } elseif ($cars[$win] == "Toyota Supra"){ $na = "images/car/supra.jpg"; } elseif ($cars[$win] == "Mitsubishi Evolution 7"){ $na = "images/car/evo7.jpg"; } elseif ($cars[$win] == "Subaru Impreza WRX"){ $na = "images/car/wrx.jpg"; } Quote
Mr-Scripts Posted July 10, 2013 Author Posted July 10, 2013 yeah all images are there , but i cant remember if the random selection ( $win=rand(0,12); ) starts from 1,11 or 0,11 or 1,12 0,12 Quote
Guest Posted July 10, 2013 Posted July 10, 2013 http://uk3.php.net/rand In your case a number between 0 and 12 inclusive Quote
Mr-Scripts Posted July 10, 2013 Author Posted July 10, 2013 http://uk3.php.net/rand In your case a number between 0 and 12 inclusive even though theres only 11 cars Quote
Mr-Scripts Posted July 10, 2013 Author Posted July 10, 2013 $win = mt_rand(0, count($cars) - 1); will that resolve my missing car problem Quote
Mr-Scripts Posted July 10, 2013 Author Posted July 10, 2013 out come : You brake the window to the car and jump in a well done! what it should be :You brake the window to the car and jump in a (car name) well done! Quote
KyleMassacre Posted July 10, 2013 Posted July 10, 2013 (edited) possibly: $win = array_rand($cars, 1); Working Example Edited July 11, 2013 by KyleMassacre added working example Quote
HauntedDawg Posted July 11, 2013 Posted July 11, 2013 My eyes hurt. Whats with defining the car's array multiple times? And perhaps, why not create a multi-dimensional array that contain's the images as well? Therefor only requiring to edit one array, instead of multiple. Tut tut.. $cars = array( 0 => array('name' => 'Vauxhall Nova', 'img' => ''), 1 => array('name' => 'Vauxhall Corsa', 'img' => ''), 2 => array('name' => 'Ford Fiesta ST', 'img' => ''), 3 => array('name' => 'Renault Clio', 'img' => '') ); $win = mt_rand(0,3); You brake the window to the car and jump in a $cars[$win]['name'] well done! To use image: <img src="$cars[$win]['img']" /> Quote
Guest Posted July 11, 2013 Posted July 11, 2013 My eyes hurt. Whats with defining the car's array multiple times? And perhaps, why not create a multi-dimensional array that contain's the images as well? Therefor only requiring to edit one array, instead of multiple. Tut tut.. $cars = array( 0 => array('name' => 'Vauxhall Nova', 'img' => ''), 1 => array('name' => 'Vauxhall Corsa', 'img' => ''), 2 => array('name' => 'Ford Fiesta ST', 'img' => ''), 3 => array('name' => 'Renault Clio', 'img' => '') ); $win = mt_rand(0,3); You brake the window to the car and jump in a $cars[$win]['name'] well done! To use image: <img src="$cars[$win]['img']" /> Possibly because he never wrote this script in the first place :). Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.