#include <a_samp>
new Count;
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("CountDown System By SilverKiller Loaded!");
print("--------------------------------------\n");
Count = 0;
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/countdown", cmdtext, true, 10) == 0)
{
if (Count == 0)
{
SetTimer("Counting",1000,false);
}else{
SendClientMessage(playerid, 0xFF0000FF,"There is a countdown already started!");
}
new pName[24];
new str[128];
GetPlayerName(playerid, pName, 24);
format(str, 128, "%s has started the countdown!", pName);
SendClientMessageToAll(0xFF9900AA, str);
return 1;
}
return 0;
}
forward Counting(playerid);
forward Counting2(playerid);
forward Counting1(playerid);
forward CountingGO(playerid);
public Counting(playerid)
{
Count = 1;
GameTextForAll("~y~3",1000,6);
SetTimer("Counting2",1000,false);
return 1;
}
public Counting2(playerid)
{
Count = 1;
GameTextForAll("~g~2",1000,6);
SetTimer("Counting1",1000,false);
return 1;
}
public Counting1(playerid)
{
Count = 1;
GameTextForAll("~b~1",1000,6);
SetTimer("CountingGO",1000,false);
return 1;
}
public CountingGO(playerid)
{
Count = 0;
GameTextForAll("~r~GO!!!",1000,6);
return 1;
}
#include <a_samp>
new Count = 5;
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("CountDown System By SilverKiller Loaded!");
print("--------------------------------------\n");
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/countdown", cmdtext, true) == 0)
{
if (Count == 5)
{
SetTimer("Countdown",1000,false);
new pName[24];
new str[128];
GetPlayerName(playerid, pName, 24);
format(str, 128, "%s has started the countdown!", pName);
SendClientMessageToAll(0xFF9900AA, str);
}else{
SendClientMessage(playerid, 0xFF0000FF,"There is a countdown already started!");
}
return 1;
}
return 0;
}
forward Countdown();
public Countdown()
{
new str[128];
Count --;
format(str,128,"%d",Count);
GameTextForAll(str,1000,4);
if(Count == 0)
{
Count = 5;
GameTextForAll("Go!",1000,4);
}else {
SetTimer("Countdown",1000,false);
}
return 1;
}
So you know how to make a timer and which callback you want it in, what was wrong with just copying it there?
|
public OnPlayerCommandText(playerid, cmdtext[]){ if (strcmp("/countdown", cmdtext, true, 10) == 0) { if (Count == 0) { SetTimer("Counting",1000,false); }else{ SendClientMessage(playerid, 0xFF0000FF,"There is a countdown already started!"); } new pName[24]; new str[128]; GetPlayerName(playerid, pName, 24); format(str, 128, "%s has started the countdown!", pName); SendClientMessageToAll(0xFF9900AA, str); return 1; } return 0;}