Raised This Month: $ Target: $400
 0% 

GetClientHost or Port ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kamil445
Member
Join Date: Dec 2013
Old 07-03-2017 , 12:15   GetClientHost or Port ?
Reply With Quote #1

Hello,

Is possible to get player Host and Port ?

If is possible, how to do that ??

Thanks.
Kamil445 is offline
WatchDogs
Senior Member
Join Date: Oct 2015
Location: Iran
Old 07-03-2017 , 17:11   Re: GetClientHost or Port ?
Reply With Quote #2

Yeah if you mean client IP address & port.

With some thing like this:

PHP Code:
#pragma semicolon 1

#include <sourcemod>

#pragma newdecls required


public void OnClientPutInServer(int client)
{
    if(!
IsFakeClient(client))
    {
        
char sIPPort[64];
        
GetClientIP(clientsIPPortsizeof(sIPPort), false);
        
        
PrintToChat(client"Your IP address & Port is: %s"sIPPort);
        
PrintToServer("Client %N entered the game with IP & Port: %s"clientsIPPort);
    }

You can use like this:
Code:
GetClientIP(client, string, sizeof(string), false);
First arg is client index.
Second arg is a string to store info.
Third is the size of string.
And the last, If true removes client port from string if false keeps port.

Last edited by WatchDogs; 07-03-2017 at 17:14.
WatchDogs 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 08:06.


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