How do I ask pawno to check if there's a driver?
#1

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.
Reply
#2

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

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.
Reply
#4

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
Reply
#5

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)