SA-MP Forums Archive
How do I ask pawno to check if there's a driver? - 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: How do I ask pawno to check if there's a driver? (/showthread.php?tid=90689)



How do I ask pawno to check if there's a driver? - ThePS3Guy - 09.08.2009

Because here is my original code:


public OnPlayerExitVehicle(playerid, vehicleid)
{
SetTimerEx("cardestroy",5000,0,"i",vehicleid);
return 1;
}


And I would like for it to count down the 5 seconds, then check if someone is in the car. and if someone is in the car, not to destroy it.


Re: How do I ask pawno to check if there's a driver? - Martin_White - 09.08.2009

Didn't got what you mean, can you explain more?



Re: How do I ask pawno to check if there's a driver? - ThePS3Guy - 09.08.2009

In my bit of code there, I made it so that when someone gets out of their car, 5 seconds later it is reset to its spawn point. But what I am trying to figure out is how to make it so that after the 5 seconds, it checks if there's a driver (like if someone got back in the car) and if there is, it doesn't reset the car back to its spawn point.


Re: How do I ask pawno to check if there's a driver? - woot - 09.08.2009

pawn Код:
for(new i=0; i<MAX_VEHICLES; i++)
    {
        for(new pl = 0; pl<MAX_PLAYERS; pl++)
        {
            if(IsPlayerConnected(pl))
            {
                if(!IsPlayerInVehicle(pl, i))
                {
                    SetVehicleToRespawn(i);
                }
            }
        }
    }
untested


Re: How do I ask pawno to check if there's a driver? - Zeromanster - 09.08.2009

Quote:
Originally Posted by ThePS3Guy
gets out of their car, 5 seconds later it is reset to its spawn point.
Just use AddStaticVehicleEx, you don't need a timer for this. It's all in the function