AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Compile Error ? (https://forums.alliedmods.net/showthread.php?t=243746)

Awesome_man 07-09-2014 04:58

Compile Error ?
 
Please someone correct it, i tried many time to correct but still compile error :\

Code:

#include <amxmodx>
#include <hamsandwich>

enum _:gMenu
{
    NAME[32],
    ACTION[32]
};

new const gMenu_cmds[] [gMenu] = {
    { "Buy Menu", "say /buy" }

};

public plugin_init(){
    register_plugin("","1.0","");   
    RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)   
    register_clcmd("say /menu","cmd_menu");
}


public cmd_menu(client){
    new m = menu_create("Your Menu :-","mHandler");

    for (new i; i < sizeof gMenu_cmds; i++)
        menu_additem(m,gMenu_cmds[i][NAME]);

    menu_display(client,m);
}

public mHandler(client,m,item)
{
    if( item == MENU_EXIT )
    {
        menu_destroy(m)       
        return PLUGIN_HANDLED;
    }
    else
    {
        client_cmd(client,"%s",gMenu_cmds[item][ACTION]);
        cmd_menu(client);
    }
   
    public fwHamPlayerSpawnPost(iPlayer) {
        if (is_user_alive(iPlayer))
        {
              engclient_cmd(iPlayer, "say /menu") 
        }
    return PLUGIN_HANDLED;


YamiKaitou 07-09-2014 05:00

Re: Compile Error ?
 
You are missing some brackets, you indentation shows you where

Awesome_man 07-09-2014 07:04

Re: Compile Error ?
 
Quote:

Originally Posted by YamiKaitou (Post 2164421)
You are missing some brackets, you indentation shows you where

I don't know much about amxx scripting.. If i know dat where the error, then why would i posting ?

Please help

mottzi 07-09-2014 07:37

Re: Compile Error ?
 
Posting into scripting help requires a minimum knowledge of programming. In your case, you don't even know how to handle block-brackets right, so I'd say you should first get some basic skills.

HamletEagle 07-09-2014 08:32

Re: Compile Error ?
 
You mistakes are obvious.....
PHP Code:

#include <amxmodx>
#include <hamsandwich>

enum _:gMenu
{
    
NAME[32],
    
ACTION[32]
};

new const 
gMenu_cmds[] [gMenu] = {
    { 
"Buy Menu""say /buy" }

};

public 
plugin_init(){
    
register_plugin("","1.0","");    
    
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost"1)    
    
register_clcmd("say /menu","cmd_menu");
}


public 
cmd_menu(client){
    
    new 
menu_create("Your Menu :-","mHandler");

    for (new 
isizeof gMenu_cmdsi++)
    
menu_additem(m,gMenu_cmds[i][NAME]);
    
    
menu_display(client,m);
}

public 
mHandler(client,m,item)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(m)        
        return 
PLUGIN_HANDLED;
    }
    else
    {
        
client_cmd(client,"%s",gMenu_cmds[item][ACTION]);
        
cmd_menu(client);
    }
}

public 
fwHamPlayerSpawnPost(iPlayer) {
    if (
is_user_alive(iPlayer)) 
    {
        
engclient_cmd(iPlayer"say /menu")  
        
        return 
PLUGIN_HANDLED;
        
    }
    



Awesome_man 07-10-2014 09:06

Re: Compile Error ?
 
Thanks guyz,

But whats wrong with the code, It's not applying /menu command automatically on clients when they spawn ?

Can someone help please ?

mottzi 07-10-2014 09:34

Re: Compile Error ?
 
You should do some debuging to find and solve problems on your own. This might cause the problem though I'm not that sure:

engclient_cmd(iPlayer, "say /menu")

>

cmd_menu(iPlayer)

fysiks 07-10-2014 10:40

Re: Compile Error ?
 
Quote:

Originally Posted by Awesome_man (Post 2165090)
Thanks guyz,

But whats wrong with the code, It's not applying /menu command automatically on clients when they spawn ?

Can someone help please ?

Please stick to one thread for one topic: https://forums.alliedmods.net/showthread.php?t=243130

Fuck For Fun 07-10-2014 18:57

Re: Compile Error ?
 
I do not understand why we have to do a check if the player lives that you are using spawn, he still comes back to life.
Take a check:
PHP Code:

/* Plugin generated by AMXX-Studio */

#include < amxmodx >
#include < hamsandwich >

enum _:gMenu
{
    
NAME[32],
    
ACTION[32]
};

new const 
gMenu_cmds[] [gMenu] = {
    { 
"Buy Menu""say /buy" }

};

public 
plugin_init(){
    
register_plugin("","1.0","");    
    
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost"1)    
    
register_clcmd("say /menu","cmd_menu");
}


public 
cmd_menu(client){
    
    new 
menu_create("Your Menu :-","mHandler");

    for (new 
isizeof gMenu_cmdsi++)
    
menu_additem(m,gMenu_cmds[i][NAME]);
    
    
menu_display(client,m);
}

public 
mHandler(client,m,item)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(m)        
        return 
PLUGIN_HANDLED;
    }
    else
    {
        
client_cmd(client,"%s",gMenu_cmds[item][ACTION]);
        
cmd_menu(client);
    }

    return 
PLUGIN_HANDLED;
}

public 
fwHamPlayerSpawnPost(iPlayer)
{
    
cmd_menuiPlayer )



wickedd 07-10-2014 19:12

Re: Compile Error ?
 
Quote:

Originally Posted by Fuck For Fun (Post 2165420)
I do not understand why we have to do a check if the player lives that you are using spawn, he still comes back to life.

Because spawn is called once when a player joins the server. So the code you posted will have errors.


All times are GMT -4. The time now is 21:09.

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