Raised This Month: $51 Target: $400
 12% 

Why does not this code work?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PlutteN
Junior Member
Join Date: Jun 2007
Old 04-15-2009 , 09:53   Why does not this code work?
Reply With Quote #1

Hey!

I wonder why my code dont work... i have changed it from "auto bind menu" but it wont work?
When i generate it makes this error:
/home/groups/amxmodx/tmp3/textGzbPoG.sma(31) : error 037: invalid string (possibly non-terminated string)
/home/groups/amxmodx/tmp3/textGzbPoG.sma(31 -- 33) : error 001: expected token: ",", but found "-identifier-"
/home/groups/amxmodx/tmp3/textGzbPoG.sma(33) : warning 217: loose indentation
/home/groups/amxmodx/tmp3/textGzbPoG.sma(33) : error 017: undefined symbol "thanks"
/home/groups/amxmodx/tmp3/textGzbPoG.sma(33) : fatal error 107: too many error messages on one line




Code:
 #include <amxmodx>

#define autobindMenuKeys (1<<0)|(1<<1)|(1<<2)
#define PLUGIN "Autobinds"
#define VERSION "1.2"
#define AUTHOR "CLLlAgOB"
#define MAX_STRING_LEN 256
#define MAX_LINES 64

new help_dir,bind_ver
new key_set[MAX_LINES][MAX_STRING_LEN]
new key_command[MAX_LINES][MAX_STRING_LEN]

public plugin_init(){
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_menucmd(register_menuid("Auto Bind Menu"), autobindMenuKeys, "autobindmenu")
    help_dir = register_cvar("auto_helpdir","http://ya.ru")
    bind_ver = register_cvar("auto_ver","v1.0")
    load_settings("addons/amxmodx/configs/keys.ini")
    register_event("TeamInfo", "task_premenu", "b") 
}

public task_premenu(id)
    set_task(10.0,"task_autobindmenu",id)

