count players in dm - 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: count players in dm (
/showthread.php?tid=291738)
count players in dm -
MA_proking - 21.10.2011
Its a very complicated problem so please read the following
When player do /dm 1
a textdrawn appear dm 1 is starting in 25 second do /dm 1 to join
if more than one players join start dm
else SendClientMessage(playerid, color, "Not enough player to join");
After starting when last player left it declare him winner.
Please help me with red part.
Thanks hope you help
Re: count players in dm -
SloProKiller - 21.10.2011
If I understand correctly, you want to make players only able to join a deathmatch once someone is in it. If so, here is the code.
pawn Код:
CMD:dm(playerid, params[])
{
new pcount;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i)) pcount ++;
}
if(!pcount) return SendClientMessage(playerid, 0xFFFFFFFF, "Not enough players to join");
else
{
//your join deathmatch code here
}
return 1;
}
Remember to add pcount --; once players leave the deathmatch.
Re: count players in dm -
MA_proking - 21.10.2011
I think I got it <3