SA-MP Forums Archive
IsVehicleSpawned - 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: IsVehicleSpawned (/showthread.php?tid=344301)



IsVehicleSpawned - iGetty - 20.05.2012

Is it possible to make a function to check if a vehicle is spawned or not?

I'm trying to create a fuel script and I want to set the spawned vehicles fuel to 100% ongamemodeinit,

I have

pawn Код:
public OnGameModeInit()
{
    for(new i = 0; i < MAX_VEHICLES; i++)
    {
        print("Vehicle %d fuel set to 100%%");
        VehicleFuel[i] = 100;
    }
    return 1;
}
Is it possible?

Thanks!

I want


pawn Код:
public OnGameModeInit()
{
    for(new i = 0; i < MAX_VEHICLES; i++)
    {
        if(IsVehicleSpawned(i))
        {
            print("All fuel set to 100%%");
            VehicleFuel[i] = 100;
        }
    }
    return 1;
}



Re: IsVehicleSpawned - Jonny5 - 20.05.2012

none of them will be spawned untill someone connects!
not needed just use the first way.

regards.


Re: IsVehicleSpawned - nmader - 20.05.2012

I do not believe there is an already existent function for such, although you could probably easily make one if you know what you are doing.


Re: IsVehicleSpawned - [FMJ]PowerSurge - 20.05.2012

pawn Код:
stock DoesVehicleExist(vehicleid)
{
    if(GetVehicleModel(vehicleid) > 0) return 1;
    else return 0;
}
That should work fine.