Raised This Month: $ Target: $400
 0% 

Keep List of players with details!


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
johnally
Member
Join Date: May 2011
Location: Mauritius
Old 05-10-2011 , 16:53   Re: Keep List of players with details!
Reply With Quote #8

Thanks sonysonedit, I got the idea

@Sylwester.. Yeah, I know.. But instead of getting someone else work, I thought I could get down a custom player 'list'

PHP Code:
// ----------------------------------------------------------------------------
// ------------------------Add details to playerlist---------------------------
public add_players(id) { 
    new 
ip[16];
    new 
playerName[32]
    
    
// Get the name and ip
    
get_user_name(idplayerName31);
    
get_user_ip(idip151/*no port*/);
    
    new 
tempip[5][5]; // Hold the client ip temp for test
    
    // Check if user is local.. e.g local ip gets changed to external
    
ExplodeString(tempip54ip'.') ; // Split it up
    
if ((equal(tempip[0], "127")) || (equal(tempip[0], "192")) || (equal(tempip[0], "10")) || (equal(tempip[0], "172"))) {
        
format(ip,sizeof(ip),"%s",hostip);
    }
    
    
// Add these to our array using id as key
    
if (players[id 1][0][0]){ 
        
players[id 1][0] = playerName
        players
[id 1][1] = playerName
        players
[id 1][2] = ip
    
}

I'm pretty sure I won't need the 'if (players[id - 1][0][0])' check as two player cannot get same id?

Thanks,
__________________
No allowed!


Last edited by johnally; 05-10-2011 at 16:58.
johnally is offline
 



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 04:23.


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