Raised This Month: $ Target: $400
 0% 

loop through all players


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
hypheni
Senior Member
Join Date: Jul 2011
Location: India
Old 02-12-2013 , 03:23   loop through all players
Reply With Quote #1

Just to clarify my ideas I'm posting this.

PHP Code:
print_message(idmsg[]) 
{
    
message_begin(MSG_ONEgmsgSayText, {0,0,0}, id)
    
write_byte(id)
    
write_string(msg)
    
message_end()

#1
PHP Code:
for(new client=1client<=g_maxplayersclient++)
{
    if(
is_user_connected(client))
    {
        
print_message(clientbuffer)
    }

#2
PHP Code:
new players[32], playerCountplayer
get_players
(playersplayerCount)

for(new 
i=0i<playerCounti++)
{
    
player players[i]        
        
print_message(playerbuffer)

In the 1st code snippet it just enumerate through all current players and print a message, 2nd code does the same as I dont specify any flags in get_players(). If I put some flag like 'c' it will return only those numbers matches with that flag.

Am I correct ?

Last edited by hypheni; 02-12-2013 at 03:56.
hypheni is offline
Send a message via Skype™ to hypheni
 



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 11:11.


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