SA-MP Forums Archive
Timers - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Timers (/showthread.php?tid=250327)



Timers - farmer1710 - 22.04.2011

How does this need to work?

When you go to x,y,z you type /plant which freezes you and it takes 60 seconds to plant a bomb.
When planted a Textdraw with a timer goes to all clients and it counts down from 35 seconds when reach 0 a
createexplosion happens. BUT if the bomb is /defuse the timers stop


Re: Timers - the_zande - 22.04.2011

pawn Code:
if(!strcmp(cmdtext, "/plant", true))(playerid,params[])
{
if(!IsPlayerInRangeOfPoint(playerid, x, y, z);
{
SetTimerEx() //put ur times and other shit on here
}
return 1;
}
Then u have to forward ur timer and add /defuse command D just simple KillTimer(timerid); but remember rangepoints and other shits Im not very sure but I think it works if u get it


Re: Timers - xir - 22.04.2011

Something like this?

You'll have to make the defuse CMD

pawn Code:
forward BombTimer(playerid);

COMMAND:plant(playerid, params[])
{
    new string[128], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    if(!IsPlayerInRangeOfPoint(playerid,range,X , Y , Z)) return SendClientMessage(playerid, -1, "You can't plant a bomb here !");
    TogglePlayerControllable(playerid, 0);
    format(string, 128, "%s has planted a bomb !", pName);
    SendClientMessageToAll(-1, string);
    SetTimerEx( "BombTimer", 60000, false, "i", playerid);
    return 1;
}


public BombTimer(playerid)
{
    CreateExplosion(...);
    SendClientMessageToAll(-1, "The planted bomb exploded before it got defused !");
    return 1;
}
Good luck!