Raised This Month: $12 Target: $400
 3% 

drop hero


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bloodypro05
Junior Member
Join Date: Jul 2020
Location: Palestine
Old 08-26-2020 , 05:36   drop hero
Reply With Quote #1

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
bloodypro05 is offline
landfall
Junior Member
Join Date: Feb 2019
Old 09-09-2020 , 13:27   Re: drop hero
Reply With Quote #2

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;

landfall is offline
Krillin
Senior Member
Join Date: Jul 2004
Old 04-14-2021 , 09:27   Re: drop hero
Reply With Quote #3

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
__________________
Krillin's World Server(s) Operator


Last edited by Krillin; 04-14-2021 at 09:29.
Krillin is offline
Reply


Thread Tools
Display Modes

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 06:05.


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