AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Choose a random player. (https://forums.alliedmods.net/showthread.php?t=135652)

Excalibur.007 08-18-2010 09:15

Choose a random player.
 
I'm using it for Zombie Plague. I've seen many threads but most of them is not working or totally incorrect. This is my current 1.

PHP Code:

new iPlayers[32], iNum
 
 
if(g_isBotAllowed)
  
get_players(iPlayersiNum"ah")
 else
  
get_players(iPlayersiNum"ach")
 
 if(!
iNum)
  return -
1
 
 iRandomPlayer 
random(iNum)
 
 
g_bBodyGuard[iPlayers[iRandomPlayer]] = true 

iRandomPlayer is the index/id.
g_isBotAllowed is a PCVar.

Does this works?

Vechta 08-18-2010 09:17

Re: Choose a random player.
 
On zombie plague code you will find a code :)

Excalibur.007 08-18-2010 09:22

Re: Choose a random player.
 
Ohh. Good point! Let me check.


All times are GMT -4. The time now is 21:59.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.