SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 15/12/2019, 05:02 PM   #1
EAGLE
Little Clucker
 
Join Date: Nov 2019
Posts: 18
Reputation: 0
Default Reload vehicle sql

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
EAGLE is offline   Reply With Quote
Old 15/12/2019, 06:29 PM   #2
CXdur
Big Clucker
 
CXdur's Avatar
 
Join Date: Jun 2014
Location: Norway
Posts: 57
Reputation: 6
Default Re: Reload vehicle sql

Quote:
Originally Posted by EAGLE View Post
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?
CXdur is offline   Reply With Quote
Old 15/12/2019, 06:32 PM   #3
EAGLE
Little Clucker
 
Join Date: Nov 2019
Posts: 18
Reputation: 0
Default Re: Reload vehicle sql

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
EAGLE is offline   Reply With Quote
Old 15/12/2019, 06:55 PM   #4
CXdur
Big Clucker
 
CXdur's Avatar
 
Join Date: Jun 2014
Location: Norway
Posts: 57
Reputation: 6
Default Re: Reload vehicle sql

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.
CXdur is offline   Reply With Quote
Old 15/12/2019, 07:25 PM   #5
EAGLE
Little Clucker
 
Join Date: Nov 2019
Posts: 18
Reputation: 0
Default Re: Reload vehicle sql

Ok nice, fixed, thank you so much, I have deleted vID and add INVALID_VEHICLE for create, its ok
EAGLE is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
No reload gun Jaua10 Scripting Help 5 11/07/2018 05:03 PM
Reload a vehicle doesn't work justjamie Scripting Help 2 26/07/2016 10:01 AM
Vehicle doesn't reload justjamie Scripting Help 0 25/07/2016 10:51 AM
How to reload a vehicle? SlonCHL Scripting Help 2 30/11/2013 10:15 AM
Reload .sav captainjohn Server Support 3 26/02/2011 08:11 PM


All times are GMT. The time now is 12:43 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.