Problem With A plugin

  • You can only download a plugin when you are REGISTERED, so Get yourself Registered first, its FREE and wont take more than 10 Secs
Dec 10, 2017
47
2
8
15
#1
Code:
#include <amxmodx>

#define Plugin <EIB Player Menu>
#define Version <1.0>
#define Author <Harsh Ojha>

public plugin_init()
{
register_plugin("EIB Player Menu", "1.0", "Harsh Ojha");
register_clcmd("/menu", "ShowMenu", _, "");
}

public ShowMenu(id)
{
new menu = menu_create("EIB PLAYERS MENU", "mh_EIBPlayerMenu");

menu_additem(menu, "Server Owners", "", 0); // case 0
menu_additem(menu, "Server Manager", "", 0); // case 1
menu_additem(menu, "Facebook Group Name", "", 0); // case 2
menu_additem(menu, "For Adminship Contact", "", 0); // case 3
menu_additem(menu, "Server IP", "", 0); // case 4

menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_setprop(menu, MPROP_NOCOLORS, 1);
menu_setprop(menu, MPROP_NUMBER_COLOR, "\y");

menu_display(id, menu, 0);

return PLUGIN_HANDLED;
}

public mh_EIBPlayerMenu(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_cancel(id);
return PLUGIN_HANDLED;
}

new command[6], name[64], access, callback;

menu_item_getinfo(menu, item, access, command, sizeof command - 1, name, sizeof name - 1, callback);

switch(item)
{
case 0: client_print(id, print_chat, "SerVer Owner -");
case 1: client_print(id, print_chat, "HarsH Ojha([URL='https://lm.facebook.com/l.php?u=http%3A%2F%2Ffb.com%2Fharsh.ojha.33&h=ATNugYjTltKnWBnmTyjZrcebVTbIvv3hjK4A1Ddz1Mr_puzxSiHB6rm75EtkVO8BN4tC74PLDZ3pMtV2ZSTq_TaAjWNvlkHYTKAmkWk12VnVX_ulBQFsZDMastGEfnZdbBikC_AkAgSQtvG7Rve7MfvQNLA&s=1']fb.com/harsh.ojha.33[/URL])");
case 2: client_print(id, print_chat, "EIB XP MODE SERVER");
case 3: client_print(id, print_chat, "Harsh Ojha");
case 4: client_print(id, print_chat, "139.59.84.213:27100");
}

menu_display(id, menu, 0);

return PLUGIN_HANDLED;
}


Can Anyone tell me the mistake in this coz is not running in the server. :)
 
Last edited by a moderator:

DiGiTaL

Active Member
Staff member
Administrator
Moderator
Dec 9, 2017
164
32
28
18
Rajasthan, India
jatinsarda.me
#5
@HARSH OJHA There is no meaning to Define AUTHOR, VERSION separately if you dont want to use them anywhere except REGISTER_Plugin
And there is no sense to make new Constants when you are not using them :
new command[6], name[64], access, callback;

menu_item_getinfo(menu, item, access, command, sizeof command - 1, name, sizeof name - 1, callback);
Try this one and tell me if it has any problem or not :) :
Code:
#include <amxmodx>

public plugin_init()
{
register_plugin("EIB Player Menu", "1.0", "Harsh Ojha");
register_clcmd("/menu", "ShowMenu");
}

public ShowMenu(id)
{
new menu = menu_create("EIB PLAYERS MENU", "mh_EIBPlayerMenu");

menu_additem(menu, "Server Owners", "", 0); // case 0
menu_additem(menu, "Server Manager", "", 0); // case 1
menu_additem(menu, "Facebook Group Name", "", 0); // case 2
menu_additem(menu, "For Adminship Contact", "", 0); // case 3
menu_additem(menu, "Server IP", "", 0); // case 4

menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_setprop(menu, MPROP_NOCOLORS, 1);
menu_setprop(menu, MPROP_NUMBER_COLOR, "\y");

menu_display(id, menu, 0);
}

public mh_EIBPlayerMenu(id, menu, item)
{
    switch(item)
    {
        case 0: client_print(id, print_chat, "SerVer Owner -");
        case 1: client_print(id, print_chat, "HarsH Ojha([URL='https://lm.facebook.com/l.php?u=http%3A%2F%2Ffb.com%2Fharsh.ojha.33&h=ATNugYjTltKnWBnmTyjZrcebVTbIvv3hjK4A1Ddz1Mr_puzxSiHB6rm75EtkVO8BN4tC74PLDZ3pMtV2ZSTq_TaAjWNvlkHYTKAmkWk12VnVX_ulBQFsZDMastGEfnZdbBikC_AkAgSQtvG7Rve7MfvQNLA&s=1']fb.com/harsh.ojha.33[/URL])");
        case 2: client_print(id, print_chat, "EIB XP MODE SERVER");
        case 3: client_print(id, print_chat, "Harsh Ojha");
        case 4: client_print(id, print_chat, "139.59.84.213:27100");
    }
    menu_destroy( menu );
    return PLUGIN_HANDLED;
}
 

