Fetching vehicle MySQL ID from SAMP ID
#1

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?
Reply
#2

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


Forum Jump:


Users browsing this thread: 1 Guest(s)