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

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-19-2018 , 15:49   Re: How to make sure a variable is not unset
Reply With Quote #15

Quote:
Originally Posted by fysiks View Post
It sounds like, at the very least, you need to read some of the really basic scripting tutorials like the first two under "Pawn Programming" here.
Been over that multiple times before I posted this thread, I can't find exactly what I need

Quote:
Originally Posted by maqi View Post
Ill make you a tutorial:

PHP Code:
/* These will be our cvar pointers */
new     g_Cvar_TutorialInt,
        
g_Cvar_TutorialString;

public 
plugin_precache( )
{
        
/* We registered our cvars and asigned g_Cvar_Tutorial as our cvar pointers ( That means that everything we want to do with a cvar we do with that pointer ) */

        
g_Cvar_TutorialInt register_cvar"amx_tutorial_int""1" );                  
        
g_Cvar_TutorialString register_cvar"amx_tutorial_string""Hello World" ); 
        
}

public 
client_connectiIndex )
{
    new 
iTutorial   =   get_pcvar_numg_Cvar_TutorialInt ); // We get the integer value of our cvar using get_pcvar_num

    
new sTutorial[32];  get_pcvar_stringg_Cvar_TutorialStringsTutorialcharsmax(sTutorial) ) // We copied the string value of our cvar to a buffer

    // Do stuff with iTutorial and sTutorial...

}

/* Note: Cvars always have string values, its up to you how you are gonna retrieve it, ) get_pcvar_num, get_pcvar_float, get_pcvar_string etc ... ) */ 
I probably shouldn't expect people to "spoon feed" me code but thanks anyway, this solved my problems (except I didn't need the tutorialInt bit
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 22:27.


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