Reload vehicle sql -
EAGLE - 15.12.2019
Hello, when I use my command "/v stats" on my vehicle create with "/v add" I don't have a return with stats.
But when I reboot my server, "/v stats" is work
I think I have a problem with reload vehicle after create a new vehicle, but I don't know how make
And if I need to reboot my server every time I create a new vehicle, it's annoying
Create Vehicle function
https://pastebin.com/C94RCQHZ
Re: Reload vehicle sql -
CXdur - 15.12.2019
Quote:
Originally Posted by EAGLE
Hello, when I use my command "/v stats" on my vehicle create with "/v add" I don't have a return with stats.
But when I reboot my server, "/v stats" is work
I think I have a problem with reload vehicle after create a new vehicle, but I don't know how make
And if I need to reboot my server every time I create a new vehicle, it's annoying
Create Vehicle function
https://pastebin.com/C94RCQHZ
|
So if I understand correctly, there's only an issue when an admin spawns a vehicle with some sort of command? Players have no issues with vehicles themselves because they cannot spawn it? If I misunderstand, please explain!
It would be helpful with some code of what /v stats look like. It would also be nice to see the lines from where callback SQL_CallVehicleCreate(playerid, model, Float
, Float:y, Float:z, Float:a, color1, color2) is called from.
The thing is, we can't really know how you retrieve the /v stats. Is it fetched from the DB directly when you do /vstats, or have you already fetched the data to memory?
Re: Reload vehicle sql -
EAGLE - 15.12.2019
Yes, it's like the vehicle doesn't exist on the server, until I reboot
I have my house system, and it works correctly, when I create a new house, I can check its information, buy it, sell it, I can interact with it, while vehicles not, I have to reboot to be able to interact with them
I have copy a same code for my vehicle system
Load Vehicles:
https://pastebin.com/9tRnCR5s
Commands:
https://pastebin.com/69xn7DcJ
Re: Reload vehicle sql -
CXdur - 15.12.2019
How come you access the vehicle info array with vInfo[vehicleId]][], but you also have vId? I think you could stick with just the vehicle ID for its inde, and get rid of the vInfo[vid][vID]?
Code:
new vehicleid = GetPlayerVehicleID(playerid);
vInfo[vehicleid][vPlaque]
Also, why are you looping through the max vehicles? I believe the issue is that when the vehicle is spawned, it might get a different vehicle ID from what you've used.
Code:
new vehicle = CreateVehicle(model, x, y, z, a, color1, color2, -1);
if (vehicle != INVALID_VEHICLE_ID)
{
vInfo[vehicle][vDbId] = id;
vInfo[vehicle][vLocked] = false;
// set variables
You can apply this to Chargement_Vehicules as well. Only start changing the car data once you have spawned the vehicle, to ensure that you always have the correct vehicle id as your vInfo index.
Re: Reload vehicle sql -
EAGLE - 15.12.2019
Ok nice, fixed, thank you so much, I have deleted vID and add INVALID_VEHICLE for create, its ok