Fetching vehicle MySQL ID from SAMP ID - 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: Fetching vehicle MySQL ID from SAMP ID (
/showthread.php?tid=405541)
Fetching vehicle MySQL ID from SAMP ID -
zDevon - 06.01.2013
Well since I couldn't get any help here
https://sampforum.blast.hk/showthread.php?tid=404159 I'm still trying to fix it on my own. No relief yet but I was hoping I could get some assistance on a different simple aspect of it.
pawn Код:
public OnVehicleSpawn(vehicleid)
{
new vid = VehicleInfo[vehicleid][vVehID];
new query[100];
format(query,sizeof(query),"SELECT * FROM vehicles WHERE VehicleID = '%i'",vid);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() != 0) {
printf("Spawning vehicle %i (sampid %i)",vid,vehicleid);
SetVehiclePos(vid,VehicleInfo[vid][vVehParkX],VehicleInfo[vid][vVehParkY],VehicleInfo[vid][vVehParkZ]);
SetVehicleZAngle(vid,VehicleInfo[vid][vVehParkA]);
}
mysql_free_result();
return 1;
}
'VehID' is the mysql id. With that code I'm trying to set vid equal to vehid, and then check if it exists. If it does, set vehicleid's position accordingly. Except, if the samp vehicle id and the mysql id don't match, the position is not set. If they're the same then everything works properly, but you can see how obvious of a problem that creates. Any ideas?
Re: Fetching vehicle MySQL ID from SAMP ID -
zDevon - 07.01.2013
It's been a number of days now without a reply, so I thought I should give another go at explaining the problem more clearly. And because the other was a jumbled mess, and since I think I've narrowed the problem down to a place different than as posted there.