[HELP]Vehicles Not Destroying
#4

Pretty simple, use vehicle callbacks for auto destroying and a player var to store vehicle id.
pawn Код:
new car[MAX_PLAYERS];

//for example you have the cmd bike
CMD:bike(playerid, params[])
{
      if(IsValidVehicle(car[playerid])) DestroyVehicle(car[playerid]);//destroy the previous veh if exist

      car[playerid] = CreateVehicle(...);//create the neŵ veh and store in car var
      return 1;
}
Now the vehicle will destroy if the player spawns a new one. Read the link in prevous post.

For destroying the vehicle after 5 minutes, we would not use timers, a smarter way is to utilize respawn_delay of a vehicle. Set it to 5 mins when creating a vehicle in the command.
https://sampwiki.blast.hk/wiki/CreateVehicle

pawn Код:
public OnVehicleSpawn(vehicleid)
{
      for(new i; i < MAX_PLAYERS; ++i)
      {
             if(IsPlayerConnected(i))
             {
                    if(car[i] == vehicleid)//if the car respawns after 5 mins of unuse
                    {
                            DestroyVehicle(car[i]);
                            break;
                     }
             }
      }
      return 1;
}
Now the vehicle will destroy after 5 mins if not used within that time period.
Reply


Messages In This Thread
[HELP]Vehicles Not Destroying - by fuckingcruse - 22.03.2015, 09:30
Re: [HELP]Vehicles Not Destroying - by Smileys - 22.03.2015, 09:37
Re: [HELP]Vehicles Not Destroying - by fuckingcruse - 22.03.2015, 09:41
Re: [HELP]Vehicles Not Destroying - by Gammix - 22.03.2015, 10:09
Re: [HELP]Vehicles Not Destroying - by fuckingcruse - 22.03.2015, 10:30
Re: [HELP]Vehicles Not Destroying - by fuckingcruse - 22.03.2015, 12:52

Forum Jump:


Users browsing this thread: 1 Guest(s)