04.03.2011, 10:13
how can i make a /cd [Time in seconds] command?
add me in msn pyrokar@libero.it i help you !
|
add me in msn pyrokar@libero.it i help you !
|
if(strcmp(cmd, "/heal", true) == 0) {
new tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOUR_ORANGE, "Usage : /heal [playerid]");
return 1;
}
new victim;
victim = strval(tmp);
new string[128];
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
new playername2[MAX_PLAYER_NAME];
GetPlayerName(victim, playername2, sizeof(playername2));
format(string, sizeof(string), "%s healed you.", playername);
SendClientMessage(victim, COLOUR_YELLOW, string);
SetPlayerHealth(victim, 100);
format(string, sizeof(string), "You healed %s.", playername2);
SendClientMessage(playerid, COLOUR_YELLOW, string);
return 1;
}
new Timer;//this one up of all
new C=0;//this one up of all
if(strcmp(cmd, "/cd", true) == 0)//this in onplayercommandtext
{
new tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOUR_ORANGE, "Usage : /cd [Time in seconds]");
return 1;
}
new time;
time = strval(tmp);
Timer = SetTimer("CountDown",1000,1);
C=time+1;
return 1;
}
forward CD(time);//this where u want not in other callbacks
public CD(time)
{
new string[128];
C--;
format(string,sizeof(string),"%d",C);
GameTextForAll(string,1000,3);
if(C <= 0)
{
GameTextForAll("GO",1000,3);
KillTimer(Timer);
}
}