Raised This Month: $ Target: $400
 0% 

I need to get this right in my head....


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
michal123
Junior Member
Join Date: Feb 2011
Location: Poland
Old 01-26-2013 , 06:19   Re: I need to get this right in my head....
Reply With Quote #9

Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "speedkill"

//Global variable
new g_GlobalValue = 50;

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR);
	register_clcmd("say /test", "ExampleTest");
}
public ExampleTest(id){
	if(is_user_alive(id)){
		//Local variable
		new g_LocalValue = 25;
		
		client_print(id, 3, "%d | %d", g_GlobalValue, g_LocalValue);
	}
	/* 	
	Error, variable "g_LocalValue" not exist "Error: Undefined symbol "g_LocalValue" on line 25"
	
	client_print(id, 3, "%d | %d", g_GlobalValue, g_LocalValue); 
	*/
}
Global variable can be used everywhere - like Torge wrote.
Local variable can be used only in function or block, where this variable is declared.

About enum -> https://forums.alliedmods.net/showthread.php?t=140103
michal123 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 20:39.


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