Razor42 Posted May 17, 2013 Posted May 17, 2013 Hi there, I need a V2 car racing mod making. The features of this mod are: -Players can race cars against each for either fun, bets or pink slips. -Staff can add cars via staff panel. -Cars abilities = Name, Description, Speed, Handling, Acceleration & Braking. -Cars market for selling your cars. -Cars are upgradable by paying money. -Garages in which you store your car but a garage only starts with one spot for cars and you Have to upgrade garage using crystals to get more spots for cars. Feel free to send me quotes via PM or on here! I need this doing ASAP. Thanks, Razor. Quote
Dave Posted May 17, 2013 Posted May 17, 2013 Swear McCodes actually released a system like this many years ago? Quote
Dominion Posted May 17, 2013 Posted May 17, 2013 Swear McCodes actually released a system like this many years ago? http://mccodes.com/viewmod.php?id=1 Quote
Razor42 Posted May 17, 2013 Author Posted May 17, 2013 I'v heared it's not too good. I'd rather pay for better quality. Quote
newttster Posted May 17, 2013 Posted May 17, 2013 I'v heared it's not too good. I'd rather pay for better quality. Have you tried it? Perhaps try it first and then adjust the code to suit your needs. Quote
Razor42 Posted May 17, 2013 Author Posted May 17, 2013 @newttster my coding isn't brilliant so I'd rathe someone better than me work on it. @Dave I don't really have a budget. Just looking at what people quote. Iv had one quote so far so we will see what else people offer :). Quote
realmoflegends Posted May 17, 2013 Posted May 17, 2013 I modified the existing Cars one from McCodes to fix various bugs and add more fun and randomness to it, and it works pretty well. PM me if you want more info. Quote
Magictallguy Posted May 18, 2013 Posted May 18, 2013 [...]- Players can race cars against each for either fun, bets or pink slips.[...] Any specific time limit on how many times a player can race said car(s)? Is there a limit on the amount of races by x amount of time? Limit on how many cars a player can have/win/lose? [...]- Cars abilities = Name, Description, Speed, Handling, Acceleration & Braking.[...] Again, limits? Do you want the players to be able to nickname their cars? [...]- Cars market for selling your cars.[...] Similar to the Item Market, I assume? [...]- Cars are upgradable by paying money.[...] How much money per upgrade? Does the upgrade count for all car "stats" or just one specifically per upgrade purchase? Would the car have a "car level"? If so, would this level limit the amount a car can be upgraded? [...]- Garages in which you store your car but a garage only starts with one spot for cars and you have to upgrade garage using crystals to get more spots for cars.[...] Upgrading a garage gives you how many more parking spots? Do you want the garage to be upgraded into something different per "garage level"? (i.e. Garage -> Sheltered Garage -> Showroom -> Complex, etc..) Quote
Razor42 Posted May 18, 2013 Author Posted May 18, 2013 No limits on anything. Players can race as much a they want. They should receive an event 5 mins after a race to say d hey win or not. Market should be similar to item market yet. Upgrades section should be upgrades per stat not all stat and price increases per upgrade and yeah that sounds good for garages. Quote
Magictallguy Posted May 18, 2013 Posted May 18, 2013 Right, before I continue, do you want car brands (Mercedes, BMW, etc. (obviously, for legal reasons, you'd have to invent your own or get permission from each company to use their name) Quote
Razor42 Posted May 18, 2013 Author Posted May 18, 2013 No ill create my own which is why I want to be able to add via staff panel Quote
Magictallguy Posted May 18, 2013 Posted May 18, 2013 No ill create my own which is why I want to be able to add via staff panel Not what I asked lol. You wanted cars, do you also want car brands? Quote
Magictallguy Posted May 18, 2013 Posted May 18, 2013 Oh, no I don't Good stuff, writing up the staff side now :) Quote
Magictallguy Posted May 18, 2013 Posted May 18, 2013 (edited) SQLs CREATE TABLE `cars` ( `cID` INT( 11 ) NOT NULL PRIMARY KEY AUTO_INCREMENT, `cName` VARCHAR( 255 ) NOT NULL DEFAULT '', `cDesc` TEXT NOT NULL, `cSpeed` INT( 11 ) NOT NULL DEFAULT 0, `cHandling` INT( 11 ) NOT NULL DEFAULT 0, `cAccel` INT( 11 ) NOT NULL DEFAULT 0, `cBrake` INT( 11 ) NOT NULL DEFAULT 0, `cCost` INT( 11 ) NOT NULL DEFAULT 0 ); Get those in, I'm just finishing up the staff side so you can start creating the cars for your players ;) Edited May 18, 2013 by Magictallguy Added car cost Quote
KyleMassacre Posted May 18, 2013 Posted May 18, 2013 I must give you credit MTG I think you are really doing this forum a service. I give you mad props Quote
Magictallguy Posted May 18, 2013 Posted May 18, 2013 (edited) I must give you credit MTG I think you are really doing this forum a service. I give you mad props Thank you kindly :) staff_cars.php - Code has been fully tested <?php include(__DIR__ . '/globals.php'); if($ir['user_level'] != 2) { error("You can't access this"); } echo "<!-- Created by Magictallguy -->"; $_GET['action'] = isset($_GET['action']) && ctype_alpha($_GET['action']) ? strtolower(trim($_GET['action'])) : null; switch($_GET['action']) { case 'add': addCar(); break; case 'edit': editCar(); break; case 'del': deleteCar(); break; default: error("I don't know what to do.."); break; } function error($msg) { global $h; echo "<div style='color: #D8000C;background-color: #FFBABA;border: 1px solid;background-repeat: no-repeat;background-position: 10px center;width: 40%;border-radius: 15px;margin: 10px 0;padding: 15px 10px 15px 50px;'><strong>ERROR!</strong><br />",$msg,"<br /><a onclick='window.history.go(-1);' style='cursor:pointer;'>Back</a> · <a href='index' style='color:black;'>Home</a></div>"; $h->endpage(); exit; } function success($msg) { echo "<div style='color: #4F8A10;background-color: #DFF2BF;border: 1px solid;background-repeat: no-repeat;background-position: 10px center;width: 40%;border-radius: 15px;margin: 10px 0;padding: 15px 10px 15px 50px;'><strong>Success!</strong><br />",$msg,"<br /><a onclick='window.history.go(-1);' style='cursor:pointer;'>Back</a> · <a href='index' style='color:black;'>Home</a></div>"; } function format($str, $dec = 0) { return ctype_digit($str) ? number_format($str, $dec) : stripslashes(htmlspecialchars($str)); } function addCar() { global $db; echo "<h3>Cars: Create Car</h3>"; if(isset($_POST['submit'])) { $texts = array( 'carName' => 'name', 'carDesc' => 'description' ); $nums = array( 'carSpeed' => 'speed', 'carHandling' => 'handling', 'carAccel' => 'acceleration', 'carBrake' => 'braking', 'carCost' => 'cost' ); foreach($_POST[$texts] as $what => $value) { $_POST[$texts] = isset($_POST[$texts]) && is_string($_POST[$texts]) ? trim($_POST[$texts]) : null; if(empty($_POST[$texts])) { error("You didn't enter a valid ".$value); } } foreach($_POST[$nums] as $what => $value) { $_POST[$nums] = isset($_POST[$nums]) && ctype_digit($_POST[$texts]) ? abs(@intval($_POST[$texts])) : null; if(empty($_POST[$nums])) { error("You didn't enter a valid ".$nums." value"); } } $select = $db->query(sprintf("SELECT `cID` FROM `cars` WHERE (`cName` = '%s')", $db->escape($_POST['carName']))); if($db->num_rows($select)) { error("A car with that name already exists"); } $db->query(sprintf("INSERT INTO `cars` VALUES ('', '%s', '%s', %u, %u, %u, %u, %u)", $db->escape($_POST['carName']), $db->escape($_POST['carDesc']), $_POST['carSpeed'], $_POST['carHandling'], $_POST['carAccel'], $_POST['carBrake'], $_POST['carCost'])); stafflog_add("Created a new car: ".$_POST['carName']); success("The “".format($_POST['carName'])."” has been created"); } ?><form action='staff_cars.php?action=add' method='post'> <table class='table' width='75%' cellspacing='1'> <tr> <th width='45%'>Name</th> <td width='55%'><input type='text' name='carName' /></td> </tr> <tr> <th>Description</th> <td><textarea name='carDesc' rows='10' cols='70'></textarea></td> </tr> <tr> <th>Speed</th> <td><input type='number' name='carSpeed' /></td> </tr> <tr> <th>Handling</th> <td><input type='number' name='carHandling' /></td> </tr> <tr> <th>Acceleration</th> <td><input type='number' name='carAccel' /></td> </tr> <tr> <th>Braking</th> <td><input type='number' name='carBrake' /></td> </tr> <tr> <th>Cost</th> <td><input type='number' name='carCost' /></td> </tr> <tr> <td colspan='2' class='center'><input type='submit' name='submit' value='Create' /></td> </tr> </table> </form><? } function editCar() { global $db; echo "<h3>Cars: Edit Car</h3>"; $_GET['step'] = isset($_GET['step']) && ctype_digit($_GET['step']) ? abs(@intval($_GET['step'])) : null; switch($_GET['step']) { default: $selectCars = $db->query("SELECT `cID`, `cName` FROM `cars` ORDER BY `cName` ASC"); if(!$db->num_rows($selectCars)) { error("There are no cars to edit"); } ?><form action='staff_cars.php?action=edit&step=1' method='post'> <table class='table' width='75%' cellspacing='1'> <tr> <th width='45%'>Car</th> <td width='55%'><select name='car' type='dropdown'><? while($row = $db->fetch_row($selectCars)) { printf("<option value='%u'>%s</option>", $row['cID'], format($row['cName'])); } ?></select></td> </tr> <tr> <td colspan='2' class='center'><input type='submit' name='submit' value='Edit the selected car' /></td> </tr> </table> </form><? break; case 1: $_POST['car'] = isset($_POST['car']) && ctype_digit($_POST['car']) ? abs(@intval($_POST['car'])) : null; if(empty($_POST['car'])) { error("You didn't select a valid car"); } $select = $db->query(sprintf("SELECT * FROM `cars` WHERE (`cID` = %u)", $_POST['car'])); if(!$db->num_rows($select)) { error("That car doesn't exist"); } $car = $db->fetch_row($select); ?><form action='staff_cars.php?action=edit&step=2' method='post'> <input type='hidden' name='carID' value='<? echo $_POST['car']; ?>' /> <table class='table' width='75%' cellspacing='1'> <tr> <th width='45%'>Name</th> <td width='55%'><input type='text' name='carName' value='<? echo format($car['cName']); ?>' /></td> </tr> <tr> <th>Description</th> <td><textarea name='carDesc' rows='10' cols='70'><? echo format($car['cDesc']); ?></textarea></td> </tr> <tr> <th>Speed</th> <td><input type='number' name='carSpeed' value='<? echo $car['cSpeed']; ?>' /></td> </tr> <tr> <th>Handling</th> <td><input type='number' name='carHandling' value='<? echo $car['cHandling']; ?>' /></td> </tr> <tr> <th>Acceleration</th> <td><input type='number' name='carAccel' value='<? echo $car['cAccel']; ?>' /></td> </tr> <tr> <th>Braking</th> <td><input type='number' name='carBrake' value='<? echo $car['cBrake']; ?>' /></td> </tr> <tr> <th>Cost</th> <td><input type='number' name='carCost' value='<? echo $car['cCost']; ?>' /></td> </tr> <tr> <td colspan='2' class='center'><input type='submit' name='submit' value='Edit' /></td> </tr> </table> </form><? break; case 2: $texts = array( 'carName' => 'name', 'carDesc' => 'description' ); $nums = array( 'carSpeed' => 'speed', 'carHandling' => 'handling', 'carAccel' => 'acceleration', 'carBrake' => 'braking', 'carCost' => 'cost', 'carID' => 'car' ); foreach($_POST[$texts] as $what => $value) { $_POST[$texts] = isset($_POST[$texts]) && is_string($_POST[$texts]) ? trim($_POST[$texts]) : null; if(empty($_POST[$texts])) { error("You didn't enter a valid ".$value); } } foreach($_POST[$nums] as $what => $value) { $_POST[$nums] = isset($_POST[$nums]) && ctype_digit($_POST[$texts]) ? abs(@intval($_POST[$texts])) : null; if(empty($_POST[$nums])) { error("You didn't enter a valid ".$nums." value"); } } $selectCar = $db->query(sprintf("SELECT `cName` FROM `cars` WHERE (`cID` = %u)", $_POST['carID'])); if(!$db->num_rows($selectCar)) { error("That car doesn't exist"); } $selectCarName = $db->query(sprintf("SELECT `cName` FROM `cars` WHERE ((`cName` = '%s') AND (`cID` != %u))", $db->escape($_POST['carName']), $_POST['carID'])); if($db->num_rows($selectCarName)) { error("Another car with that name already exists"); } $oldName = $db->fetch_single($selectCar); $db->query(sprintf("UPDATE `cars` SET `cName` = '%s', `cDesc` = '%s', `cSpeed` = %u, `cHandling` = %u, `cAccel` = %u, `cBrake` = %u, `cCost` = %u WHERE (`cID` = %u)", $db->escape($_POST['carName']), $db->escape($_POST['carDesc']), $_POST['carSpeed'], $_POST['carHandling'], $_POST['carAccel'], $_POST['carBrake'], $_POST['carCost'], $_POST['carID'])); $log = ($_POST['carName'] == stripslashes($oldName)) ? $_POST['carName'] : $oldName." > ".format($_POST['carName']); stafflog_add("Edited the car: ".$log); success("The “".stripslashes($log)."” has been edited"); break; } } function deleteCar() { global $db; echo "<h3>Cars: Delete Car</h3>"; if(isset($_POST['submit'])) { $_POST['car'] = isset($_POST['car']) && ctype_digit($_POST['car']) ? abs(@intval($_POST['car'])) : null; if(empty($_POST['car'])) { error("You didn't select a valid car"); } $select = $db->query(sprintf("SELECT `cName` FROM `cars` WHERE (`cID` = %u)", $_POST['car'])); if(!$db->num_rows($select)) { error("That car doesn't exist"); } $name = $db->fetch_single($select); $db->query(sprintf("DELETE FROM `cars` WHERE (`cID` = %u)", $_POST['car'])); stafflog_add("Deleted the car: ".$name); success("You've deleted the car: ".format($name)); } $selectCars = $db->query("SELECT `cID`, `cName` FROM `cars` ORDER BY `cName` ASC"); if(!$db->num_rows($selectCars)) { error("There are no cars to delete"); } ?><form action='staff_cars.php?action=del' method='post'> <table class='table' width='75%' cellspacing='1'> <tr> <th width='45%'>Car</th> <td width='55%'><select name='car' type='dropdown'><? while($row = $db->fetch_row($selectCars)) { printf("<option value='%u'>%s</option>", $row['cID'], format($row['cName'])); } ?></select></td> </tr> <tr> <td colspan='2' class='center'><input type='submit' name='submit' value='Delete the selected car' /></td> </tr> </table> </form><? } $h->endpage(); ?> Edit your staff menu (smenu.php) Add this where you want it <hr /><strong>Cars</strong><br /> > <a href='staff_cars.php?action=add'>Add Car</a><br /> > <a href='staff_cars.php?action=edit'>Edit Car</a><br /> > <a href='staff_cars.php?action=del'>Delete Car</a><br /> Edited May 18, 2013 by Magictallguy Added staff links, added car cost Quote
KyleMassacre Posted May 18, 2013 Posted May 18, 2013 how about a Grand Prix where players can race their cars against all? Example not 1 v. 1 and go for a grand prize of an entrance fee and first 3 runners up get cash money. when I was running a game with mc codes I was always on the prowel for that ;) Quote
Magictallguy Posted May 18, 2013 Posted May 18, 2013 (edited) Oh, Razor! Do you want players to automatically have a garage, or do you want them to buy it? how about a Grand Prix where players can race their cars against all? Example not 1 v. 1 and go for a grand prize of an entrance fee and first 3 runners up get cash money. when I was running a game with mc codes I was always on the prowel for that ;) I can do that.. Could be fun ^.^ Edited May 18, 2013 by Magictallguy Added quote and response Quote
KyleMassacre Posted May 18, 2013 Posted May 18, 2013 I would say buy it but take it with a grain of salt since its not my request but currency is a game ruiner in most aspects it may just help balance out Quote
Magictallguy Posted May 18, 2013 Posted May 18, 2013 I would say buy it but take it with a grain of salt since its not my request but currency is a game ruiner in most aspects it may just help balance out I'd also make it so they'd have to buy it, but the client gets what the client wants ;) Quote
KyleMassacre Posted May 18, 2013 Posted May 18, 2013 just do something like adding a var for the price and if its set to 0 then it continues on, if its greater than 1 then they purchase it. just an idea Quote
Magictallguy Posted May 18, 2013 Posted May 18, 2013 (edited) Next lot of SQL's - don't worry people, I'll release this all on one topic ;) CREATE TABLE `playerCars` ( `pcID` INT( 11 ) NOT NULL PRIMARY KEY AUTO_INCREMENT, `pcUser` INT( 11 ) NOT NULL DEFAULT 0, `pcCarID` INT( 11 ) NOT NULL DEFAULT 0, `pcSpeed` INT( 11 ) NOT NULL DEFAULT 0, `pcHandling` INT( 11 ) NOT NULL DEFAULT 0, `pcAccel` INT( 11 ) NOT NULL DEFAULT 0, `pcBrake` INT( 11 ) NOT NULL DEFAULT 0 ); CREATE TABLE `playerGarages` ( `pgID` INT( 11 ) NOT NULL PRIMARY KEY AUTO_INCREMENT, `pgUser` INT( 11 ) NOT NULL DEFAULT 0, `pgType`INT( 11 ) NOT NULL DEFAULT 1, `pgCapacity` INT( 11 ) NOT NULL DEFAULT 1 ); CREATE TABLE `garages` ( `gTypeID` INT( 11 ) NOT NULL PRIMARY KEY AUTO_INCREMENT, `gTypeName` VARCHAR( 255 ) NOT NULL DEFAULT 0, `gTypeCost` INT( 11 ) NOT NULL DEFAULT 3000 ); INSERT INTO `garages` VALUES ('', 'Driveway', 3000); Edited May 19, 2013 by Magictallguy Added garage SQL 3 Quote
Script47 Posted May 18, 2013 Posted May 18, 2013 Bloody hell your quick - I've always said it but this is ridiculous! xD 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.