P!KaChu~

New Member
Dec 10, 2017
15
4
3
14
Zm_Foda
#6
The Generator is bad dont use it try to make a simple menu with not other extension made simple become expert :D
 

ishchhabra

New Member
Jan 19, 2018
5
0
1
17
#7
@HARSH OJHA There is no meaning to Define AUTHOR, VERSION separately if you dont want to use them anywhere except REGISTER_Plugin
And there is no sense to make new Constants when you are not using them :


Try this one and tell me if it has any problem or not :) :
Code:
#include <amxmodx>

public plugin_init()
{
register_plugin("EIB Player Menu", "1.0", "Harsh Ojha");
register_clcmd("/menu", "ShowMenu");
}

public ShowMenu(id)
{
new menu = menu_create("EIB PLAYERS MENU", "mh_EIBPlayerMenu");

menu_additem(menu, "Server Owners", "", 0); // case 0
menu_additem(menu, "Server Manager", "", 0); // case 1
menu_additem(menu, "Facebook Group Name", "", 0); // case 2
menu_additem(menu, "For Adminship Contact", "", 0); // case 3
menu_additem(menu, "Server IP", "", 0); // case 4

menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_setprop(menu, MPROP_NOCOLORS, 1);
menu_setprop(menu, MPROP_NUMBER_COLOR, "\y");

menu_display(id, menu, 0);
}

public mh_EIBPlayerMenu(id, menu, item)
{
    switch(item)
    {
        case 0: client_print(id, print_chat, "SerVer Owner -");
        case 1: client_print(id, print_chat, "HarsH Ojha([URL='https://lm.facebook.com/l.php?u=http%3A%2F%2Ffb.com%2Fharsh.ojha.33&h=ATNugYjTltKnWBnmTyjZrcebVTbIvv3hjK4A1Ddz1Mr_puzxSiHB6rm75EtkVO8BN4tC74PLDZ3pMtV2ZSTq_TaAjWNvlkHYTKAmkWk12VnVX_ulBQFsZDMastGEfnZdbBikC_AkAgSQtvG7Rve7MfvQNLA&s=1']fb.com/harsh.ojha.33[/URL])");
        case 2: client_print(id, print_chat, "EIB XP MODE SERVER");
        case 3: client_print(id, print_chat, "Harsh Ojha");
        case 4: client_print(id, print_chat, "139.59.84.213:27100");
    }
    menu_destroy( menu );
    return PLUGIN_HANDLED;
}
Define dont take any extra memory or CPU. So, its no harm to use them if that makes your code more readable.
 

DiGiTaL

Active Member
Staff member
Administrator
Moderator
Dec 9, 2017
164
32
28
18
Rajasthan, India
jatinsarda.me
#8
@ishchhabra Take a look again, He mentioned NAME,VERSION, AUTHOR in register itself so there is no Meaning to define them again
And Yes you are correct on Defines , they dont use any resource :)
But there is no sense to define same things twice
 

marshhhhh

森羅転生
Staff member
Moderator
May 10, 2018
19
6
3
Kottayam, Kerala
steamcommunity.com
#10
Code:
#include <amxmodx>

public plugin_init()
{
    register_plugin("lol", "0", "lol")
    register_clcmd("say /lul", "lol_menu")
}

public lol_menu(id)
{
    new menu = menu_create("Your header here", "lmao")
    menu_additem(menu, "option 1",  "1", 0)
    menu_additem(menu, "option 2",  "2", 0)
    menu_additem(menu, "option 3",  "3", 0)
    menu_additem(menu, "option 4",  "4", 0)
    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
    menu_display(id, menu, 0)
}

public lmao(id, menu, item)     
{   
    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:
        {
            client_print(id, print_chat, " Lol ")
        }
        case 2:
        {
            client_print(id, print_chat, " Lol ")
        }
        case 3:
        {
            client_print(id, print_chat, " Lol ")
        }
        case 4:
        {
            client_print(id, print_chat, " Lol ")
        }
    }
    menu_destroy(menu)
    return PLUGIN_HANDLED_MAIN;
}
its a basic menu format, yet usefull and works :)