Raised This Month: $ Target: $400
 0% 

How get Server Port?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Endi
Junior Member
Join Date: Nov 2009
Location: Russia
Old 04-28-2011 , 01:57   How get Server Port?
Reply With Quote #1

Hi.
My need get server port number, how i can get it?
This code show error.
Quote:
decl String:szIP[32]
GetClientIP(0,szIP,sizeof(szIP),0)
ReplyToCommand(0,"--- %s",szIP)
Help me please.
Thanks
Endi is offline
Leonardo
Veteran Member
Join Date: Feb 2010
Location: 90's
Old 04-28-2011 , 02:48   Re: How get Server Port?
Reply With Quote #2

Code:
new iPort = GetConVarInt( FindConVar( "hostport" ) );
Leonardo is offline
Endi
Junior Member
Join Date: Nov 2009
Location: Russia
Old 04-28-2011 , 03:20   Re: How get Server Port?
Reply With Quote #3

Thank you very much!
Спасибо
Endi is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 04-28-2011 , 06:31   Re: How get Server Port?
Reply With Quote #4

The server port or the client port ?
Your code fetches client stuff.
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 04-28-2011 , 06:33   Re: How get Server Port?
Reply With Quote #5

Quote:
Originally Posted by berni View Post
The server port or the client port ?
Your code fetches client stuff.
Maybe he try get client 0
Quote:
GetClientIP(0,szIP,sizeof(szIP),0)
Code:
[SM] Native "GetClientIP" reported: Client index 0 is invalid

Last edited by Bacardi; 04-28-2011 at 06:39.
Bacardi is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 04-28-2011 , 06:38   Re: How get Server Port?
Reply With Quote #6

ah ! he should've read Farzad's comment ^^

Quote:
You can NOT get the IP of the server via this command.
http://docs.sourcemod.net/api/index....d=show&id=400&
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
Leonardo
Veteran Member
Join Date: Feb 2010
Location: 90's
Old 04-28-2011 , 15:45   Re: How get Server Port?
Reply With Quote #7

What are you talking about? Problem has already solved.
Leonardo 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 12:15.


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