Raised This Month: $ Target: $400
 0% 

Menu not showing up


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JRISETH
Junior Member
Join Date: Jun 2011
Old 06-16-2011 , 18:00   Menu not showing up
Reply With Quote #1

Hello guys,

So i've made small VIP menu today and when I tested it, it doesn't show up.

Code:
Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <colorchat>
#include <cstrike>
#include <csx>
#include <fun>

public plugin_init() {
    register_plugin("V.I.P", "1.0", "JRISETH");

    register_clcmd("say /osta", "ostaHandler");
    register_clcmd("say_team /osta", "ostaHandler");
    register_clcmd("say /vipid", "vipidHandler");
    register_clcmd("say_team /vipid", "vipidHandler");
    register_clcmd("say /vipmenu", "showPrimaryWeaponMenu");

    register_logevent("roundStart",2,"0=World triggered","1=Round_Start")
}

public ostaHandler(id) {
    show_motd(id, "adminvipbuy.txt");
}

public roundStart() {
    new players[32], player, pnum;
    get_players(players, pnum, "a");
    for(new i = 0; i < pnum; i++) {
        player = players[i];
        if (get_user_flags(player) & ADMIN_LEVEL_B) {
            showPrimaryWeaponMenu(player);
        }
        else {
            ColorChat(player, NORMAL, "^x04[GamersDestiny]:^x01 Sa ei ole^x04 V.I.P!^x01 Osta juba täna, kirjuta^x04 /osta");
        }
    }
}

public showPrimaryWeaponMenu(id) {
    new menu = menu_create("Vali primaarne relv:", "primaryWeaponMenuHandler");

    menu_additem(menu, "M4A1", "1", 0);
    menu_additem(menu, "AK47", "2", 0);
    menu_additem(menu, "FAMAS", "3", 0);
    menu_additem(menu, "GALIL", "4", 0);
    menu_additem(menu, "M3", "5", 0);
    menu_additem(menu, "M249", "6", 0);

    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
    menu_display(id, menu, 0);
}

public primaryWeaponMenuHandler(id, menu, item) {
     if(item == MENU_EXIT) {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
    
    new data[6], iName[64], access, callback;
    
    menu_item_getinfo(menu, item, access, data, 5, iName, 63, callback);
    new key = str_to_num(data);
    switch(key) {
        case 1: {
            give_item(id, "weapon_m4a1");
            cs_set_user_bpammo(id, CSW_M4A1, 90);
        }
        case 2: {
            give_item(id, "weapon_ak47");
            cs_set_user_bpammo(id, CSW_AK47, 90);
        }
        case 3: {
            give_item(id, "weapon_famas");
            cs_set_user_bpammo(id, CSW_FAMAS, 90);
        }
        case 4: {
            give_item(id, "weapon_galil");
            cs_set_user_bpammo(id, CSW_GALIL, 90);
        }
        case 5: {
            give_item(id, "weapon_m3");
            cs_set_user_bpammo(id, CSW_M3, 32);
        }
        case 6: {
            give_item(id, "weapon_m249");
            cs_set_user_bpammo(id, CSW_M249, 200);
        }
    }
    menu_destroy(menu);

    showSecondaryWeaponMenu(id);
    
    return PLUGIN_HANDLED;
}

public showSecondaryWeaponMenu(id) {
    new menu = menu_create("Vali sekundaarne relv:", "secondaryWeaponHandler");

    menu_additem(menu, "GLOCK", "1", 0);
    menu_additem(menu, "USP", "2", 0);
    menu_additem(menu, "ELITE", "3", 0);
    menu_additem(menu, "FIVESEVEN", "4", 0);
    menu_additem(menu, "DEAGLE", "5", 0);

    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
    menu_display(id, menu, 0);
}

public secondaryWeaponHandler(id, menu, item) {
     if(item == MENU_EXIT) {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
    
    new data[6], iName[64], access, callback;
    
    menu_item_getinfo(menu, item, access, data, 5, iName, 63, callback);
    new key = str_to_num(data);
    switch(key) {
        case 1: {
            give_item(id, "weapon_glock18");
            cs_set_user_bpammo(id, CSW_GLOCK18, 120);
        }
        case 2: {
            give_item(id, "weapon_usp");
            cs_set_user_bpammo(id, CSW_USP, 100);
        }
        case 3: {
            give_item(id, "weapon_elite");
            cs_set_user_bpammo(id, CSW_ELITE, 30);
        }
        case 4: {
            give_item(id, "weapon_fiveseven");
            cs_set_user_bpammo(id, CSW_FIVESEVEN, 50);
        }
        case 5: {
            give_item(id, "weapon_deagle");
            cs_set_user_bpammo(id, CSW_DEAGLE, 35);
        }
    }
    menu_destroy(menu);

    give_item(id, "weapon_flashbang");
    give_item(id, "weapon_flashbang");
    give_item(id, "weapon_hegrenade");
    give_item(id, "weapon_smokegrenade");

    return PLUGIN_HANDLED;
}
JRISETH is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 06-16-2011 , 18:47   Re: Menu not showing up
Reply With Quote #2

I'm not sure but i think it's because you use this:
PHP Code:
register_clcmd("say /vipid""vipidHandler"); 
register_clcmd("say_team /vipid""vipidHandler"); 
but you never use vipidHandler() anywhere in the code,
which could cause a runtime error and should be in the error logs.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
MeRcyLeZZ
Veteran Member
Join Date: Dec 2007
Old 06-16-2011 , 23:00   Re: Menu not showing up
Reply With Quote #3

When does it not show up? On round start or when they type /vipmenu ?
__________________
MeRcyLeZZ is offline
JRISETH
Junior Member
Join Date: Jun 2011
Old 06-17-2011 , 04:50   Re: Menu not showing up
Reply With Quote #4

Quote:
Originally Posted by drekes View Post
I'm not sure but i think it's because you use this:
PHP Code:
register_clcmd("say /vipid""vipidHandler"); 
register_clcmd("say_team /vipid""vipidHandler"); 
but you never use vipidHandler() anywhere in the code,
which could cause a runtime error and should be in the error logs.
Thanks, fixed
JRISETH is offline
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 06-17-2011 , 05:13   Re: Menu not showing up
Reply With Quote #5

Quote:
Originally Posted by drekes View Post
I'm not sure but i think it's because you use this:
PHP Code:
register_clcmd("say /vipid""vipidHandler"); 
register_clcmd("say_team /vipid""vipidHandler"); 
but you never use vipidHandler() anywhere in the code,
which could cause a runtime error and should be in the error logs.
lol didn't see that xD

but I still don't think you should name the menus the same name
Erox902 is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 06-17-2011 , 08:47   Re: Menu not showing up
Reply With Quote #6

Quote:
Originally Posted by Erox902 View Post
but I still don't think you should name the menus the same name
It's okay if he wants to do the exacty same thing for both commands.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 06-17-2011 , 04:02   Re: Menu not showing up
Reply With Quote #7

I think it's cuz you namned both menus "menu" I don't think you can do that.
Erox902 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-17-2011 , 16:26   Re: Menu not showing up
Reply With Quote #8

Quote:
Originally Posted by Erox902 View Post
I think it's cuz you namned both menus "menu" I don't think you can do that.
They are both local variables (to different functions) and will not affect eachother.
__________________
fysiks is online now
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 06-17-2011 , 17:36   Re: Menu not showing up
Reply With Quote #9

won't they get screwed up in the handler I mean when you:
PHP Code:
public menuHandler(idmenuitem
?
Erox902 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-17-2011 , 17:48   Re: Menu not showing up
Reply With Quote #10

Quote:
Originally Posted by Erox902 View Post
won't they get screwed up in the handler I mean when you:
PHP Code:
public menuHandler(idmenuitem
?
No. Those are local variables also. You can think about it like this: The variables in the function declaration are newly created local variables that are auto-populated by the calling function. So, when menuHandler() is called, it creates the three variables id, menu, and item. Then it sets their value as supplied by the function that is calling it (the new menu system).

So, the variable "menu" will contain the menu pointer of the menu that just had an option chosen from it.
__________________
fysiks is online now
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 23:31.


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