SA-MP Forums Archive
Vehicle positions - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Vehicle positions (/showthread.php?tid=665839)



Vehicle positions - TMapping - 18.04.2019

Hello, when I try to log off save one position on the whole car I have.



https://pastebin.com/Sh5Gf1j8

#define MAX_OWNED_VEHICLES 5
new playerCar[MAX_PLAYERS][MAX_OWNED_VEHICLES];

Using:

OnGameModeExit

savePlayerCar ( p, playerCar[p][0]) ;
savePlayerCar ( p, playerCar[p][1]) ;

OnPlayerDisconnect

savePlayerCar ( playerid, playerCar[playerid][0]) ;
savePlayerCar ( playerid, playerCar[playerid][1]) ;


Re: Vehicle positions - AdamsLT - 18.04.2019

Your SQL query saves the data for ALL vehicles, that are owned by player named XXX_YYY

Specifically this part:
Code:
WHERE owner = '%s'" ,
Your vehicles need a unique identifier and you need to use that id to save them, not the owner.
I see you already have a column "id" so use it.

Code:
WHERE id = '%i'" ,
And for %i pass the id of the vehicle in the database.
That way only that specific vehicle will be saved.