Count system!
#1

heey guys

I want to make a count system how much players are on server with TextDraw.
Anyone knows how i can make this?

Thanks Admigo
Reply
#2

//================================================== ============================
public CountDown(playerid)
{
if(cd_sec == 0)
{
for(new i; i < MAX_PLAYERS; i++)
{
if(AccInfo[i][Frozen] == 0)
{
TogglePlayerControllable(i, 1);
}
}
PlaySound(playerid, 105;
GameTextForAll("~r~Go! Go! Go!",1000,3);
CdStated = 0;
KillTimer(cd_timer);
}
else
{
new string[256];
PlaySound(playerid, 1057);
format(string,256,"~g~%d",cd_sec);
GameTextForAll(string,1000,3);
}
cd_sec = cd_sec-1;
return 1;
}
stock PlaySound (playerid,sound)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
PlayerPlaySound(playerid, sound, X, Y, Z);
return sound;
}

dcmd_countdown(playerid,params[])
{
#pragma unused params
if(AccInfo[playerid][Level] >= 0)
{
if(CdStated == 0)
{
new Index;
new tmp[256]; tmp = strtok(params,Index);
new tmp2[256]; tmp2 = strtok(params,Index);

if(!strlen(tmp))
return SendClientMessage(playerid, LIGHTBLUE2, "Usage: /countdown [Seconds] [Freeze 1/0]") &&
SendClientMessage(playerid, orange, "Function: Will create a CountDown for all Players! (1-Freeze, 0-NoFreeze)");

cd_sec = strval(tmp);
if(cd_sec < 1 || cd_sec > 1000)
return SendClientMessage(playerid,COLOR_WHITE,"ERROR: Seconds between 1-1000");

if(!strlen(tmp2))
return SendClientMessage(playerid, LIGHTBLUE2, "Usage: /countdown [Seconds] [Freeze 1/0]") &&
SendClientMessage(playerid, orange, "Function: Will create a CountDown for all Players! (1-Freeze, 0-NoFreeze)");

cd_f = strval(tmp2);
if(cd_f < 0 || cd_f > 1)
return SendClientMessage(playerid,red,"ERROR: Use only 0(NoFreeze) and 1(Freeze)!");
CdStated = 1;
if(cd_f == 1)
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
TogglePlayerControllable(i, 0);
}
cd_timer = SetTimer("CountDown",1000,3);
return 1;
}
else return SendClientMessage(playerid,red,"ERROR: Countdown already in Progress!");
}
else return ErrorMessages(playerid, 1);
}
Reply
#3

pawn Код:
// Put that on your script top
forward OnlineUpdate();
public OnlineUpdate()
{
     new string[200];
     new count = 0;
     for(new v; v < MAX_PLAYERS; ++v)
     {
           if(IsPlayerConnected(v))
           {
                   ++count;
           }
     }

     format(string,sizeof(string),"%d",count);
     TextDrawSetString(Online,string);
     return 1;
}
pawn Код:
// Put that on FilterScriptInit / GameModeInit (depends what you're using)
   new Online;
   Online = TextDrawCreate(546.000000,23.000000,"0");
   TextDrawAlignment(Online,0);
   TextDrawBackgroundColor(Online,0x000000ff);
   TextDrawFont(Online,2);
   TextDrawLetterSize(Online,0.299999,1.600000);
   TextDrawColor(Online,0xFF0000FF);
   TextDrawSetProportional(Online,1);
   TextDrawSetShadow(Online,1);
   SetTimer("OnlineUpdate", 4000, true); // Update each 4seconds || 1000ms = 1seg
Reply
#4

Is from LuxAdmin System men you can downloasd LuxAdmin system and have and the countdown system!!!!!!!
Enjoy
Reply
#5

Hey Who can help me to host my server But : FREE
Reply
#6

Quote:
Originally Posted by blackwave
Посмотреть сообщение
pawn Код:
// Put that on your script top
forward OnlineUpdate();
public OnlineUpdate()
{
     new string[200];
     new count = 0;
     for(new v; v < MAX_PLAYERS; ++v)
     {
           if(IsPlayerConnected(v))
           {
                   ++count;
           }
     }

     format(string,sizeof(string),"%d",count);
     TextDrawSetString(Online,string);
     return 1;
}
pawn Код:
// Put that on FilterScriptInit / GameModeInit (depends what you're using)
   new Online;
   Online = TextDrawCreate(546.000000,23.000000,"0");
   TextDrawAlignment(Online,0);
   TextDrawBackgroundColor(Online,0x000000ff);
   TextDrawFont(Online,2);
   TextDrawLetterSize(Online,0.299999,1.600000);
   TextDrawColor(Online,0xFF0000FF);
   TextDrawSetProportional(Online,1);
   TextDrawSetShadow(Online,1);
   SetTimer("OnlineUpdate", 4000, true); // Update each 4seconds || 1000ms = 1seg
I get error:warning 213: tag mismatch
Reply
#7

Quote:
Originally Posted by admigo
Посмотреть сообщение
I get error:warning 213: tag mismatch
Try change:
pawn Код:
new Online;
To:
pawn Код:
new Text:Online;
Reply
#8

Quote:
Originally Posted by [ADC]Aldi96
Посмотреть сообщение
Hey Who can help me to host my server But : FREE
He's not asking for a countdown system learn to read, also use pawn tags for code, and in this case use pastebin for large snippets.

And create your own topic if you need help, don't just spam/go offtopic on someones thread.

And, I doubt anyone will host you a server for free.
Reply
#9

Lol yeah i dont want a countdown system! But now is the problem i dont see the text. Any help?
Reply
#10

Quote:
Originally Posted by admigo
Посмотреть сообщение
Lol yeah i dont want a countdown system! But now is the problem i dont see the text. Any help?
pawn Код:
TextDrawShowForPlayer(playerid,Online);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)