Hey,
I have this plugin , to heal t players to 100 health, its fuly working
i need an option also to heal all players , i want it to be at the end of the menu , (not in 2nd page if i have many players)
Code:
#include <amxmodx>
#include <fun>
public plugin_init()
{
register_clcmd( "say /healmenu","HealMenu" );
}
public HealMenu( id )
{
if(get_user_team(id) == 2)
{
new menu = menu_create( "\r[GC JB] \yHealing Menu!", "menu_handler" );
new players[32], pnum, tempid;
new szName[32], szUserId[32];
get_players( players, pnum, "ae", "TERRORIST" ); // flag "a" beca, flag "e" Team
for ( new i; i<pnum; i++ )
{
tempid = players[i];
get_user_name( tempid, szName, charsmax( szName ) );
formatex( szUserId, charsmax( szUserId ), "%d", get_user_userid( tempid ) );
menu_additem( menu, szName, szUserId, 0 );
}
menu_display( id, menu, 0 );
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
public menu_handler( id, menu, item )
{
//Do a check to see if they exited because menu_item_getinfo ( see below ) will give an error if the item is MENU_EXIT
if ( item == MENU_EXIT )
{
menu_destroy( menu );
return PLUGIN_HANDLED;
}
//now lets create some variables that will give us information about the menu and the item that was pressed/chosen
new szData[6], szName[64];
new _access, item_callback;
//heres the function that will give us that information ( since it doesnt magicaly appear )
menu_item_getinfo( menu, item, _access, szData,charsmax( szData ), szName,charsmax( szName ), item_callback );
//Get the userid of the player that was selected
new userid = str_to_num( szData );
//Try to retrieve player index from its userid
new player = find_player( "k", userid ); // flag "k" : find player from userid
//If player == 0, this means that the player's userid cannot be found
//If the player is still alive ( we had retrieved alive players when formating the menu but some players may have died before id could select an item from the menu )
if ( player && is_user_alive( player ) )
{
//Set their health to 100
set_user_health( player, 100 );
}
menu_destroy( menu );
return PLUGIN_HANDLED;
}