AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Tech Support (https://forums.alliedmods.net/forumdisplay.php?f=36)
-   -   drop hero (https://forums.alliedmods.net/showthread.php?t=326975)

bloodypro05 08-26-2020 05:36

drop hero
 
Hey,
is it possible to have /drop command in a menu ?
like when u type drop u get a menu with ur all heroes and choose one of them to drop

landfall 09-09-2020 13:27

Re: drop hero
 
It is. I have it on my server, you can connect 95.142.47.100:27015 and try it.
I have this code in my superheromodnvault.sma:
PHP Code:

public DropMenu(id)
{
    new 
string[200]
    
    
formatex(string200"%L"id"MENU_DM_TITLE")
    new 
menu menu_create(string"mh_DropMenu");
    
    new 
heroIndex
    
new playerpowercount getPowerCount(id)
    for ( new 
1<= playerpowercount && <= SH_MAXLEVELSx++ )
    {
        
heroIndex gPlayerPowers[id][x]
        
menu_additem(menugSuperHeros[heroIndex][hero])
    }

    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_setprop(menuMPROP_NUMBER_COLOR"\w");
    
    
formatex(string128"%L"id"MENU_BACK")
    
menu_setprop(menuMPROP_BACKNAMEstring);
    
formatex(string128"%L"id"MENU_MORE")
    
menu_setprop(menuMPROP_NEXTNAMEstring);
    
formatex(string128"%L"id"MENU_CANCEL")
    
menu_setprop(menuMPROP_EXITNAMEstring);

    
menu_display(idmenu0);

    return 
PLUGIN_HANDLED;
}
//----------------------------------------------------------------------------------------------
public mh_DropMenu(idmenux)
{
    if ( !
is_user_connected(id) || is_user_bot(id) ) return PLUGIN_HANDLED;
    
    if (
== MENU_EXIT)
    {
        
menu_cancel(id);
        
MainMenu(id);
        return 
PLUGIN_HANDLED;
    }

    new 
command[6], name[64], accesscallback;

    
menu_item_getinfo(menuxaccesscommandsizeof command 1namesizeof name 1callback);

    
1
    
new heroIndex gPlayerPowers[id][x]
    
debugMsg(id1"Dropping Hero: %s"gSuperHeros[heroIndex][hero])
    
clearPower(idx)
    
chatMessage(id_"%L"id"SHMOD_DROP_SUCCESS"gSuperHeros[heroIndex][hero])
    
displayPowers(idtrue)
    if (
getPowerCount(id) > 0)
        
DropMenu(id);
    else
        
MainMenu(id);

    
menu_destroy(menu);

    return 
PLUGIN_HANDLED;



Krillin 04-14-2021 09:27

Re: drop hero
 
Very interesting concept. We use MySQL so we do not use the vault file. I might give this a go myself. You should have just put this in the superheromod.sma file or created your own file like shmdrophero.inc and then just included it in the superheromod.sma file. This way, your work doesn't get replaced with the file should you circum to file corruption or better yet hard drive loss.

-Krillin


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

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