Counting Players - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Counting Players (
/showthread.php?tid=478001)
Counting Players -
Avi Raj - 27.11.2013
Hello Guys,
How can i count players like in Derby?
I want that to be in Textdraw.
Like :- Players :- x/y
and When a player joins /derby, it should change x and y.
And when a player leaves derby, it should change x.
If anyone can help, Will be appreciated
Thanks.
Re: Counting Players -
FakkChass - 27.11.2013
removed
Re: Counting Players -
iFiras - 27.11.2013
On top
pawn Код:
//DCMD define
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
Then
then
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(derby,5,cmdtext);
return 1;
}
then
pawn Код:
dcmd_derby(playerid,params[])
{
SendClientMessageToAll(playerid,-1,"DERBY: A new player has joined the derby!");
PlayersInDerby++; //To count players
//put here the positions u want player to teleport etc
return 1;
}
And for the textdraw, create one and do this OnPlayerUpdate
pawn Код:
public OnPlayerUpdate(playerid)
{
new string[128];
format(string,sizeof(string),"Players: %d",PlayersInDerby);
TextDrawSetString(YourTextdrawNameHere,string);
return 1;
}
I made it with dcmd because i used to use DCMD and i love using it so you're free to change to whatever u want
Hope i helped you