SA-MP Forums Archive
MySQL Car System no saving. - 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: MySQL Car System no saving. (/showthread.php?tid=558753)



MySQL Car System no saving. - Lynn - 18.01.2015

So I'm still trying to create a SQL Car system, and it's just not saving to the Database.
It has to be connecting to the database because my player accounts load fine.
However, for some reason my vehicle system refuses to work.
It creates the vehicle in-game using the command, but doesn't save it after words.
I turned the server off to call OnGameModeExit and it didn't save then either.

Code:
http://pastebin.com/B3Er3J6H

MySQL Log:
http://pastebin.com/qfmb6w4k


Re: MySQL Car System no saving. - CoaPsyFactor - 18.01.2015

as you can see, you have invalid connection handle error, it looks like you are trying to run query on non existing connection. Show us you mysql_connect


Re: MySQL Car System no saving. - Lynn - 19.01.2015

My Player Accounts load, so it has to be connecting.
Otherwise, they wouldn't load either as their connected from the same database.


Re: MySQL Car System no saving. - CoaPsyFactor - 19.01.2015

well problem is in enum, you have MainPipeline defined in there, so it override you variable that holds mysql connection id - as I don't see mysql_connect in this part of code


Re: MySQL Car System no saving. - BroZeus - 19.01.2015

And use this SaveVehicle stock
pawn Code:
SaveVehicles()
{      
        for(new v = 0; v < MAX_VEHICLES; v++)if(IsValidVehicle(v)) SaveVehicle(v);
}
You forgot to write IsValidVehicle(v)
If u don't do this then it will save 2000 vehicles in database with coords 0.0 0.0 0.0 and thus will load 2000 vehicles at those coords
And if there is any other command for creating vehicle or you create vehicle with AddStaticVehicle OnGameModeInit OR if u create vehicle using a FS then this system will bug, this system is only valid if u create cars using createveh command


Re: MySQL Car System no saving. - CoaPsyFactor - 19.01.2015

So, did you fixed it?