First sry about messy code. Todally untested too:
Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#define MENU_SIZE 256
#define MENU_PLAYERS 8
new g_iMenuPosition;
new g_iMenuPlayers[32];
public plugin_init()
{
register_menucmd( register_menuid("\rAmmo menu:"), 1023, "MenuAction" );
register_clcmd( "Ammo_menu", "ShowMenu" , ADMIN_BAN, "- Shows The Ammo Menu" );
}
public ShowMenu( id, lvl, cid )
{
if( cmd_access( id, lvl, cid, 1 ) )
ShowPlayerMenu( id, g_iMenuPosition = 0 );
return PLUGIN_HANDLED
}
public ShowPlayerMenu( id, pos )
{
if( pos < 0 ) return
new i, j;
new szMenuBody[MENU_SIZE];
new iCurrKey = 0;
new szUserName[32];
new iStart = pos * MENU_PLAYERS;
new iNum;
get_players( g_iMenuPlayers, iNum );
if( iStart >= iNum )
iStart = pos = g_iMenuPosition = 0;
new iLen = format( szMenuBody, MENU_SIZE-1, "\rAmmo menu:\R%d/%d^n\w^n", pos+1, (iNum / MENU_PLAYERS + ((iNum % MENU_PLAYERS) ? 1 : 0 )) );
new iEnd = iStart + MENU_PLAYERS;
new iKeys = (1<<9|1<<7);
if( iEnd > iNum )
iEnd = iNum;
for( i = iStart; i < iEnd; i++ )
{
j = g_iMenuPlayers[i];
get_user_name( j, szUserName, 31 );
if( (get_user_flags(j) & ADMIN_IMMUNITY) || !is_user_alive(j) )
{
iKeys |= (1<<iCurrKey++);
iLen += format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "%d. %s^n", iCurrKey, szUserName );
}else
{
iKeys |= (1<<iCurrKey++);
iLen += format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "%d. %s^n", iCurrKey, szUserName );
}
}
if( iEnd != iNum )
{
format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "^n9. More...^n0. %s", pos ? "Back" : "Exit" );
iKeys |= (1<<8);
}
else
format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "^n0. %s", pos ? "Back" : "Exit" );
show_menu( id, iKeys, szMenuBody, -1 );
return
}
public MenuAction( id, key )
{
switch( key )
{
case 8: ShowPlayerMenu( id, ++g_iMenuPosition ) // More Option
case 9: ShowPlayerMenu( id, --g_iMenuPosition ) // Back Option
// Chose a Player
default:
{
new iPlayerID = g_iMenuPlayers[g_iMenuPosition * MENU_PLAYERS + key];
//Do your ammo commands with iPlayerID
}
}
return PLUGIN_HANDLED
}
Okay 3. week thing is that I couldn't find command that gives ammos in clips, but if you want mess with these here:
cs_get_user_bpammo(index, weapon) (gets ammos from specific weapon's "backpack")
cs_set_user_bpammo(index, weapon, amount) (sets ammos to specific weapon's "backpack")
cs_get_weapon_ammo(index) (gets ammos from the clip and from weapon you are using)
cs_set_weapon_ammo(index, newammo) (sets ammos to the clip and that weapon you are using)
I hope those helps. There must be easier way, too hard to check every single weapon and give that amount of ammos. I just don't know easier way :I