Raised This Month: $ Target: $400
 0% 

get players, then select


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DiscoBBQ
Veteran Member
Join Date: Jan 2005
Location: Clemson, South Carolina
Old 03-23-2005 , 19:14   get players, then select
Reply With Quote #1

Well.. I need to have it so it gets all the players in servers. then randomly selects someone.
Help?
Like heres what i need. I need it so when you talk to one of my npc's itll randomly select someone in the server and display it in a client_print.
__________________
"Every man is guilty of all the good he did not do"
DiscoBBQ is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 03-23-2005 , 19:48  
Reply With Quote #2

Code:
new iPlayers[32], iNum // For alive players only..   get_players( iPlayers, iNum, "a" ) // For dead players only..   get_players( iPlayers, iNum, "b" ) // For all players get_players( iPlayers, iNum ) // now to loop through them all: new id, i for( i = 0; i < iNum; i++ ) {     id = iPlayers[i]     // do something with id }

Note: only use one of the get_players() listed above, and there are more possibilites, like specific teams and stuff.. look up the function in amxmodx.inc

xeroblood is offline
Send a message via MSN to xeroblood
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 03-23-2005 , 20:23  
Reply With Quote #3

or random_num(0,32), since a player index is 0-32.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 03-23-2005 , 22:24  
Reply With Quote #4

Ahh.. i forgot the random part!! :p lol

Thx Mel, i slipped up!!

Instead of:
Code:
// instead of this: new id, i for( i = 0; i < iNum; i++ ) {     id = iPlayers[i]     // do something with id } // put this: id = iPlayers[ random_num(0, iNum-1) ]
xeroblood is offline
Send a message via MSN to xeroblood
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-23-2005 , 22:37  
Reply With Quote #5

Thought you were missing that..
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:50.


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