[Help] Respawning vehicles & Timers
#4

Quote:
Originally Posted by Misiur
Посмотреть сообщение
Nah, you don't beg for complete script so I'll be glad to help.

First of all, watch your braces ( https://sampwiki.blast.hk/wiki/Control_Structures#if )

pawn Код:
new bool:DropCooloff[MAX_PLAYERS char];
CMD:dropcar(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not in a vehicle!");
    if(DropCooloff{playerid}) return SendClientMessage(playerid, COLOR_RED, "15 minutes cooloff!");
    SetPlayerCheckpoint(playerid, -1697.0311,-92.7514,3.5544, 5.0);
    //IsPlayerInAnyVehicle(playerid) is redundant, as we've checked it on top of function
    return 1;
}
SuccessMission(playerid) {
    GivePlayerMoney(playerid, random(1000) + 657);
    SetVehicleToRespawn(playerid);
    DropCooloff{playerid} = true;
    SetTimerEx("Cooloff", 1000*60*15, 0, "i", playerid);
    SendClientMessage(playerid, COLOR_WHITE, "You dopped a car! You must now wait 15 minutes before doing this command again.");
    DisablePlayerCheckpoint(playerid);
}
forward Cooloff(playerid);
public Cooloff(playerid) {
    return (DropCooloff{playerid} = false);
}
public OnPlayerEnterCheckpoint(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 5, -1697.0311,-92.7514,3.5544))
    {
        if(IsPlayerInAnyVehicle(playerid)) {
            SuccessMission(playerid);
            SetVehicleToRespawn(GetPlayerVehicleID(playerid))
        }      
    }
    return 1;
}
#e: now with timer!
Thank you so much! Awesome
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)