Jump to content
MakeWebGames

Recommended Posts

Posted

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.

Posted

@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 :).

Posted
[...]- 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..)

Posted

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.

Posted (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 by Magictallguy
Added car cost
Posted (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 by Magictallguy
Added staff links, added car cost
Posted

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 ;)

Posted (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 by Magictallguy
Added quote and response
Posted
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 ;)

Posted (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 by Magictallguy
Added garage SQL
  • Like 3

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...