Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # check if there is anyone traveling
- $tcheck = $db->query("SELECT `time`,`userid`,`location`,`ttype` FROM `traveling` WHERE `time` >= 0");
- if($db->num_rows($tcheck))
- {
- while($t = $db->fetch_row($tcheck))
- {
- if($t['time'])
- {
- $db->query("UPDATE `traveling` SET `time` = GREATEST(`time` - 1, 0)");
- if(mt_rand(1,3) == 3)
- {
- $insured = $db->query("SELECT `insured`,`money` FROM `users` WHERE `userid` = {$t['userid']}");
- $in = $db->fetch_row($insured);
- if($in['insured'])
- {
- $travelcost = $db->fetch_single($db->query("SELECT `travelcost` FROM `locations`
- WHERE `ttype` = {$t['ttype']} AND `cityid` = {$t['location']}"));
- if($t['ttype'] == 'Car')
- {
- switch(mt_rand(1,4))
- {
- case 1:
- $msg = $db->escape("Your tire poped and your car spun out of control");
- $time = mt_rand(1,5);
- $money = $travelcost / 100 * 50 / 2;
- $in['money'] += $money;
- $db->query("UPDATE `users` SET `hospital` = {$time},
- `hospreason` = '{$msg}',`money` = {$in['money']} WHERE `userid` = {$t['userid']}");
- $db->query("INSERT INTO `mail` VALUES (NULL, 0, 0, {$t['userid']}, ".time().",
- 'Insurance Team', 'As you are insured we have returned half of your travel cost
- which is ".money_formatter($money)."')");
- $db->query("UPDATE `users` SET `new_mail` = `new_mail` + 1 WHERE `userid` = {$t['userid']}");
- event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
- $db->query("DELETE FROM `traveling` WHERE `userid` = {$t['userid']}");
- break;
- case 2:
- $msg = $db->escape("You fainted while driving");
- $time = mt_rand(1,15);
- $money = $travelcost / 100 * 50 / 2;
- $in['money'] += $money;
- $db->query("UPDATE `users` SET `hospital` = {$time},
- `hospreason` = '{$msg}',`money` = {$in['money']} WHERE `userid` = {$t['userid']}");
- $db->query("INSERT INTO `mail` VALUES (NULL, 0, 0, {$t['userid']}, ".time().",
- 'Insurance Team', 'As you are insured we have returned half of your travel cost
- which is ".money_formatter($money)."')");
- $db->query("UPDATE `users` SET `new_mail` = `new_mail` + 1 WHERE `userid` = {$t['userid']}");
- event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
- $db->query("DELETE FROM `traveling` WHERE `userid` = {$t['userid']}");
- break;
- case 3:
- $msg = $db->escape("A crazy driver ran you off the road");
- $time = mt_rand(1,25);
- $money = $travelcost / 100 * 50 / 2;
- $in['money'] += $money;
- $db->query("UPDATE `users` SET `hospital` = {$time},
- `hospreason` = '{$msg}',`money` = {$in['money']} WHERE `userid` = {$t['userid']}");
- $db->query("INSERT INTO `mail` VALUES (NULL, 0, 0, {$t['userid']}, ".time().",
- 'Insurance Team', 'As you are insured we have returned half of your travel cost
- which is ".money_formatter($money)."')");
- $db->query("UPDATE `users` SET `new_mail` = `new_mail` + 1 WHERE `userid` = {$t['userid']}");
- event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
- $db->query("DELETE FROM `traveling` WHERE `userid` = {$t['userid']}");
- break;
- case 4;
- $msg = $db->escape("Your car engine exploded");
- $time = mt_rand(1,50);
- $money = $travelcost / 100 * 50 / 2;
- $in['money'] += $money;
- $db->query("UPDATE `users` SET `hospital` = {$time},
- `hospreason` = '{$msg}',`money` = {$in['money']} WHERE `userid` = {$t['userid']}");
- $db->query("INSERT INTO `mail` VALUES (NULL, 0, 0, {$t['userid']}, ".time().",
- 'Insurance Team', 'As you are insured we have returned half of your travel cost
- which is ".money_formatter($money)."')");
- $db->query("UPDATE `users` SET `new_mail` = `new_mail` + 1 WHERE `userid` = {$t['userid']}");
- event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
- $db->query("DELETE FROM `traveling` WHERE `userid` = {$t['userid']}");
- break;
- }
- }
- else if($t['ttype'] == 'Boat')
- {
- switch(mt_rand(1,3))
- {
- case 1:
- $msg = $db->escape("Your boat hit a rock and you bumped your head");
- $time = mt_rand(1,5);
- $money = $travelcost / 100 * 50 / 2;
- $in['money'] += $money;
- $db->query("UPDATE `users` SET `hospital` = {$time},
- `hospreason` = '{$msg}',`money` = {$in['money']} WHERE `userid` = {$t['userid']}");
- event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
- break;
- case 2:
- $msg = $db->escape("The boats engine stopped working and you tried to fix it and lost your hand");
- $time = mt_rand(1,15);
- $money = $travelcost / 100 * 50 / 2;
- $in['money'] += $money;
- $db->query("UPDATE `users` SET `hospital` = {$time},
- `hospreason` = '{$msg}',`money` = {$in['money']} WHERE `userid` = {$t['userid']}");
- event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
- break;
- case 3:
- $msg = $db->escape("The boats engine exploded");
- $time = mt_rand(1,25);
- $money = $travelcost / 100 * 50 / 2;
- $in['money'] += $money;
- $db->query("UPDATE `users` SET `hospital` = {$time},
- `hospreason` = '{$msg}',`money` = {$in['money']} WHERE `userid` = {$t['userid']}");
- event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
- break;
- }
- }
- else if($t['ttype'] == 'Bus')
- {
- switch(mt_rand(1,3))
- {
- case 1:
- $msg = $db->escape("The bus swearved another car and tumbled over you were hurt in acident");
- $time = mt_rand(1,5);
- $money = $travelcost / 100 * 50 / 2;
- $in['money'] += $money;
- $db->query("UPDATE `users` SET `hospital` = {$time},
- `hospreason` = '{$msg}',`money` = {$in['money']} WHERE `userid` = {$t['userid']}");
- event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
- break;
- case 2:
- $msg = $db->escape("Gang of thugs pull a driveby on your bus");
- $time = mt_rand(1,15);
- $money = $travelcost / 100 * 50 / 2;
- $in['money'] += $money;
- $db->query("UPDATE `users` SET `hospital` = {$time},
- `hospreason` = '{$msg}',`money` = {$in['money']} WHERE `userid` = {$t['userid']}");
- event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
- break;
- case 3:
- $msg = $db->escape("The buses engine exploded");
- $time = mt_rand(1,25);
- $money = $travelcost / 100 * 50 / 2;
- $in['money'] += $money;
- $db->query("UPDATE `users` SET `hospital` = {$time},
- `hospreason` = '{$msg}',`money` = {$in['money']} WHERE `userid` = {$t['userid']}");
- event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
- break;
- }
- }
- else
- {
- switch(mt_rand(1,2))
- {
- case 1:
- $msg = $db->escape("Pilot fell aleep at wheel lucky the co was there and stoped a big acidident");
- $time = mt_rand(1,5);
- $money = $travelcost / 100 * 50 / 2;
- $in['money'] += $money;
- $db->query("UPDATE `users` SET `hospital` = {$time},
- `hospreason` = '{$msg}',`money` = {$in['money']} WHERE `userid` = {$t['userid']}");
- event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
- break;
- case 2:
- $msg = $db->escape("Planes Engines failed and crashed you were the only survior");
- $time = mt_rand(1,45);
- $money = $travelcost / 100 * 50 / 2;
- $in['money'] += $money;
- $db->query("UPDATE `users` SET `hospital` = {$time},
- `hospreason` = '{$msg}',`money` = {$in['money']} WHERE `userid` = {$t['userid']}");
- event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
- break;
- }
- }
- }
- else
- {
- if($t['ttype'] == 'Car')
- {
- switch(mt_rand(1,4))
- {
- case 1:
- $msg = $db->escape("Your tire poped and your car spun out of control");
- $time = mt_rand(1,5);
- $db->query("UPDATE `users` SET `hospital` = {$time},
- `hospreason` = '{$msg}'WHERE `userid` = {$t['userid']}");
- event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
- $db->query("DELETE FROM `traveling` WHERE `userid` = {$t['userid']}");
- break;
- case 2:
- $msg = $db->escape("You fainted while driving");
- $time = mt_rand(1,15);
- $db->query("UPDATE `users` SET `hospital` = {$time},
- `hospreason` = '{$msg}' WHERE `userid` = {$t['userid']}");
- event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
- $db->query("DELETE FROM `traveling` WHERE `userid` = {$t['userid']}");
- break;
- case 3:
- $msg = $db->escape("A crazy driver ran you off the road");
- $time = mt_rand(1,25);
- $db->query("UPDATE `users` SET `hospital` = {$time},
- `hospreason` = '{$msg}' WHERE `userid` = {$t['userid']}");
- event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
- $db->query("DELETE FROM `traveling` WHERE `userid` = {$t['userid']}");
- break;
- case 4;
- $msg = $db->escape("Your car engine exploded");
- $time = mt_rand(1,50);
- $db->query("UPDATE `users` SET `hospital` = {$time},
- `hospreason` = '{$msg}' WHERE `userid` = {$t['userid']}");
- event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
- $db->query("DELETE FROM `traveling` WHERE `userid` = {$t['userid']}");
- break;
- }
- }
- else if($t['ttype'] == 'Boat')
- {
- switch(mt_rand(1,3))
- {
- case 1:
- $msg = $db->escape("Your boat hit a rock and you bumped your head");
- $time = mt_rand(1,5);
- $db->query("UPDATE `users` SET `hospital` = {$time},
- `hospreason` = '{$msg}' WHERE `userid` = {$t['userid']}");
- event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
- break;
- case 2:
- $msg = $db->escape("The boats engine stopped working and you tried to fix it and lost your hand");
- $time = mt_rand(1,15);
- $db->query("UPDATE `users` SET `hospital` = {$time},
- `hospreason` = '{$msg}' WHERE `userid` = {$t['userid']}");
- event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
- break;
- case 3:
- $msg = $db->escape("The boats engine exploded");
- $time = mt_rand(1,25);
- $db->query("UPDATE `users` SET `hospital` = {$time},
- `hospreason` = '{$msg}' WHERE `userid` = {$t['userid']}");
- event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
- break;
- }
- }
- else if($t['ttype'] == 'Bus')
- {
- switch(mt_rand(1,3))
- {
- case 1:
- $msg = $db->escape("The bus swearved another car and tumbled over you were hurt in acident");
- $time = mt_rand(1,5);
- $db->query("UPDATE `users` SET `hospital` = {$time},
- `hospreason` = '{$msg}' WHERE `userid` = {$t['userid']}");
- event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
- break;
- case 2:
- $msg = $db->escape("Gang of thugs pull a driveby on your bus");
- $time = mt_rand(1,15);
- $db->query("UPDATE `users` SET `hospital` = {$time},
- `hospreason` = '{$msg}' WHERE `userid` = {$t['userid']}");
- event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
- break;
- case 3:
- $msg = $db->escape("The buses engine exploded");
- $time = mt_rand(1,25);
- $db->query("UPDATE `users` SET `hospital` = {$time},
- `hospreason` = '{$msg}' WHERE `userid` = {$t['userid']}");
- event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
- break;
- }
- }
- else
- {
- switch(mt_rand(1,2))
- {
- case 1:
- $msg = $db->escape("Pilot fell aleep at wheel lucky the co was there and stoped a big acidident");
- $time = mt_rand(1,5);
- $db->query("UPDATE `users` SET `hospital` = {$time},
- `hospreason` = '{$msg}' WHERE `userid` = {$t['userid']}");
- event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
- break;
- case 2:
- $msg = $db->escape("Planes Engines failed and crashed you were the only survior");
- $time = mt_rand(1,45);
- $db->query("UPDATE `users` SET `hospital` = {$time},
- `hospreason` = '{$msg}' WHERE `userid` = {$t['userid']}");
- event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
- break;
- }
- }
- }
- }
- }
- else
- {
- $db->query("UPDATE `users` SET `location` = {$t['location']},`traveling` = 0 WHERE `userid` = {$t['userid']}");
- $db->query("DELETE FROM `traveling` WHERE `userid` = {$t['userid']} AND `time` = 0");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment