Raised This Month: $32 Target: $400
 8% 

[REQUEST] Admin CMD, Give Ammo-Clip to player via menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Virtual-Vybz
Senior Member
Join Date: Apr 2008
Old 08-14-2008 , 16:23   [REQUEST] Admin CMD, Give Ammo-Clip to player via menu
Reply With Quote #1

Hey all Scripters in here. Im searching a plugin wich does following:
1.Is only accesable with admin access
2.Has a menu
3.In the menu the players are listed.
4.If you choose any player it gives the player 1(!!!) ammo clip for his primary and secondary weapon).

If someone could do this would be very nice.
I havent found such a plugin, i know there are sum plugins giving player one clip but in exchange you loose money or something and its not via an admin menu, every player have acces, but I want one with admin access menu.
Hopefully someone could do this for me
Im not that good at amxx scripting.
__________________

Last edited by Virtual-Vybz; 09-11-2008 at 10:49.
Virtual-Vybz is offline
Virtual-Vybz
Senior Member
Join Date: Apr 2008
Old 09-10-2008 , 02:43   Re: Admin CMD, Give Ammo-Clip to player via menu
Reply With Quote #2

Sorry for double post but is there nobody who can code this for me???
I think such plugin are quite usefull for funmods
__________________
Virtual-Vybz is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 11-01-2008 , 06:06   Re: [REQUEST] Admin CMD, Give Ammo-Clip to player via menu
Reply With Quote #3

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

Last edited by SnoW; 11-01-2008 at 06:11.
SnoW is offline
Send a message via MSN to SnoW
Sammer123
BANNED
Join Date: Jan 2012
Old 01-04-2012 , 13:35   Re: [REQUEST] Admin CMD, Give Ammo-Clip to player via menu
Reply With Quote #4

Quote:
Originally Posted by SnoW View Post
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
where should i put this text ?
Sammer123 is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 01-04-2012 , 13:46   Re: [REQUEST] Admin CMD, Give Ammo-Clip to player via menu
Reply With Quote #5

You stick in your...

I mean you paste it here, then press compile.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
Sammer123
BANNED
Join Date: Jan 2012
Old 01-04-2012 , 13:51   Re: [REQUEST] Admin CMD, Give Ammo-Clip to player via menu
Reply With Quote #6

PLZ where should i put it !!
Sammer123 is offline
joshknifer
Veteran Member
Join Date: Jun 2011
Location: Denver, CO
Old 01-04-2012 , 13:57   Re: [REQUEST] Admin CMD, Give Ammo-Clip to player via menu
Reply With Quote #7

Quote:
Originally Posted by Sammer123 View Post
PLZ where should i put it !!
Lemme tell you something you might not know about me Joe Rogan...


@op, you need to compile the plugin using the link wickedd gave you, then you need to put it in your plugins folder and add it to your plugins config file.
__________________
joshknifer is offline
Send a message via Skype™ to joshknifer
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 07:08.


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