30.09.2012, 16:51
(
Последний раз редактировалось sl!x; 02.10.2012 в 15:50.
)
Can anyone add a timer to this command because i am new at scripting and dont how to do it
forward inf2(playerid);//this will be the timer (public) new inf[MAX_PLAYERS];//this is related to the timer for the player new blabla[ MAX_PLAYERS ];//and this will be usefull to defind when a player can use the CMD again
blabla[ playerid ] = 0;// 0 is when the player can use the CMD, 1 is when he can't
if(!strcmp(cmdtext,"/sniper",true, 6))
{
if( blabla[ playerid ] == 1)return GameTextForPlayer(playerid, "~w~You can't use this Command for now", 3000, 4);
inf[playerid] = SetTimerEx("inf2", 60000, false, "i", playerid);// start the timer for the player !
blabla[ playerid ] = 1;//The player is using /sniper cmd, so he can't use it again for 1min
//add what u want like resetplayerweaons, giveplayerweapon ects ...
}
public inf2(playerid)
{
if( blabla[ playerid ] == 1)
{
blabla[ playerid ] = 0;// 1min is passed so now he can use /sniper again
GameTextForPlayer(playerid, "~w~You can use /sniper again", 3000, 4);
KillTimer(inf[playerid]);//kill the timer for the player
}
return 1;
}