Vehicles won't spawn at stock
#1

So, I got this stock function which will load cars, and if the vehicle belongs to a faction, it will spawn it.
The complie gives 0 errors but when I start it up, it wont spawn vehicles, I have checked that the stock works and it gets the correct values.

pawn Код:
stock SpawnVehicles()
{
    new query[1500];
    print("Started vehicle loading!");
    for(new id; id < MAX_CARS; id++)
    {
        format(query, sizeof(query), "SELECT vModel, vCol1, vCol2, vOwner, vPlate, vPosX, vPosY, vPosZ, Faction FROM vehicles WHERE SQLID = '%d'", id);
        mysql_query(query);
        mysql_store_result();
        if(mysql_num_rows())
        if(mysql_fetch_row_format(query, "|"))
        {
            sscanf(query,"p<|>ddds[64]s[32]fffd",

                VehicleInfo[id][vModel],
                VehicleInfo[id][vCol1],
                VehicleInfo[id][vCol2],
                VehicleInfo[id][vOwner],
                VehicleInfo[id][vPlate],
                VehicleInfo[id][vPosX],
                VehicleInfo[id][vPosY],
                VehicleInfo[id][vPosZ],
                VehicleInfo[id][Faction]);
            Total_Vehicles_Created++;
       
        }
        if(VehicleInfo[id][Faction] > 0)
        {
            VehicleInfo[id][vID] = CreateVehicle(VehicleInfo[id][vModel], VehicleInfo[id][vPosX], VehicleInfo[id][vPosY], VehicleInfo[id][vPosZ], 0, VehicleInfo[id][vCol1], VehicleInfo[id][vCol2], 1);
        }
    }
    mysql_free_result();
    printf("> %d Vehicles have been loaded from the database", Total_Vehicles_Created);
    return 1;
}
Reply
#2

Try to set a high number on respawn delay because you have just 1;
and check if VehicleInfo[id][Faction] is taking a value higher than 0:
Reply
#3

I switched the if
from
pawn Код:
if(VehicleInfo[id][Faction] > 0)
to
pawn Код:
if(VehicleInfo[id][Faction] != 0)
And increased the spawn delay to 60 but it still doesn't want to function.
Reply
#4

Try to replace :

Quote:

if(mysql_fetch_row_format(query, "|"))

with

Quote:

if(mysql_fetch_row_format(query))

I'm not good on SQL but I search on internet to help you i hope that fix your problem
Reply
#5

That doesn't relly do the trick.
Reply
#6

bumping this
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)