PDA

View Full Version : Clİp ammo


tarkan00
01-18-2017, 12:11
hi guys,
I want a simple plugin;
if admins get gun,weapon clip ammo will be +15.(ADMIN_KICK)
picture is here ↓↓↓↓↓↓

sorry I have bad english

edon1337
01-18-2017, 12:59
I hope this works.. This will set Admins Ammo/Bpammo 30 always. #include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <engine>
#include <hamsandwich>

#define PLUGIN "Just 30 AMMO"
#define VERSION "1.0"
#define AUTHOR "DoNii"

#define BPAMMO 30
#define AMMO 30

new g_set_ammo[33];

new DISALLOWED_WEAPONS[] = {
CSW_KNIFE,
CSW_HEGRENADE,
CSW_FLASHBANG,
CSW_SMOKEGRENADE,
CSW_SHIELDGUN,
CSW_C4
}

const m_pPlayer = 41;
const m_fInReload = 54;
const m_fInSpecialReload = 55;
const m_flTimeWeaponIdle = 48;

public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("WeapPickup", "weap", "be")

// 2 = CSW_SHIELD = UNDEFINED | PUT SHOTGUNS HERE TO SKIP IN LOOP AND REGISTER MANUALLY
new const NO_RELOAD = ( 1 << 2 ) | ( 1 << CSW_KNIFE ) | ( 1 << CSW_C4 ) | ( 1 << CSW_M3 ) |
( 1 << CSW_XM1014 ) | ( 1 << CSW_HEGRENADE ) | ( 1 << CSW_FLASHBANG ) | ( 1 << CSW_SMOKEGRENADE );

new szWeaponName[ 20 ];

for( new i = CSW_P228; i <= CSW_P90; i++ )
{
// If its no-reload weapon or shotgun skip it
if( NO_RELOAD & ( 1 << i ) )
{
continue;
}

// Get weapon name
get_weaponname( i, szWeaponName, 19 );

// Register forward
RegisterHam( Ham_Weapon_Reload, szWeaponName, "FwdHamWeaponReload", 1 );
}

// Register shotguns, we need different function for additional checks
RegisterHam( Ham_Weapon_Reload, "weapon_m3", "FwdHamShotgunReload", 1 );
RegisterHam( Ham_Weapon_Reload, "weapon_xm1014", "FwdHamShotgunReload", 1 );
}

public WeapPickup(id) {

for (new i; i < sizeof DISALLOWED_WEAPONS; i++ )
if(is_user_alive(id) && get_user_flags(id) & ADMIN_KICK && get_user_weapon(id) != DISALLOWED_WEAPONS[i]) {

new weapon = get_user_weapon(id)
cs_set_user_bpammo(id, weapon, BPAMMO)

new weapon_name[18];
get_weaponname(id, weapon_name, 17)

new ent = find_ent_by_owner(-1, weapon_name, id)

if(pev_valid(ent) && ent > 0) {

cs_set_weapon_ammo(ent, AMMO)
g_set_ammo[id] = true

}
}
}

public FwdHamWeaponReload( const iWeapon )
{

if( get_pdata_int( iWeapon, m_fInReload, 4 ) )
{
new id = pev(iWeapon, pev_owner)

if(get_user_flags(id) & ADMIN_KICK) {
if(cs_get_user_bpammo(id, iWeapon) != BPAMMO) {
cs_set_user_bpammo(id, iWeapon, BPAMMO)
}

if(cs_get_weapon_ammo(iWeapon) != AMMO) {
new weapon_name[18];
get_weaponname(id, weapon_name, 17)

new ent = find_ent_by_owner(-1, weapon_name, id)
cs_set_weapon_ammo(ent, AMMO)
}
}
}
}

