Hi, i change this script to working fine with tunning.(Sorry for my English)
Explaining, the script the way the friend posted deletes the vehicle from the vrp_user_vehicles
table, so it also clears the tuning.
I made some changes so this does not happen, I added a new column in the vrp_user_vehicles
table called veh_confiscate
where 0 is not confiscated and 1 is confiscated. and put one more condition to show vehicles in garage of user.
First you need to change the table of vrp_user_vehicles
, i add one new column called veh_confiscate where 1 is confiscated and 0 is not confiscated. Execute this SQL in your database:
ALTER TABLE vrp_user_vehicles ADD IF NOT EXISTS veh_confiscate TINYINT NOT NULL DEFAULT 0;
Go to vrp_confiscate/server.lua and change this lines:
1. OLD:
MySQL.createCommand("vRP/ples_confVeh", [[
DELETE FROM `vrp_user_vehicles` WHERE `user_id`=@u_id AND `vehicle`=@modelX;
INSERT IGNORE INTO `vrp_confiscate` (`user_id`, `vehicle`, `cop`) VALUES (@u_id, @modelX, @cop);
]])
1. CHANGE FOR:
MySQL.createCommand("vRP/ples_confVeh", [[
UPDATE vrp_user_vehicles SET veh_confiscate = 1 WHERE `user_id`=@u_id AND `vehicle`=@modelX;
INSERT IGNORE INTO `vrp_confiscate` (`user_id`, `vehicle`, `cop`) VALUES (@u_id, @modelX, @cop);
]])
2. OLD:
MySQL.createCommand("vRP/ples_stergConf", "DELETE FROM vrp_confiscate WHERE user_id = @user_id AND vehicle = @model")
2. CHANGE FOR:
MySQL.createCommand("vRP/ples_stergConf", [[
UPDATE vrp_user_vehicles SET veh_confiscate = 0 WHERE `user_id`=@user_id AND `vehicle`=@model;
DELETE FROM vrp_confiscate WHERE user_id = @user_id AND vehicle = @model
]])
3. OLD:
if vRP.tryFullPayment({user_id, pret}) then
TriggerEvent('veh_SR:CheckMoneyForBasicVeh', user_id, v.vehicle, pret, "car")
vRPclient.notify(playerx, {"You paid the fines to recover the car.\nGo to a garage to use it."})
local model = v.vehicle
MySQL.execute("vRP/ples_stergConf", {user_id = user_id, model = model})
else
vRPclient.notify(playerx, {"~r~Sem dinheiro o suficiente."})
end
3. CHANGE FOR:
if vRP.tryFullPayment({user_id, pret}) then
local model = v.vehicle
MySQL.execute("vRP/ples_stergConf", {user_id = user_id, model = model})
vRPclient.notify(playerx, {"Você pagou a multa e recuperou seu carro.\nEle está disponivel na garagem."})
vRP.closeMenu({playerx})
else
vRPclient.notify(playerx, {"~r~Sem dinheiro o suficiente."})
end
Now you need to put one where clause in select of vehicles in garage from user. In my case i use vrp_garages
, so i change this line:
OLD
MySQL.createCommand("vRP/ply_get_vehicles","SELECT * FROM vrp_user_vehicles WHERE user_id = @user_id")
CHANGE FOR:
MySQL.createCommand("vRP/ply_get_vehicles","SELECT * FROM vrp_user_vehicles WHERE user_id = @user_id AND veh_confiscate = 0")
Now her select all vehicles of player where veh_confiscate is 0(Not confiscated)