Raised This Month: $51 Target: $400
 12% 

[help] Get info about all players


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Cerium
Member
Join Date: Dec 2013
Old 01-01-2014 , 04:37   [help] Get info about all players
Reply With Quote #1

Hi

How do I get name, steamid, and maybe IP from all players in the server?
__________________
Cerium is offline
Marcus_Brown001
AlliedModders Donor
Join Date: Nov 2012
Location: Illinois, United States
Old 01-01-2014 , 06:23   Re: [help] Get info about all players
Reply With Quote #2

You need to supply more information than that ... What you are asking to be done is very simple, but the answers can change depending on how you need the information. For example, you can make a simple plugin that loops all players on a command, and prints that information to chat. Or, you can make a command that grabs all of that information, and saves it into various strings. There are a lot of different things you can do, so you need to clarify on how you need this information.
Marcus_Brown001 is offline
Cerium
Member
Join Date: Dec 2013
Old 01-01-2014 , 06:51   Re: [help] Get info about all players
Reply With Quote #3

I want to send the information as get/post data to a website.
__________________
Cerium is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 01-01-2014 , 07:37   Re: [help] Get info about all players
Reply With Quote #4

You can either open a hidden motd page on the client (not reliable, as they can block html motds) or you can send it with socket.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
Cerium
Member
Join Date: Dec 2013
Old 01-01-2014 , 08:20   Re: [help] Get info about all players
Reply With Quote #5

How do I get information from ALL players? Is there any function?
__________________
Cerium is offline
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 01-01-2014 , 08:22   Re: [help] Get info about all players
Reply With Quote #6

You can loop thru all player use for, while, do~while statement.
__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.
GsiX is offline
Cerium
Member
Join Date: Dec 2013
Old 01-01-2014 , 08:24   Re: [help] Get info about all players
Reply With Quote #7

Is there a variable that holds all players? I know I have to loop, but I need something to loop through.
__________________
Cerium is offline
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 01-01-2014 , 08:38   Re: [help] Get info about all players
Reply With Quote #8

PHP Code:
new String:PlayerInfo[MAXPLAYERS+1][2][128];  // <<<<------  The ULTIMATE variable is this one

GetAllPlayerInfoclient )
{
    for( 
i=1;<=MaxClientsi++ )
    {
        if( 
IsClientInGame(i) && !IsFakeClient(i))
        {
            
FormatPlayerInfo[i][0], sizeofPlayerInfo[][] ), "%N"client // name
            
GetClientAuthStringiPlayerInfo[i][1], sizeofPlayerInfo[][] ))  //steam id
        
}
        
PrintToChatclient"Name: %s | SteamID: %s"PlayerInfo[i][0], PlayerInfo[i][1] );
    }

https://forums.alliedmods.net/showthread.php?t=76144
__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.

Last edited by GsiX; 01-01-2014 at 08:39.
GsiX is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 01-01-2014 , 08:38   Re: [help] Get info about all players
Reply With Quote #9

PHP Code:
new String:name[MAXPLAYERS 1][MAX_NAME_LENGTH 1];
new 
String:steam[MAXPLAYERS 1][24];
new 
String:ip[MAXPLAYERS 1][16];

for (new 
client 1client <= MaxClientsclient++) {
    if (!
IsClientInGame(client) || IsFakeClient(client))
        continue;

    
GetClientName(clientname[client], sizeof(name[]));
    
GetClientAuthString(clientsteam[client], sizeof(steam[]));
    
GetClientIP(clientip[client], sizeof(ip[]));

__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.

Last edited by DJ Tsunami; 01-01-2014 at 08:39.
DJ Tsunami is offline
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 01-01-2014 , 08:45   Re: [help] Get info about all players
Reply With Quote #10


Code:
GetClientIP(client, ip[client], sizeof(ip[]));
__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.
GsiX 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 13:24.


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