05.11.2012, 18:22
Do something like this:
You have to edit certain things, but that's a basic example.
pawn Код:
new CountDown[MAX_PLAYERS];
new PlayerTimer[MAX_PLAYERS];
new CanUseMissle[MAX_PLAYERS];
CanUseMissle[MAX_PLAYERS] = 0;
CountDown[playerid] = 5;
PlayerTimer[playerid] = SetTimerEx("ExecuteCommand", 1000, true, "i", playerid);
forward ExecuteCommand(playerid);
public ExecuteCommand(playerid)
{
CountDown[playerid] --;
if(CountDown[playerid] == 0)
{
KillTimer(PlayerTimer[playerid]);
CanUseMissle[playerid] = 1;
return 1;
}
else
new str[20];
format(str, sizeof str, "%i second(s) left", CountDown[playerid]);
GameTextForPlayer(playerid, str, 1000, 3);
}
return 1;
}
CMD:fire(playerid, params[])
{
SetTimerEx("ExecuteCommand", 1000, true, "i", playerid);
SendClientMessage(playerid, -1, "You have started to arm the missle.");
return 1;
}
CMD:missle(playerid, params[])
{
if(CanUseMissle[playerid] == 0)
{
SendClientMessage(playerid, -1, "You need to use the command /fire first.");
}
else if(CanUseMissle[playerid] == 1)
{
// Your missle command stuff
SendClientMessage(playerid, -1, "You have fired a missle!");
CanUseMissle[playerid] = 0;
}
return 1;
}