public FwdHamShotgunReload( const iWeapon )
{

if( get_pdata_int( iWeapon, m_fInSpecialReload, 4 ) != 1 )
{
return;
}

new Float:flTimeWeaponIdle = get_pdata_float( iWeapon, m_flTimeWeaponIdle, 4 );

if( flTimeWeaponIdle != 0.55 )
{
return;
}

new id = pev(iWeapon, pev_owner)

if(get_user_flags(id) & ADMIN_KICK) {
if(cs_get_user_bpammo(id, iWeapon) != BPAMMO) {
cs_set_user_bpammo(id, iWeapon, BPAMMO)
}

if(cs_get_weapon_ammo(iWeapon) != AMMO) {
new weapon_name[18];
get_weaponname(id, weapon_name, 17)

new ent = find_ent_by_owner(-1, weapon_name, id)
cs_set_weapon_ammo(ent, AMMO)
}
}
}

tarkan00
01-18-2017, 14:13
thank you but This is the wrong add-on.

I want if admin buy gun , weapon clip ammo will be normal clip ammo more +15 or + 20
so if admin get gun I marked clip ammo section will be +15 or +20.
if you can't this menu may be in the form of.

thanks for you again..

160206

tarkan00
01-20-2017, 12:15
UP

edon1337
01-20-2017, 13:36
But, admins will just drop the weapon and get +15 more ammo#include <amxmodx>
#include <engine>
#include <cstrike>

#define PLUGIN "ADMIN +15 Ammo"
#define VERSION "1.0"
#define AUTHOR "DoNii"


public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("WeapPickup", "weap", "be")
}

public WeapPickup(id) {

if(get_user_flags(id) & ADMIN_KICK) {
new weapon[18];
get_weaponname(id, weapon, 17)
new ent = find_ent_by_owner(-1, weapon, id)

if(is_valid_ent(ent)) {
cs_set_weapon_ammo(ent, cs_get_weapon_ammo(ent) + 15)
}
}
}

Relaxing
01-20-2017, 14:22
But, admins will just drop the weapon and get +15 more ammo#include <amxmodx>
#include <engine>
#include <cstrike>

#define PLUGIN "ADMIN +15 Ammo"
#define VERSION "1.0"
#define AUTHOR "DoNii"


public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("WeapPickup", "weap", "be")
}

public WeapPickup(id) {

if(get_user_flags(id) & ADMIN_KICK) {
new weapon[18];
get_weaponname(id, weapon, 17)
new ent = find_ent_by_owner(-1, weapon, id)

if(is_valid_ent(ent)) {
cs_set_weapon_ammo(ent, cs_get_weapon_ammo(ent) + 15)
}
}
}
If he just face the wall and than start dropping the weapon on madmode, call him unstoppable

tarkan00
01-23-2017, 04:42
if this not possible,
can you do menu form of this plugin ?
in the menu;
-m4a1
-ak47
-mp5
-famas
-aug
-sg552
-xm1014
-scout
-awp
in the menu form for admins .
if admins take gun in menu , ammo clip will be +15.
example:
normal m4a1 clip : 30/90
if admin use this menu will be m4a1 clip : 45/90

Relaxing
01-23-2017, 05:17
cs_set_weapon_ammo(ent, cs_get_weapon_ammo(ent) + 15 < 46 )

tarkan00
01-23-2017, 05:33
I tried but this again not work.
I changed
cs_set_weapon_ammo(ent, cs_get_weapon_ammo(ent) + 15)
cs_set_weapon_ammo(ent, cs_get_weapon_ammo(ent) + 15 < 46 )

OciXCrom
01-23-2017, 07:44
cs_set_weapon_ammo(ent, cs_get_weapon_ammo(ent) + 15 < 46 )

What the actual F is that supposed to do?

edon1337
01-23-2017, 13:11
Tarkan are you sure this didn't work ? I see nothing wrong in the code.

tarkan00
01-23-2017, 17:35
Tarkan are you sure this didn't work ? I see nothing wrong in the code.

i tried in the my server;
I bought gun in the weapon menu.
weapon ammo : 30/90 after
I dropped the gun and I take again the gun but ammo clip is not changed .

I myself did this plugin menu form.
it was clip ammo +15 but if you do clip reload(with R) , ammo clip is again it is happening 30/90 .

tarkan00
01-24-2017, 09:23
up