Raised This Month: $ Target: $400
 0% 

server cvar and printing them


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 07-25-2011 , 09:09   Re: server cvar and printing them
Reply With Quote #4

You didn't fully understand how things work apparently.

First, learn to post all information available, including compile or in-game errors because it may help people to quickly help you without testing the code... which some people might not have time to do.

Now...

- Strings aren't returned, you need to parse them in the function and they need to be declared as arrays... read the pawn tutorial from AMXX wiki to fully understand variables and their types.
Code:
new pCvar_hostname

//...

pCvar_hostname = get_cvar_pointer("hostname")

//...

new szHostname[64]

get_pcvar_string(pCvar_hostname, szHostname, charsmax(szHostname))
- Float variables need to have a tag or they'll give out a warning:
Code:
new pCvar_freezetime

//...

pCvar_freezetime = get_cvar_pointer("mp_freezetime")

//...

new Float:fFreezetime = get_pcvar_float(pCvar_freezetime)
- Variables are NEVER passed surrounded by quotes (meaning get_pcvar_string("g_fHostname") is wrong and get_pcvar_string(g_fHostname) is right)

- Don't use that variable notation style (it's called hungarian notation) if you don't understand it... f or fl is for float values, i is for integer/numbers, sz for strings, etc... but you seem to assign them randomly. You don't have to use those prefixes but if you want to, I suggest you learn their meaning first.
__________________

Last edited by Hunter-Digital; 07-25-2011 at 09:39.
Hunter-Digital 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 00:47.


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