26.08.2015, 12:54
Right... Back again.
I have a vehicle system that works perfectly for the most part, vehicle creation and everything is fine, and it always works without issue, it fills in any missing ID's on the Mysql database to make it 'neater' and easier to work with for tunings and such when I get around to it, but then, this was coded in:
Pardon any looks of bad indentation on there, that's just because I copy-pasted it in, it's indented fine in the editor.
The issue I'm having, is that it will save and unload every vehicle, except the first vehicle on the server, it never saves that one. I cannot figure out why, I'm doing everything right, since I'm testing with 3-10 vehicles all made in the same way, vehicle ID 2 through 10 are saved and destroyed when I log out since I own them, but vehicle ID 1 is never touched, and I can't figure out why.
Any help would be appreciated, thanks.
I have a vehicle system that works perfectly for the most part, vehicle creation and everything is fine, and it always works without issue, it fills in any missing ID's on the Mysql database to make it 'neater' and easier to work with for tunings and such when I get around to it, but then, this was coded in:
Код:
SavePlayerVehicles(playerid) { new index = 0; for(new i = 0; i < MAX_VEHICLES; i++) { if(vCreated[vInfo[i][vID]) { if(vInfo[i][vOwnerID] == pInfo[playerid][ID]) { mysql_format(mysql, query, sizeof(query), "UPDATE `vehdata` SET `vX`=%f, `vY`=%f, `vZ`=%f, `vA`=%f, `vCol1`=%d, `vCol2`=%d WHERE \ `vID`=%d", vInfo[i][vLoc][0], vInfo[i][vLoc][1], vInfo[i][vLoc][2], vInfo[i][vLoc][3], vInfo[i][vCol1], vInfo[i][vCol2], \ vInfo[i][vID]); mysql_tquery(mysql, query); printf("Vehicle ID %d (%d) saved and unloaded!", vInfo[i][vID], i); DestroyVehicle(vInfo[i][vCarID]); vCreated[vInfo[i][vID] = false; index ++; } } } printf("%d", index); }
The issue I'm having, is that it will save and unload every vehicle, except the first vehicle on the server, it never saves that one. I cannot figure out why, I'm doing everything right, since I'm testing with 3-10 vehicles all made in the same way, vehicle ID 2 through 10 are saved and destroyed when I log out since I own them, but vehicle ID 1 is never touched, and I can't figure out why.
Any help would be appreciated, thanks.