Vehicle positions
#1

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]) ;
Reply
#2

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)