Raised This Month: $ Target: $400
 0% 

Some questions about source pawn.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 05-16-2012 , 11:27   Re: Some questions about source pawn.
Reply With Quote #4

Quote:
Originally Posted by Hyper Nova View Post
the problem is that if file1.sinc and file2.sinc include file1.vinc then gvar2 and gvar will be defined twice.

it will couse the error : sombol already defined "gvar" ( and gvar2 )
what i want to know is how to make include what do not couse that error.

i need to use those variables in all inc files ( and in sma ofcourse )
I'm gonna be honest....that was a long post and i only read a bit of it. Answer to above quoted question:
The variables are defined IN THAT CLASS ONLY and do not effect anything outside of it. You can use cheeseGraterC as a var in every single plugin on a server and it will act independently in each plugin. Variables are block specific.....for instance you can define a global (for use in all of your plugin) and use it throughout all your functions and loops and blocks.
ex:
PHP Code:
#include <amxmodx>
new g_cheeseGraterC 15    // This is a global var: usable anywhere in your plugin
public plugin_init() {
    
register_plugin("Your Mom""Eats""Vegetables")
    new 
funcVar 13            // This is a function-specific var: usable ONLY within the function
    
new varW funcVar          // This will effectively set varW as 13
}
public 
function1() {
    new 
varW g_cheeseGraterC    // This will take your global and set it to a new variable
                                                // varW can still be defined; it is separate from varW in plugin_init
    
new varK funcVar                  // This WILL NOT WORK. funcVar was NOT defined within this function's scope; thus will give you an error

I hope that helped a little.
Liverwiz 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:28.


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