public task_autobindmenu(id) {
    new crate[33],ver[33]  
    get_user_info(id,"autobind",crate,32)
    get_cvar_string("auto_ver",ver,31)
    if(!equali(crate, ver)){
        show_menu(id, autobindMenuKeys, "\rAuto Bind menu^n\w^n1. bind 'v' '+setlaser'  ^n2. Help (About this binding)  ^n3. No 

thanks i can bindy +setlaser myself", -1, "");
        return PLUGIN_HANDLED;
    }
    return PLUGIN_HANDLED;
}


load_settings(szFilename[]) {
    if (!file_exists(szFilename))
        return 0
    new num = 0
    new szText[MAX_STRING_LEN], setbuttn[MAX_STRING_LEN], setcommand[MAX_STRING_LEN]
    new a, pos = 0
    while (num < MAX_LINES && read_file(szFilename, pos++, szText, sizeof(szText), a)) {         
        if (szText[0] == ';' || szText[0] == '#')
            continue
        if (parse(szText,setbuttn,sizeof(setbuttn),setcommand,sizeof(setcommand)) < 2)
            continue

        copy(key_set[num], MAX_STRING_LEN - 1, setbuttn) 
        copy(key_command[num], MAX_STRING_LEN - 1, setcommand)
        num++
    }
    return 1
}
public autobindmenu(id, key) {
    switch (key) {
        case 0: func_autobind(id);
        case 1: {
            autobind_help(id);
            task_autobindmenu(id);
            }
        case 2: return PLUGIN_HANDLED;
    }
    return PLUGIN_HANDLED;
}
///---------------[Help]
public autobind_help(id)
{
    new dir[129]
    get_pcvar_string(help_dir,dir,128)
    show_motd(id, dir,"Help keys")
}

//---------------[AUTO BIND SYSTEM]---------------

public func_autobind(id)
{
    for (new i = 0; i <= (MAX_LINES-1); i++) {
        if(key_set[i][0]){
            client_cmd(id,"bind  %s ^"%s^"",key_set[i],key_command[i])
            }
    }
    new ver[129]
    get_pcvar_string(bind_ver,ver,128)
    client_cmd(id," setinfo autobind %s",ver)
    console_print(id,"Key Defaults are bound. ENJOY!")
    return PLUGIN_HANDLED
}
Im not so good at this so dont only explain for me change and explain

Thanks,
PlutteN is offline
Emilioneri
Senior Member
Join Date: Feb 2009
Location: Georgia, Tbilisi
Old 04-15-2009 , 10:04   Re: Why does not this code work?
Reply With Quote #2

PHP Code:
 #include <amxmodx>

#define autobindMenuKeys (1<<0)|(1<<1)|(1<<2)
#define PLUGIN "Autobinds"
#define VERSION "1.2"
#define AUTHOR "CLLlAgOB"
#define MAX_STRING_LEN 256
#define MAX_LINES 64

new help_dir,bind_ver
new key_set[MAX_LINES][MAX_STRING_LEN]
new 
key_command[MAX_LINES][MAX_STRING_LEN]

public 
plugin_init(){
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_menucmd(register_menuid("Auto Bind Menu"), autobindMenuKeys"autobindmenu")
    
help_dir register_cvar("auto_helpdir","http://ya.ru")
    
bind_ver register_cvar("auto_ver","v1.0")
    
load_settings("addons/amxmodx/configs/keys.ini")
    
register_event("TeamInfo""task_premenu""b"
}

public 
task_premenu(id)
    
set_task(10.0,"task_autobindmenu",id)

public 
task_autobindmenu(id) {
    new 
crate[33],ver[33]  
    
get_user_info(id,"autobind",crate,32)
    
get_cvar_string("auto_ver",ver,31)
    if(!
equali(cratever)){
        
show_menu(idautobindMenuKeys"\rAuto Bind menu^n\w^n1. bind 'v' '+setlaser'  ^n2. Help (About this binding)  ^n3. No thanks i can bindy +setlaser myself", -1"");
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_HANDLED;
}


load_settings(szFilename[]) {
    if (!
file_exists(szFilename))
        return 
0
    
new num 0
    
new szText[MAX_STRING_LEN], setbuttn[MAX_STRING_LEN], setcommand[MAX_STRING_LEN]
    new 
apos 0
    
while (num MAX_LINES && read_file(szFilenamepos++, szTextsizeof(szText), a)) {         
        if (
szText[0] == ';' || szText[0] == '#')
            continue
        if (
parse(szText,setbuttn,sizeof(setbuttn),setcommand,sizeof(setcommand)) < 2)
            continue

        
copy(key_set[num], MAX_STRING_LEN 1setbuttn
        
copy(key_command[num], MAX_STRING_LEN 1setcommand)
        
num++
    }
    return 
1
}
public 
autobindmenu(idkey) {
    switch (
key) {
        case 
0func_autobind(id);
        case 
1: {
            
autobind_help(id);
            
task_autobindmenu(id);
            }
        case 
2: return PLUGIN_HANDLED;
    }
    return 
PLUGIN_HANDLED;
}
///---------------[Help]
public autobind_help(id)
{
    new 
dir[129]
    
get_pcvar_string(help_dir,dir,128)
    
show_motd(iddir,"Help keys")
}

//---------------[AUTO BIND SYSTEM]---------------

public func_autobind(id)
{
    for (new 
0<= (MAX_LINES-1); i++) {
        if(
key_set[i][0]){
            
client_cmd(id,"bind  %s ^"%s^"",key_set[i],key_command[i])
            }
    }
    new 
ver[129]
    
get_pcvar_string(bind_ver,ver,128)
    
client_cmd(id," setinfo autobind %s",ver)
    
console_print(id,"Key Defaults are bound. ENJOY!")
    return 
PLUGIN_HANDLED

1. Compiles fine but didn't tested
2. you should post this in Scripting Help
__________________

Last edited by Emilioneri; 04-20-2009 at 13:56.
Emilioneri is offline
Send a message via Skype™ to Emilioneri
Old 04-25-2009, 00:16
charactereducation
This message has been deleted by YamiKaitou. Reason: spam
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-25-2009 , 02:23   Re: Why does not this code work?
Reply With Quote #3

Moved to Scripting Help.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x 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:50.


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