Raised This Month: $ Target: $400
 0% 

[HELP] Switch between const size numbers


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 05-26-2014 , 09:16   [HELP] Switch between const size numbers
Reply With Quote #1

Hey all! Now, I want to ask if it is possible to switch between the size numbers of a constant. I tried with a loop, switching and cases, doeasn't work. I want to know, because I register a clcmds with a constant. They are doing pretty simillar stuff and that's why I want to add all of the functions for these cmds in one. I will give an example - the cmds are 10. Five of them give you HP, the other five give you Armor. But we will get simplier - there are two cmds. The one is giving HP, the other is giving Armor. And I'm registering the with loop like this:
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "X"
#define VERSION "1.0"
#define AUTHOR "Flicker"


new const Stuff[][]=
{
    
""
    "say /hp"
,
    
"say /armor"
}

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    for(new 
1sizeof(Stuff); i++)
        
register_clcmd(Stuff[i], "TheOneFunction")
}


public 
TheOneFunction(id)
{
    
//Here I want to switch between each num of the const size. Like
    //in case 1 it will set_user_healt, in case the num of the size is 2 - it will set_user_armor
    //Is that possible?

Tried with this:
PHP Code:
public TheOneFunction(id
{
    for(new 
1sizeof(Stuff); i++)
    {
        switch(
i)
        {
            case 
1:
            case 
2:
        }
    }

Didn't work. Thanks in advance.
__________________

Last edited by Flick3rR; 05-26-2014 at 09:20.
Flick3rR is offline
Send a message via Skype™ to Flick3rR
 



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 09:43.


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