Anti unoccupied vehicle teleport
#1

Hello everybody. I want to make protection against unoccupied vehicle teleport, but I don't realy know how to make it, only I know that I need onunoccupiedvehicleupdate callback. In this video is shown this protection: [ame]http://www.youtube.com/watch?v=nYN69GRp5qs[/ame]

Who can give me code or explain something about that?
Reply
#2

pawn Код:
//the function
COMMAND:cleanv(playerid, params[])
{
new TotalVeh=0;
for(new vehicles=0; vehicles < MAX_VEHICLES; vehicles++)
{
    if(IsAnyPlayerInVehicle(vehicles)==0)
    {
        DestroyVehicle(vehicles);
        TotalVeh++;
    }
printf("%d Vehicles Cleaned!",TotalVeh);//you can change it to return the msg to the player
}
return 1;
}
//The stock
stock IsAnyPlayerInVehicle(vehicleid)
{
for(new playerids=0; playerids < MAX_PLAYERS; playerids++)
{
    if(IsPlayerInVehicle(playerids, vehicleid)==1) return true;
    else return false;
}
return false;
}
This will remove any vehicle without a driver!
NOTE: this can be done better, but this is for a example.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)