Raised This Month: $ Target: $400
 0% 

[HELP] Switch between const size numbers


Post New Thread Reply   
 
Thread Tools Display Modes
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 05-26-2014 , 12:51   Re: [HELP] Switch between const size numbers
Reply With Quote #11

But I use a lot of cmd's, not only 3. However, here is the decision I've made
Like this:
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

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

enum _:Data
{
    
_cmd[32],
    
_func[32]
}

new 
num

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

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


public 
GiveHP(id){     num 1; Function(id);}
public 
GiveArmor(id){     num 2; Function(id);}

public Function(
id)
{
    
//Bla, bla, bla
    //Doin my stuff usong the needed num from the constant :D

__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
DavidJr
Senior Member
Join Date: Apr 2012
Old 05-26-2014 , 13:05   Re: [HELP] Switch between const size numbers
Reply With Quote #12

Just change the limit Btw, can you explain what is this part?

Code:
enum _:Data {     _cmd[32],     _func[32] }
__________________
What are you looking for here?
DavidJr is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 05-26-2014 , 13:31   Re: [HELP] Switch between const size numbers
Reply With Quote #13

Quote:
Originally Posted by DavidJr View Post
Ah, may I know know why must it be x - 1?
Because you have to leave room for the null terminator
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 05-26-2014 , 13:57   Re: [HELP] Switch between const size numbers
Reply With Quote #14

Quote:
Originally Posted by YamiKaitou View Post
Off topic:
Quote:
Originally Posted by Pawn Tutorial
new a = 5
...
a-- //returns 4, post decrement
--a //returns 4, pre decrement
That doesn't seem right.
a-- would return 5.
--a would return 4.

I know the result is the same, but the return isn't.
__________________

Last edited by Black Rose; 05-26-2014 at 13:58.
Black Rose 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 09:43.


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