How to Make Chat Countdown Help! -
MrCripBloodz - 15.06.2012
Hello Everyone i need chat countdown for my server
it should not freeze any player just show this
Countdown starteed by [id]
3
2
1
go
Can Anyone tell me how to make this plz..
Re: How to Make Chat Countdown Help! -
MrCripBloodz - 17.06.2012
Look like nobody can help :S
Re: How to Make Chat Countdown Help! -
SuperViper - 18.06.2012
pawn Код:
InitializeCountdown(playerid)
{
new string[128], playersName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playersName, MAX_PLAYER_NAME);
format(string, sizeof(string), "Countdown started by (%d) %s", playerid, playersName);
SendClientMessageToAll(-1, string);
SendClientMessageToAll(-1, "3");
SetTimer("Countdown_Two", 1000, 0);
SetTimer("Countdown_One", 2000, 0);
SetTimer("Countdown_Go", 3000, 0);
}
forward Countdown_Two();
public Countdown_Two()
{
return SendClientMessageToAll(-1, "2");
}
forward Countdown_One();
public Countdown_One()
{
return SendClientMessageToAll(-1, "1");
}
forward Countdown_Go();
public Countdown_Go()
{
return SendClientMessageToAll(-1, "Go!");
}
To start it, put InitializeCountdown(playerid) somewhere in a command or something.
Re: How to Make Chat Countdown Help! -
MrCripBloodz - 21.06.2012
Quote:
Originally Posted by SuperViper
pawn Код:
InitializeCountdown(playerid) { new string[128], playersName[MAX_PLAYER_NAME]; GetPlayerName(playerid, playersName, MAX_PLAYER_NAME); format(string, sizeof(string), "Countdown started by (%d) %s", playerid, playersName); SendClientMessageToAll(-1, string); SendClientMessageToAll(-1, "3"); SetTimer("Countdown_Two", 1000, 0); SetTimer("Countdown_One", 2000, 0); SetTimer("Countdown_Go", 3000, 0); }
forward Countdown_Two(); public Countdown_Two() { return SendClientMessageToAll(-1, "2"); }
forward Countdown_One(); public Countdown_One() { return SendClientMessageToAll(-1, "1"); }
forward Countdown_Go(); public Countdown_Go() { return SendClientMessageToAll(-1, "Go!"); }
To start it, put InitializeCountdown(playerid) somewhere in a command or something.
|
so wat is that command for counting
Re: How to Make Chat Countdown Help! -
[MM]RoXoR[FS] - 21.06.2012
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/countdown", cmdtext, true, 10) == 0)
{
InitializeCountdown(playerid)
return 1;
}
return 0;
}
Re: How to Make Chat Countdown Help! -
JaTochNietDan - 21.06.2012
Quote:
Originally Posted by SuperViper
pawn Код:
InitializeCountdown(playerid) { new string[128], playersName[MAX_PLAYER_NAME]; GetPlayerName(playerid, playersName, MAX_PLAYER_NAME); format(string, sizeof(string), "Countdown started by (%d) %s", playerid, playersName); SendClientMessageToAll(-1, string); SendClientMessageToAll(-1, "3"); SetTimer("Countdown_Two", 1000, 0); SetTimer("Countdown_One", 2000, 0); SetTimer("Countdown_Go", 3000, 0); }
forward Countdown_Two(); public Countdown_Two() { return SendClientMessageToAll(-1, "2"); }
forward Countdown_One(); public Countdown_One() { return SendClientMessageToAll(-1, "1"); }
forward Countdown_Go(); public Countdown_Go() { return SendClientMessageToAll(-1, "Go!"); }
To start it, put InitializeCountdown(playerid) somewhere in a command or something.
|
This is...madness. Why would you make 3 separate callbacks for this? It's just so messy, not to mention how you invoke multiple timers at a time! Here is an alternative example:
pawn Код:
public Countdown(count)
{
new string[5];
if(count)
{
format(string, sizeof(string), "%i", count);
SetTimerEx("Countdown", 1000, false, "i", count - 1);
}
else format(string, sizeof(string), "Go!");
SendClientMessageToAll(0xFFFFFF, string);
return 1;
}
Which can be invoked by simply doing this in the context of your choice:
pawn Код:
new string[64], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(string, sizeof(string), "Countdown started by (%d) %s", playerid, name);
SendClientMessageToAll(0xFFFFFF, string);
Countdown(5);
-
MrCripBloodz - 27.06.2012
U all made me confuse >.<
Well i made one myself thankx all.