Counting players in DeathMatch [reps+] - 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 in DeathMatch [reps+] (
/showthread.php?tid=502313)
Counting players in DeathMatch [reps+] -
SPA - 23.03.2014
Hi, im wondering how is possible to count the players which join dm, for example someone goto /minigun
count them as +1 and show in textdraw anyone can give me an exam simple one ? ,thanks!
Re: Counting players in DeathMatch [reps+] -
Konstantinos - 23.03.2014
pawn Код:
new MinigunCount;
// OnGameModeInit or OnFilterScriptInit:
MinigunCount = 0;
// when a player joins /minigun (be sure that if a player is already is minigun and type it, it won't count again. Add it at the bottom of the command
MinigunCount++;
// When a player leaves the /minigun:
MinigunCount--;
// When you want to display it to a textdraw, format a string and "MinigunCount" holds the players' count.
Re: Counting players in DeathMatch [reps+] -
SPA - 23.03.2014
Quote:
Originally Posted by Konstantinos
pawn Код:
new MinigunCount;
// OnGameModeInit or OnFilterScriptInit: MinigunCount = 0;
// when a player joins /minigun (be sure that if a player is already is minigun and type it, it won't count again. Add it at the bottom of the command MinigunCount++;
// When a player leaves the /minigun: MinigunCount--;
// When you want to display it to a textdraw, format a string and "MinigunCount" holds the players' count.
|
What about if player left DeathMatch? i mean i put under onplayerdeath miniguncount--?
Re: Counting players in DeathMatch [reps+] -
Konstantinos - 23.03.2014
That depends on your code. If a player dies and then he lefts the minigun DM, use:
in OnPlayerDeath (after checking that the player was indeed in minigun DM). If you also have a command that leaves the minigun DM, use it there too (again, you should check if the player is in minigun DM to prevent issues).
Re: Counting players in DeathMatch [reps+] -
CroM256 - 23.03.2014
On exit DeathMatch command put MinigunCount--;
And don't forget OnPlayerDisconnect...put there something like this, but with your variables
if(minigun[playerid] == 1)
MinigunCount--;
And if player leaves DM zone when he dies then put MinigunCount--; on OnPlayerDeath
EDIT: Didn't see your last post Konstantinos