SA-MP Forums Archive
Vehicles won't spawn at stock - 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: Vehicles won't spawn at stock (/showthread.php?tid=484815)



Vehicles won't spawn at stock - FalconWingsX - 01.01.2014

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;
}



Re : Vehicles won't spawn at stock - FilesMAker - 01.01.2014

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:


Re: Re : Vehicles won't spawn at stock - FalconWingsX - 01.01.2014

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.


Re : Vehicles won't spawn at stock - FilesMAker - 01.01.2014

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


Re: Vehicles won't spawn at stock - FalconWingsX - 01.01.2014

That doesn't relly do the trick.


Re: Vehicles won't spawn at stock - FalconWingsX - 03.01.2014

bumping this