Raised This Month: $ Target: $400
 0% 

global variables


Post New Thread Reply   
 
Thread Tools Display Modes
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 04-23-2010 , 13:43   Re: global variables
Reply With Quote #11

What's the purpose of DummyFunction() in the first plugin? It doesn't make sense to use xvar natives in the same plugin you create the variable.

Last edited by SnoW; 04-23-2010 at 13:45.
SnoW is offline
Send a message via MSN to SnoW
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-23-2010 , 13:54   Re: global variables
Reply With Quote #12

It's an example based on his attempt above. What you say makes no sense. I don't see the problem to set a value in a random function in the plugin1 then checking it's value in the plugin2...
__________________

Last edited by Arkshine; 04-23-2010 at 14:03.
Arkshine is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 04-23-2010 , 14:33   Re: global variables
Reply With Quote #13

Quote:
Originally Posted by Arkshine View Post
It's an example based on his attempt above. What you say makes no sense. I don't see the problem to set a value in a random function in the plugin1 then checking it's value in the plugin2...
I don't see a lot of sense in your code really. What you are doing is this:
PHP Code:
public myVar;
 
// [...]
 
DummyFunction()
{
     
set_xvar_numget_xvar_id"myVar" ), );

When you could do this:

PHP Code:
public myVar;
DummyFunction()

     
MyVar 1;

I don't think there's need for an example how to assign a variable but if it's really needed then at least don't use useless native calls.

Last edited by SnoW; 04-23-2010 at 14:36.
SnoW is offline
Send a message via MSN to SnoW
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-23-2010 , 14:36   Re: global variables
Reply With Quote #14

You got a point. Good boy. Though my original point was to show him the way to get/set with the native. I understand it may be confusing for him, I will add a note.
__________________
Arkshine is offline
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 02:31.


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