[Help] Respawning vehicles & Timers
#1

Hello everyone. Today I created a command called /dropcar. Which, creates a checkpoint at a certain location if you are in a vehicle. You drive to this location, and you get a random amount of money. Seems simple. However, I can not for the life of me get the vehicle to respawn after the player has entered the checkpoint.

Код:
CMD:dropcar(playerid, params[])
{
    {
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not in a vehicle!");
    SetPlayerCheckpoint(playerid, -1697.0311,-92.7514,3.5544, 5.0);
    }

    if (IsPlayerInCheckpoint(playerid))
    {
    if(IsPlayerInAnyVehicle(playerid))
    GivePlayerMoney(playerid, random(1000) + 657);
    SetVehicleToRespawn(playerid);
    SendClientMessage(playerid, COLOR_WHITE, "You dopped a car! You must now wait 15 minutes before doing this command again.");
    }
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 5, -1697.0311,-92.7514,3.5544))
     {
       if(IsPlayerInAnyVehicle(playerid))
          {
          GivePlayerMoney(playerid, random(1000) + 657);
          SendClientMessage(playerid, COLOR_WHITE, "You dopped a car! You must now wait 15 minutes before doing this command again.");
          DisablePlayerCheckpoint(playerid);
          }
       new vehicleid;
       if(IsPlayerInVehicle(playerid, vehicleid))
       {
          SetVehicleToRespawn(vehicleid);
          }
          
       }
	return 1;
}
(It looks like the indentation went a little bit off when I pasted it, sorry.)

ALSO:

If someone could tell me how to put a 15 second time limit between successful uses of the command, that would be awesome.

(I am a PAWN noob so please do not get angry if I am a little off.
Reply


Messages In This Thread
[Help] Respawning vehicles & Timers - by xXRealLegitXx - 18.03.2013, 19:35
Re: [Help] Respawning vehicles & Timers - by Misiur - 18.03.2013, 19:43
Re: [Help] Respawning vehicles & Timers - by xXRealLegitXx - 18.03.2013, 19:47
Re: [Help] Respawning vehicles & Timers - by xXRealLegitXx - 18.03.2013, 19:52

Forum Jump:


Users browsing this thread: 1 Guest(s)