AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   if( whatever ) add to const (https://forums.alliedmods.net/showthread.php?t=127846)

NiQu 05-25-2010 14:06

if( whatever ) add to const
 
Hello, lets say i have an enum and a const:

PHP Code:

enum _:g_iItemCount
{
    
ITEM1,
    
ITEM2,
    
ITEM3
}

new const 
g_iItems[g_iItemCount][] =
{
    
"Item #1",
    
"Item #2",
    
"Item #3"


and lets say i only want to add the third item, ITEM3 and "Item #3" if a variable is set to 0, how would i do? I tried to add an if statement in the middle of the enum and it didnt work.

fysiks 05-25-2010 14:53

Re: if( whatever ) add to const
 
Just leave it as is and don't use ITEM3 if you don't need it.

NiQu 05-25-2010 14:57

Re: if( whatever ) add to const
 
Its like this:

I got 2 plugin and 1 include, I have a native called server_type and 1 param wich is type.

And in plugin #1 i have a global variable called g_serverType and i wanna chcek if g_serverType is 0 and if it is 0 it shud att item 3 if it is anything else but 0 it should skip item 3 and go to item 4 or simply not add item 3.

Understand?

fysiks 05-25-2010 14:59

Re: if( whatever ) add to const
 
Quote:

Originally Posted by NiQu (Post 1190922)
Its like this:

I got 2 plugin and 1 include, I have a native called server_type and 1 param wich is type.

And in plugin #1 i have a global variable called g_serverType and i wanna chcek if g_serverType is 0 and if it is 0 it shud att item 3 if it is anything else but 0 it should skip item 3 and go to item 4 or simply not add item 3.

Understand?

Yes, I understand. But, my advice doesn't change. You can't do what you want to do.

NiQu 05-25-2010 15:05

Re: if( whatever ) add to const
 
So its not possible to do that? :(

Well ill just make an if in the menu and check if item == item3 and if so ill skip the item.

Thanks anyways.

fysiks 05-25-2010 15:06

Re: if( whatever ) add to const
 
Quote:

Originally Posted by NiQu (Post 1190930)
So its not possible to do that? :(

Well ill just make an if in the menu and check if item == item3 and if so ill skip the item.

Thanks anyways.

What are you trying to achieve?

NiQu 05-25-2010 15:13

Re: if( whatever ) add to const
 
If plugin2.amxx is running on the server then item3 wont be added because plugin2.amxx adds something else that does almost the same.

If both item3 is in menu and plugin2.amxx is running and i buy item3 and i also buy something in plugin2.amxx then plugin2.amxx will intefere plugin1.amxx and that isnt good.

fysiks 05-25-2010 15:21

Re: if( whatever ) add to const
 
Skip ITEM3 if you don't want it in there.

NiQu 05-25-2010 15:24

Re: if( whatever ) add to const
 
U dont quite understand what i want.

Maybe you didnt understand i want this to be like an API....

if(plugin_running(plugin2.amxx) itemdelete(item3))

wrecked_ 05-25-2010 15:32

Re: if( whatever ) add to const
 
Use dynamic arrays.


All times are GMT -4. The time now is 05:20.

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