AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Problem with Tero Menu (https://forums.alliedmods.net/showthread.php?t=232686)

Deliric 01-03-2014 09:45

Problem with Tero Menu
 
Im having troubles with the compilation of a plugin for the Tero menu. Im not sure what im doing wrong. These are the errors i got.

Code:

amx/include/colorchat.inc(4) : warning 201: redefinition of constant/macro (symbol "Color")
amx/include/colorchat.inc(12) : error 021: symbol already defined: "TeamName"
amx/include/colorchat.inc(20) : error 021: symbol already defined: "ColorChat"
amx/include/colorchat.inc(57) : error 021: symbol already defined: "ShowColorMessage"
amx/include/colorchat.inc(64) : error 021: symbol already defined: "Team_Info"
amx/include/colorchat.inc(72) : error 021: symbol already defined: "ColorSelection"
amx/include/colorchat.inc(87) : error 021: symbol already defined: "FindPlayer"
meniu_bonus.sma(108) : warning 213: tag mismatch
meniu_bonus.sma(109) : error 001: expected token: ";", but found "-identifier-"
meniu_bonus.sma(116) : error 001: expected token: ":", but found ";"
meniu_bonus.sma(116) : error 036: empty statement
meniu_bonus.sma(116) : error 002: only a single statement (or expression) can follow each "case"
meniu_bonus.sma(116) : fatal error 107: too many error messages on one line

source

Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <colorchat>
#include <hamsandwich>
#include <colorchat>
#pragma semicolon 1

static const PLUGIN[ ]        = "Bonus Menu";
static const VERSION[ ]        = "1.0";
static const AUTHOR[ ]        = "Rap";

new g_Menu;


public plugin_init( )
{
        register_plugin(PLUGIN, VERSION, AUTHOR);
        register_event("HLTV", "eventNewRound", "a", "1=0", "2=0");
        RegisterHam(Ham_Spawn, "player", "give_smoke", 1 );
        register_clcmd("say /tmenu", "eventNewRound");
        g_Menu = register_menuid("MENU");
        register_menucmd(g_Menu, 1023, "MenuAction");
}
public BonusMenu(id) ShowMenu(id);

public eventNewRound()
{
       
        new Players[32], iNum, player;
        get_players(Players, iNum, "ch");
       
        for( new i = 0; i < iNum; i++ )
        {
                player = Players[i];
               
                set_user_rendering(player, kRenderFxNone, 0, 0, 0, kRenderNormal, 0);
               
                if( cs_get_user_team(player) == CS_TEAM_T )
                {       
                if(user_has_weapon(player,CSW_AK47,0) || user_has_weapon(player,CSW_M4A1,0) || user_has_weapon(player,CSW_DEAGLE,0)){
                        ColorChat(player , TEAM_COLOR, "[ TREISUTE ]^x01 Nu mai ai acces la comanda");
                }
                else{
                set_task( 3.0, "BonusMenu", player );
                }
                }
                else
                {        ColorChat(player , TEAM_COLOR, "[ TREISUTE ]^x01 Doar la T poti sa folosesti aceasta comanda");        }
        }
}
public ShowMenu(id)
{

        new menuBody[512];
        add(menuBody, 511, "\rMeniu Bonus Tero^n^n");
        add(menuBody, 511, "\y1. \wAk47 + M4A1 + Deagle + Grenada care ingheata^n");
        add(menuBody, 511, "\y2. \wAk47 + Deagle + Grenada care ingheata^n");
        add(menuBody, 511, "\y3. \wM4A1 + Deagle + Grenada care ingheata^n");
        add(menuBody, 511, "\y4. \wSpeed + Grenada care ingheata^n");
        add(menuBody, 511, "\y5. \w100hp + ^n");
        add(menuBody, 511, "\y0. \wIesire");
       
       
        new KEYS = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<9 );
        show_menu(id, KEYS, menuBody, -1, "MENU");
        return PLUGIN_HANDLED;
}

public MenuAction(id, key)
{
        switch(key)
        {
                case 0:
                {
                        give_item(id, "weapon_m4a1");
                        cs_set_user_bpammo(id, CSW_M4A1, 0);
                        give_item(id, "weapon_ak47");
                        cs_set_user_bpammo(id, CSW_AK47, 0);
                        give_item(id, "weapon_deagle");
                        cs_set_user_bpammo(id, CSW_DEAGLE, 0);
                        ColorChat(id , TEAM_COLOR, "[ TREISUTE ]^x01 Ai primit pe langa M4A1, Ak47, deagle si o grenada care ingheata.");
                }
                case 1:
                {
                        give_item(id, "weapon_ak47");
                        cs_set_user_bpammo(id, CSW_AK47, 90);
                        give_item(id, "weapon_deagle");
                        cs_set_user_bpammo(id, CSW_DEAGLE, 21);
                        ColorChat(id , TEAM_COLOR, "[ TREISUTE ]^x01 Ai primit pe langa Ak47, deagle si o grenada care ingheata.");
                }
                case 2:
                {
                        give_item(id, "weapon_m4a1");
                        cs_set_user_bpammo(id, CSW_M4A1, 90);
                        give_item(id, "weapon_deagle");
                        cs_set_user_bpammo(id, CSW_DEAGLE, 21);
                        ColorChat(id , TEAM_COLOR, "[ TREISUTE ]^x01 Ai primit pe langa M4A1, deagle si o grenada care ingheata.");
                }
                case 3:
                {
                        set_user_maxspeed(id, 700.0);
                        ColorChat(id , TEAM_COLOR, "[ TREISUTE ]^x01 Ai primit 700 speed si o grenada care ingheata.");
                }
                case 4:
                {
                        set_user_health(id, 100.0)
                        ColorChat(id , TEAM_COLOR, "[ TREISUTE ]^x01 Ai primit 100 hp.");
                }
                case 9:
                {
                        return PLUGIN_HANDLED;
                }
               
                default; return PLUGIN_HANDLED;
        }
        return PLUGIN_HANDLED;
}

public give_smoke(){
        new Players[32], iNum, player;
        get_players(Players, iNum, "ch");
       
        for( new i = 0; i < iNum; i++ ){
                player = Players[i];
                set_user_rendering(player, kRenderFxNone, 0, 0, 0, kRenderNormal, 0);
                if( cs_get_user_team(player) == CS_TEAM_T ){
                        set_task(10.0, "smoke", player);
                }
        }
        return PLUGIN_CONTINUE;
public smoke(id){
        if ( !is_user_alive( id );
        return PLUGIN_HANDLED;

        give_item(id, "weapon_smokegrenade");
        return PLUGIN_HANDLED;
}

Thanks!

Black Rose 01-05-2014 04:30

Re: Problem with Tero Menu
 
Don't include colorchat twice. (the version you have was written by a noob so that it can repeat)

This native doesn't accept floats. You'll have to use integers.
Code:
set_user_health(id, 100.0)

I don't understand how you missed this when the error is written in english.
Code:
// meniu_bonus.sma(116) : error 001: expected token: ":", but found ";" default; return PLUGIN_HANDLED;

I don't have a running compiler. Come back if there are other problems.


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

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