SA-MP Forums Archive
Very confusing error - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Very confusing error (/showthread.php?tid=196455)



Very confusing error - iTorran - 05.12.2010

Hello,

I seem to have hit a very confusing problem,
I have a function from a tutorial that loads cars from mysql,

pawn Код:
stock LoadVehicles()
{
    for(new id; id < SCRIPT_CARS; id++)
    {
        format(Query, sizeof(Query), "SELECT * FROM vehicles WHERE VehID = %d", id);
        mysql_query(Query);
        mysql_store_result();
        if(mysql_num_rows())
        if(mysql_fetch_row(Query,"|"))
        {
            sscanf(Query, "p<|>e<is[24]is[128]ffff>", VehicleInfo[id]);
            CreateVehicle(VehicleInfo[id][Model], VehicleInfo[id][Pos][0], VehicleInfo[id][Pos][1], VehicleInfo[id][Pos][2], VehicleInfo[id][Pos][3], 1, 1, -1);
        }
    }
}
And it creates the vehicle alright, So that means its getting all the info and creating the vehicle,
But when i get in the vehicle that has someone elses name assigned to it, It didnt kick me out which it should of,
So i made a little debug and i found out that all of the model, owner, etc are empty,
Why? And how if it made the vehicle?

Heres the debug i made:
The 1st debug you see is from a spawned vehicle, So that should be like that,
But the last 2 are from MySQL which shouldnt be like that,

PICTURE ATTACHED,

pawn Код:
enum vInfo
{
    VehID,
    Owner[24],
    Model,
    Vehicle[128],
    Float:Pos[4]
}