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

How can I get a port of players when they come my server?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wgwgkg
Member
Join Date: May 2011
Old 02-24-2012 , 05:49   How can I get a port of players when they come my server?
Reply With Quote #1

How can I use get_user_ip to get player port ?a? THXXXXXXXXXXXXXXXXXXXXXX
wgwgkg is offline
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 02-24-2012 , 06:23   Re: How can I get a port of players when they come my server?
Reply With Quote #2

get_user_ip( index, szIp, 1 ) ?
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
wgwgkg
Member
Join Date: May 2011
Old 02-24-2012 , 06:46   Re: How can I get a port of players when they come my server?
Reply With Quote #3

I just want the port~
wgwgkg is offline
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 02-24-2012 , 06:46   Re: How can I get a port of players when they come my server?
Reply With Quote #4

Quote:
Originally Posted by tuty View Post
get_user_ip( index, szIp, 1 ) ?
Code:
get_user_ip ( id, ip, len, withoutport=0 )
so that will return the player's ip without the port

smth like this
PHP Code:
new s_IP22 ], s_Port];
get_user_ip ids_IP21 );
copy s_Port5s_IPstrlen s_IP ) - ] ); 
__________________


Last edited by anakin_cstrike; 02-24-2012 at 06:47.
anakin_cstrike is offline
killergirl
Senior Member
Join Date: Jul 2010
Old 02-24-2012 , 08:15   Re: How can I get a port of players when they come my server?
Reply With Quote #5

PHP Code:
    static szIp[32], posendport[10]
    
    
get_user_ip(indexszIpcharsmax(szIp))
    
    
pos containi(szIp":")
    
end containi(szIp"^0")
    
    if(
pos != -1)
        
copy(portend posszIppos ]) 

Last edited by killergirl; 02-24-2012 at 08:22.
killergirl is offline
wgwgkg
Member
Join Date: May 2011
Old 02-24-2012 , 08:30   Re: How can I get a port of players when they come my server?
Reply With Quote #6

And then how to write:
If the port is not include "270", then kick the player
?@?
wgwgkg is offline
killergirl
Senior Member
Join Date: Jul 2010
Old 02-24-2012 , 08:43   Re: How can I get a port of players when they come my server?
Reply With Quote #7

PHP Code:
public client_putinserver(id){
    if(
is_user_bot(id))
        return 
PLUGIN_HANDLED
        
    
static szIP[32]
    
    
get_user_ip(idszIPcharsmax(szIP))
    
    if(
containi(szIP":270") == -1)
        
client_cmd(id"disconnect")
    
    return 
PLUGIN_HANDLED

killergirl is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 02-24-2012 , 09:58   Re: How can I get a port of players when they come my server?
Reply With Quote #8

In case anyone needed this.
PHP Code:
stock GetPort(client)
{
    new 
ip[32];
    
get_user_ip(clientipcharsmax(ip));
    
    for (new 
icharsmax(ip) - 1i++)
        if (
ip[i] == ':')
            return 
str_to_num(ip[1]);
            
    return 
0;


Last edited by hleV; 03-11-2012 at 11:51.
hleV is offline
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 02-24-2012 , 19:50   Re: How can I get a port of players when they come my server?
Reply With Quote #9

Quote:
Originally Posted by anakin_cstrike View Post
Code:
get_user_ip ( id, ip, len, withoutport=0 )
so that will return the player's ip without the port

smth like this
PHP Code:
new s_IP22 ], s_Port];
get_user_ip ids_IP21 );
copy s_Port5s_IPstrlen s_IP ) - ] ); 
i just forgot len, the fact is, i just wanted tho show him how to get port
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 02-25-2012 , 12:15   Re: How can I get a port of players when they come my server?
Reply With Quote #10

not the len part was the problem, but the last parameter
__________________

anakin_cstrike is offline
Old 02-25-2012, 12:17
echo_cs
This message has been deleted by xPaw. Reason: You are not helpful.
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:22.


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