Raised This Month: $ Target: $400
 0% 

How to make sure a variable is not unset


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Cd5ssmffan
BANNED
Join Date: Feb 2017
Location: GB
Old 06-18-2018 , 18:05   Re: How to make sure a variable is not unset
Reply With Quote #10

Quote:
Originally Posted by maqi View Post
Code:
g_custom_text[32] = register_cvar("sa_custom_text","")
This is wrong. register_cvar always returns an integer and it's a cvar pointer to a cvar, which you can use to get_pcvar.
Can I fix it by using create_cvar instead?

Quote:
Originally Posted by maqi View Post
Code:
get_pcvar_string(g_custom_text[32], g_custom_text, 32)
This is wrong. First of all the first argument is a cvar pointer you got from registering a cvar, in your case this throws an error.

Also length should be sizeof - 1 ( In your case 31, or just use charsmax(buffer) )

This native returns a number of cells written to a buffer, so keep that in mind.
How do I fix this?
Cd5ssmffan is offline
Send a message via ICQ to Cd5ssmffan Send a message via AIM to Cd5ssmffan Send a message via Yahoo to Cd5ssmffan Send a message via Skype™ to Cd5ssmffan
 



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:25.


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