Counting players in DeathMatch [reps+]
#1

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!
Reply
#2

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.
Reply
#3

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--?
Reply
#4

That depends on your code. If a player dies and then he lefts the minigun DM, use:
pawn Код:
MinigunCount--;
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).
Reply
#5

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)