AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   What I do wrong? (https://forums.alliedmods.net/showthread.php?t=77206)

JahMan 09-07-2008 13:13

What I do wrong?
 
PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Nowy Plugin"
#define VERSION "1.0"
#define AUTHOR "JahMan"

 
new const sounds[][] = {  
"sound/misc/OE/oe_01.mp3",  
"sound/misc/OE/oe_02.mp3",  
"sound/misc/OE/oe_03.mp3",  
"sound/misc/OE/oe_04.mp3",  
"sound/misc/OE/oe_05.mp3",  
"sound/misc/OE/oe_06.mp3",  
"sound/misc/OE/oe_07.mp3",  
"sound/misc/OE/oe_08.mp3",  
"sound/misc/OE/oe_09.mp3",  
"sound/misc/OE/oe_10.mp3",  
"sound/misc/OE/oe_11.mp3",  
"sound/misc/OE/oe_12.mp3",  
"sound/misc/OE/oe_13.mp3",  
"sound/misc/OE/oe_14.mp3",  
"sound/misc/OE/oe_15.mp3",  
"sound/misc/OE/oe_16.mp3",  
"sound/misc/OE/oe_17.mp3",  
"sound/misc/OE/oe_18.mp3",  
"sound/misc/OE/oe_19.mp3",  
"sound/misc/OE/oe_20.mp3"}  

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("amx_menu""menu")
    
}

public 
menu(id)
{
    new 
menu menu_create("rMenu muzyki!:""wybieranie")
    
    
menu_additem(menu"\wops""3"ADMIN_KICK
    
menu_additem(menu"\wops""3"ADMIN_KICK)
    
menu_additem(menu"\wops""3"ADMIN_KICK)  
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL)
    
    
menu_display(idmenu0)

}

public 
wybieranie(idmenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    new 
data[6], iName[64]
    new 
accescallback
    menu_item_getinfo
(menuitemaccesdata,5iName63callback)
    
    new 
key str_to_num(data)
    
    switch(
key)
    {
        case 
1:
           
client_cmd(0"mp3 play sound/misc/OE/oe_13.mp3")
            return 
PLUGIN_CONTINUE
        
}
        
        case 
2:
            
client_cmd(0"mp3 play sound/misc/OE/oe_13.mp3")
            return 
PLUGIN_CONTINUE
        
}
        
        case 
3:
           
client_cmd(0"mp3 play sound/misc/OE/oe_13.mp3"
             return 
PLUGIN_CONTINUE
        
}
    }
 public 
plugin_precache()
{
    new 
i
    
for(0sizeof soundsi++)
    
precache_generic(sounds[i])
}  
     return 
PLUGIN_CONTINUE



What I do wrong ? In PAWN studio I have this erors:

Code:
/home/groups/amxmodx/tmp3/texthgvcun.sma(69) : error 002: only a single statement (or expression) can follow each "case" /home/groups/amxmodx/tmp3/texthgvcun.sma(69 -- 70) : warning 215: expression has no effect /home/groups/amxmodx/tmp3/texthgvcun.sma(70) : warning 209: function "wybieranie" should return a value /home/groups/amxmodx/tmp3/texthgvcun.sma(72) : error 010: invalid function or declaration /home/groups/amxmodx/tmp3/texthgvcun.sma(74) : error 010: invalid function or declaration /home/groups/amxmodx/tmp3/texthgvcun.sma(77) : error 010: invalid function or declaration /home/groups/amxmodx/tmp3/texthgvcun.sma(79) : error 010: invalid function or declaration /home/groups/amxmodx/tmp3/texthgvcun.sma(88) : error 010: invalid function or declaration

Arkshine 09-07-2008 13:31

Re: What I do wrong?
 
Tip : forget some '{' in wybieranie() and the last 2 lines are not needed. You should be more rigorous.

JahMan 09-07-2008 14:13

Re: What I do wrong?
 
This is my first time ;)
PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Nowy Plugin"
#define VERSION "1.0"
#define AUTHOR "JahMan"

 
new const sounds[][] = {  
"sound/misc/OE/oe_01.mp3",  
"sound/misc/OE/oe_02.mp3",  
"sound/misc/OE/oe_03.mp3",  
"sound/misc/OE/oe_04.mp3",  
"sound/misc/OE/oe_05.mp3",  
"sound/misc/OE/oe_06.mp3",  
"sound/misc/OE/oe_07.mp3",  
"sound/misc/OE/oe_08.mp3",  
"sound/misc/OE/oe_09.mp3",  
"sound/misc/OE/oe_10.mp3",  
"sound/misc/OE/oe_11.mp3",  
"sound/misc/OE/oe_12.mp3",  
"sound/misc/OE/oe_13.mp3",  
"sound/misc/OE/oe_14.mp3",  
"sound/misc/OE/oe_15.mp3",  
"sound/misc/OE/oe_16.mp3",  
"sound/misc/OE/oe_17.mp3",  
"sound/misc/OE/oe_18.mp3",  
"sound/misc/OE/oe_19.mp3",  
"sound/misc/OE/oe_20.mp3"}  

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("amx_menu""menu")
    
}

public 
menu(id)
{
    new 
menu menu_create("rMenu muzyki!:""wybieranie")
    
    
menu_additem(menu"\wops""3"ADMIN_KICK
    
menu_additem(menu"\wops""3"ADMIN_KICK)
    
menu_additem(menu"\wops""3"ADMIN_KICK)  
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL)
    
    
menu_display(idmenu0)

}

public 
wybieranie(idmenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    new 
data[6], iName[64]
    new 
accescallback
    menu_item_getinfo
(menuitemaccesdata,5iName63callback)
    
    new 
key str_to_num(data)
    
    switch(
key)
    {
        case 
1:
        {
           
client_cmd(0"mp3 play sound/misc/OE/oe_13.mp3")
            return 
PLUGIN_CONTINUE
        
}
        
        case 
2:
        {
            
client_cmd(0"mp3 play sound/misc/OE/oe_13.mp3")
            return 
PLUGIN_CONTINUE
        
}
        
        case 
3:
        {
           
client_cmd(0"mp3 play sound/misc/OE/oe_13.mp3"
             return 
PLUGIN_CONTINUE
        
}
    }
 public 
plugin_precache()

    new 
i
    
for(0sizeof soundsi++)
    
precache_generic(sounds[i]) 

what is wrong with plugin_precache()

I have 3 Errors/home/groups/amxmodx/tmp3/textPBSxON.sma(70) : warning 217: loose indentation
/home/groups/amxmodx/tmp3/textPBSxON.sma(82) : warning 217: loose indentation
/home/groups/amxmodx/tmp3/textPBSxON.sma(85) : warning 217: loose indentation
/home/groups/amxmodx/tmp3/textPBSxON.sma(85) : error 029: invalid expression, assumed zero
/home/groups/amxmodx/tmp3/textPBSxON.sma(85) : error 004: function "plugin_precache" is not implemented
/home/groups/amxmodx/tmp3/textPBSxON.sma(87) : warning 217: loose indentation
/home/groups/amxmodx/tmp3/textPBSxON.sma(89) : error 001: expected token: "}", but found "-end of file-"

Arkshine 09-07-2008 14:21

Re: What I do wrong?
 
All function should be like :

My_Function()
{

}

or

My_Function() {

}


So, check all your functions and see if { or } are needed.


All times are GMT -4. The time now is 03:12.

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