13 changes: 10 additions & 3 deletions config.lua
Expand Up @@ -8,30 +8,37 @@ Config.EnableTestDrive = true
Config.PlateSpace = true -- enable / disable plate spaces (compatibility with esx 1.1?)
Config.SaveJob = true -- this config is to save the value to owned_vehicles.job column
Config.Licensed = false -- Enable Driver Licensed Checker
Config.DisplayCars = true -- enable display of cars
VehicleShop = {
['pdm'] = { -- same with name
name = "pdm", --LEGION
title = "PDM Vehicle Shop",
type = 'car',
job = 'all',
default_garage = 'Garage A',
Dist = 7, -- distance (DEPRECATED)
Dist = 3, -- distance (DEPRECATED)
Blip = {color = 38, sprite = 595, scale = 0.9},
shop_x = -35.469879150391,
shop_y = -1100.3621826172,
shop_z = 26.422359466553, -- coordinates for this garage
spawn_x = -32.283363342285,
spawn_y = -1091.0841064453,
spawn_z = 25.749485015869,
heading = 340.23065185547 -- Vehicle spawn location
heading = 340.23065185547, -- Vehicle spawn location,
displaycars = {
[1] = {label = 'Suprang Bagal', model = 'jester3', value = 100000, coord = vector4(-47.427722930908,-1101.3747558594,25.714616775513,341.64694213867)},
[2] = {label = 'Suprang Bagal', model = 'elegy', value = 1000000, coord = vector4(-44.736125946045,-1094.1976318359,25.748092651367,158.2547454834)},
[3] = {label = 'Suprang Bagal', model = 'adder', value = 1000000, coord = vector4(-40.32751083374,-1095.6105957031,26.009906768799,158.58676147461)},
[4] = {label = 'Suprang Bagal', model = 'ruston', value = 1000000, coord = vector4(-43.318450927734,-1102.1627197266,25.758722305298,340.29724121094)},
}
},

['Police Vehicle Shop'] = { -- same with name
name = "Police Vehicle Shop", --MRPD police shop
job = 'police',
type = 'car',
default_garage = 'Police Garage',
Dist = 7, -- distance (DEPRECATED)
Dist = 3, -- distance (DEPRECATED)
Blip = {color = 38, sprite = 662, scale = 0.9},
shop_x = 456.89453125,
shop_y = -1020.8922729492,
Expand Down
104 changes: 104 additions & 0 deletions html/design.css
Expand Up @@ -1370,4 +1370,108 @@ input[type="radio"]{
#option-1:checked:checked ~ .option-1 span,
#option-2:checked:checked ~ .option-2 span{
color: #fff;
}

.wrap{
max-width: 40vw;
margin: 0 auto;
position: relative;
padding: 0 20px;
height: 315px;
background: #080808e0;
border-radius: 20px;
margin-top: 70px;
margin-left: 100px;
color: #d8d6d6;
font-size: 12px;
font-family: revert;
font-weight: 100;
}
.section-title h1{
margin: 0;
line-height: 50px;
letter-spacing: 5px;
font-weight: 600;
color: white;
}.border{
display: block;
height: 10px;
margin-bottom: 10px;
width: 100%;
background: #5aff67;
}
.row{
/* width: 47%; */
min-height: 1px;
float: left;
position: relative;
display: inline-block;
}
#perfrow {
width: 47%;
min-height: 1px;
float: left;
position: relative;
display: inline-block;
}
.row ul {
margin: 0 20px 0 0 !important;
text-align: left !important;
padding: 0;
}.row ul li{
list-style: none !important;

}.row ul li em{
display: block;
margin-bottom: 5px;
color: #8ca2a1;
}.row ul li div{
margin-bottom: 11px;
border-radius: 3px 3px 3px 3px;
-webkit-border-radius: 3px 3px 3px 3px;
background: #09131B;
height: 15px;
overflow: hidden;
border-radius: 7px;
}.row ul li div span{
height: 15px;
width: 50%;
display: block;
border-radius: 3px 3px 3px 3px;
-webkit-border-radius: 3px 3px 3px 3px;
}
.row ul li.perf div span {background: #3498db;width: 90%;}
.turbo div span {background: #3498db;width: 90%;}
.animated {
-webkit-animation-duration: 1s;
animation-duration: 1s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}.fadeInLeft {
-webkit-animation-name: fadeInLeft;
animation-name: fadeInLeft;
}
@-webkit-keyframes fadeInLeft {
0% {
opacity: 0;
-webkit-transform: translate3d(-100%, 0, 0);
transform: translate3d(-100%, 0, 0);
}100% {
opacity: 1;
-webkit-transform: none;
transform: none;
}
}
@keyframes fadeInLeft {
0% {
opacity: 0;
-webkit-transform: translate3d(-100%, 0, 0);
-ms-transform: translate3d(-100%, 0, 0);
transform: translate3d(-100%, 0, 0);
}100% {
opacity: 1;
-webkit-transform: none;
-ms-transform: none;
transform: none;
}
}
111 changes: 97 additions & 14 deletions html/index.html
@@ -1,21 +1,104 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Renzu Vehicle Garage</title>
<script src="https://kit.fontawesome.com/eb73bbb7e4.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="design.css">
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css'>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js'></script>
<link rel="stylesheet" type="text/css" href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Renzu Vehicle Garage</title>
<script src="https://kit.fontawesome.com/eb73bbb7e4.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="design.css">
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css'>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js'></script>
<link rel="stylesheet" type="text/css" href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
</head>

<body>
<div id="garage"></div>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script src="script.js"></script>
<div id="garage"></div>
<div class="wrap" style="display: none;" id="perf">
<div class="section-title wow fadeInUp">
<h1>
<span id="name">Jester Classic</span> - <span id="class">Sports</span>
</h1>
<h3 style="float: right;position: absolute;right: 6%;top: 5%;font-size: 20px;">Value: $ <span id="turbo" style="color:lime;">10000</span>
</h3>
<span class="border"></span>
</div>
<article id="perfrow" class="row" style="
width: 70%;
">
<h4 style="margin: 5px;margin-bottom: 10px;">Vehicle Performance</h4>
<ul>
<li class="perf">
<em>Top Speed</em>
<div>
<span class="animated fadeInLeft" id="topspeed" style="width: 67.6667%;"></span>
</div>
</li>
<li class="perf">
<em>Acceleration</em>
<div>
<span class="animated fadeInLeft" id="acceleration" style="width: 48%;"></span>
</div>
</li>
<li class="perf">
<em>Traction</em>
<div>
<span class="animated fadeInLeft" id="traction" style="width: 65.2625%;"></span>
</div>
</li>
<li class="perf">
<em>Brakes</em>
<div>
<span class="animated fadeInLeft" id="brakes" style="width: 76%;"></span>
</div>
</li>
</ul>
</article>
<article class="row" id="perfrow" style="
width: 28%;
">
<h4 style="margin: 11px;margin-bottom: 10px;">Vehicle Info</h4>
<ul>
<li class="perf" style="
padding: 10px;
">
<em style="
margin-bottom: 10px;
">
<b style="color:#fff">Seat Capacity</b> : <span id="seat"></span>
</em>
</li>
<li class="perf" style="
padding: 10px;
">
<em style="
margin-bottom: 10px;
">
<b style="color:#fff">Vehicle Weight</b> : <span id="weight"></span> kg </em>
</li>
<li class="perf" style="
padding: 10px;
">
<em style="
margin-bottom: 10px;
">
<b style="color:#fff">Drivetrain</b> : <span id="drivetrain">FWD</span>
</em>
</li>
<li class="perf" style="
padding: 10px;
">
<em style="
margin-bottom: 10px;
">
<b style="color:#fff">Number of Gears</b> : <span id="gear">6</span>
</em>
</li>
</ul>
</article>
<div style="text-align: center; position: absolute; bottom: 4%; right: 40%; display: block;" id="seemod">Press [E] to Purchase this Vehicle</div>
</div>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script src="script.js"></script>
</body>
</html>
22 changes: 20 additions & 2 deletions html/script.js
Expand Up @@ -86,6 +86,24 @@ window.addEventListener('message', function(event) {
}
}
}
if (event.data.type == "stats") {
if (event.data.show) {
document.getElementById("perf").style.display = 'block';
if (!event.data.public) {
document.getElementById("seemod").style.display = 'block';
}
for(var [k,v] of Object.entries(event.data.perf)){
if (k =='name' || k =='plate' || k =='turbo' || k =='seat' || k =='gear' || k =='drivetrain' || k =='weight') {
document.getElementById(k).innerHTML = v;
} else {
document.getElementById(k).style.width = ''+v+'%';
}
}
} else {
document.getElementById("perf").style.display = 'none';
document.getElementById("seemod").style.display = 'none';
}
}
if (event.data.chopper) {
chopper = true
}
Expand All @@ -100,7 +118,7 @@ window.addEventListener('message', function(event) {
currentcar = undefined;
VehicleArr = [];
CurrentVehicle = [];
$("body").fadeIn();
$("#garage").fadeIn();
for(var [key,value] of Object.entries(data.data)){
for(var [k,v] of Object.entries(value)){
VehicleArr.push(v);
Expand All @@ -111,7 +129,7 @@ window.addEventListener('message', function(event) {
}

if (event.data.type == "hide") {
$("body").fadeOut();
$("#garage").fadeOut();
}

if (event.data.type == "notify") {
Expand Down
23 changes: 16 additions & 7 deletions server/server.lua
Expand Up @@ -159,7 +159,7 @@ ESX.RegisterServerCallback('renzu_vehicleshop:GenPlate', function (source, cb)
--plate = veh(tonumber(#result))..GetRandomNumber(total)
plate = plate:gsub("=", "")
end
--print(plate,plate:len())
print(plate,plate:len())
cb(plate:upper())
end)
else
Expand All @@ -177,7 +177,7 @@ ESX.RegisterServerCallback('renzu_vehicleshop:GenPlate', function (source, cb)
end
end)

ESX.RegisterServerCallback('renzu_vehicleshop:buyvehicle', function (source, cb, model, props, payment, job, type, garage)
ESX.RegisterServerCallback('renzu_vehicleshop:buyvehicle', function (source, cb, model, props, payment, job, type, garage, notregister)
print("BUYING START")
local source = source
local xPlayer = ESX.GetPlayerFromId(source)
Expand All @@ -201,9 +201,11 @@ ESX.RegisterServerCallback('renzu_vehicleshop:buyvehicle', function (source, cb,
end
end
--print(type)
if not job and type == 'car' then
if not job and type == 'car' and not notregister then
print("BUYING VEHICLES SAVED FROM SQL vehicles tables")
sqlfunc(Config.Mysql,'SELECT * FROM vehicles WHERE model = @model LIMIT 1')
elseif notregister then
cb(Buy(true,xPlayer,model, props, payment, job, type or 'car' , garage or false, notregister))
else
print("BUYING CUSTOM CARS FROM CONFIG SHOP")
for k,v in pairs(VehicleShop) do
Expand Down Expand Up @@ -243,15 +245,22 @@ ESX.RegisterServerCallback('renzu_vehicleshop:buyvehicle', function (source, cb,
end
end)

function Buy(result,xPlayer,model, props, payment, job, type, garage)
function Buy(result,xPlayer,model, props, payment, job, type, garage, notregister)
fetchdone = false
bool = false
print(" FUNCTION BUY")
if result then
print("RESULT FETCHED")
local model = result[1].model
local price = result[1].price
local stock = result[1].stock
local model = nil
local price = nil
local stock = nil
if not notregister then
model = result[1].model
price = result[1].price
else
model = model
price = notregister.value
end
local payment = payment
if payment == 'cash' then
money = xPlayer.getMoney() >= tonumber(price)
Expand Down