Raised This Month: $ Target: $400
 0% 

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


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
WeeZick
Member
Join Date: Oct 2012
Location: Gothenburg, Sweden
Old 01-26-2013 , 05:32   I need to get this right in my head....
Reply With Quote #1

what's the difference between a global variable and a variable in a function?
and what's an enum?
Dont blame me im not good at coding:/
WeeZick is offline
Torge
Veteran Member
Join Date: Oct 2011
Old 01-26-2013 , 05:34   Re: I need to get this right in my head....
Reply With Quote #2

Global variable can be used everywhere.

Normal variable in a function can be just used in its function.
Torge is offline
WeeZick
Member
Join Date: Oct 2012
Location: Gothenburg, Sweden
Old 01-26-2013 , 05:50   Re: I need to get this right in my head....
Reply With Quote #3

yeah but what is an enum?
WeeZick is offline
michal123
Junior Member
Join Date: Feb 2011
Location: Poland
Old 01-26-2013 , 05:56   Re: I need to get this right in my head....
Reply With Quote #4

Enum: http://en.wikipedia.org/wiki/Enumerated_type
Local variable: http://en.wikipedia.org/wiki/Local_variable
Global variable: http://en.wikipedia.org/wiki/Global_variable

If you want, I can show you example code.

Last edited by michal123; 01-26-2013 at 06:16.
michal123 is offline
WeeZick
Member
Join Date: Oct 2012
Location: Gothenburg, Sweden
Old 01-26-2013 , 06:01   Re: I need to get this right in my head....
Reply With Quote #5

Yeah that whould be verry nice if you showed me a example
WeeZick is offline
WeeZick
Member
Join Date: Oct 2012
Location: Gothenburg, Sweden
Old 01-26-2013 , 06:05   Re: I need to get this right in my head....
Reply With Quote #6

But i have understanded what an variable is i think. It is when in the beggining we press { and when i want to end the function i use }?
WeeZick is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 01-26-2013 , 06:12   Re: I need to get this right in my head....
Reply With Quote #7

Pawn Picture Tutorial
Programming for starters
__________________
Impossible is Nothing
Sylwester is offline
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 01-26-2013 , 06:16   I need to get this right in my head....
Reply With Quote #8

Dont forget to read the enum tutorial by exolent , take a look at the tut section
EpicMonkey is offline
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
WeeZick
Member
Join Date: Oct 2012
Location: Gothenburg, Sweden
Old 01-26-2013 , 06:22   Re: I need to get this right in my head....
Reply With Quote #10

The thing i wanna do is to set a steamid on my blockmaker so only that steamid can use the blockmaker, and i found this to try:
{
new SteamID[32];
get_user_authid(id, SteamID, 31);

if(equal(SteamID, STEAMID_A) || equal(SteamID, STEAMID_LAN) || g_gived_access[id])
{
if(PCM_banned[id])
{
PCM_Print(id, "You'r SteamID didnt get a match!");
PCM_Print(id, "You'r SteamID is banned from PCM.");
set_task(2.0, "Task_ShowInfo", id);
}
else
{
ShowMainMenu(id);
}
}
else
{
PCM_Print(id, "You'r SteamID didnt get a match!");
PCM_Print(id, "You'r SteamID is either banned from PCM or you arent eligble to use PCM.");
set_task(2.0, "Task_ShowInfo", id);
}
return PLUGIN_HANDLED;
}
and then my buddy said that i should make an enum and a variable that builds up those steamids
and i didnt know what a enum or variable were so now im asking.
IF ANY COULD HELP ME SET THE STEAM ID I WHOULD BE VERRY HAPPY
WeeZick is offline
Old 01-26-2013, 06:52
WeeZick
This message has been deleted by YamiKaitou. Reason: wait 14 days before you bump
Old 01-26-2013, 07:34
WeeZick
This message has been deleted by YamiKaitou. Reason: wait 14 days before you bump
Old 01-26-2013, 07:37
WeeZick
This message has been deleted by YamiKaitou. Reason: wait 14 days before you bump
Old 01-26-2013, 07:50
WeeZick
This message has been deleted by YamiKaitou. Reason: quit it before your thread gets locked
Reply



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