Raised This Month: $ Target: $400
 0% 

[AMXX 1.8.1] Changing the amount of ammunition for the weapons


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Daku
Senior Member
Join Date: Nov 2009
Location: Poland / Polska
Old 11-13-2009 , 13:03   [AMXX 1.8.1] Changing the amount of ammunition for the weapons
Reply With Quote #1

Hi

I mean the plugin AMXX which would change the quantity of ammunition for the weapon, eg

previous topics, I found the plugin DUAL MP5 and MP5, I would like to have had 2x more ammo or 60 / magazine and 240 in reserve

whether it is possible to know from somewhere that I saw

I have the plugin, the new model (external), and if possible a greater rate of shoting

I tried to do something but do not work as I want

Code:
#include <amxmodx> 
#include <amxmisc> 
#include <cstrike> 
#include <fun> 
#include <fakemeta> 

public plugin_init() { 
    register_plugin("DL mp5", "1.0", "Daku"); 
	}
public plugin_precache() {    
    precache_model("models/mp5test/v_mp.mdl");  
}




public event_curweapon(id) { 
    new clip, ammo, weapon = get_user_weapon(id, clip, ammo); 
    
    if(weapon == CSW_MP5NAVY) { 
        set_pev(id, pev_viewmodel, "models/mp5test/v_mp.mdl"); 
        
    } 
    return PLUGIN_CONTINUE; 
}
Daku is offline
Send a message via Skype™ to Daku
unnyquee
Senior Member
Join Date: Jun 2009
Location: Constanta, Romania
Old 11-13-2009 , 13:18   Re: [AMXX 1.8.1] Changing the amount of ammunition for the weapons
Reply With Quote #2

You can use:
PHP Code:
#include <cstrike>

cs_set_user_ammo(indexnewammo// index is the weapon's index

cs_set_user_bpammo(idweaponamount// id is the index of the player, weapon is the weapon starting with CSW_*.. like CSW_MP5 
Hope that helps!
__________________
unnyquee is offline
Daku
Senior Member
Join Date: Nov 2009
Location: Poland / Polska
Old 11-13-2009 , 13:21   Re: [AMXX 1.8.1] Changing the amount of ammunition for the weapons
Reply With Quote #3

I do not know whether this is good but I do such a thing

Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <hamsandwich>
#include <fakemeta>
#include <fun>
#include <cstrike>

new MP5_MODEL_NAME[64] = "models/mp5test/v_mp.mdl"

public plugin_init(){
	register_plugin("2MP5& 2X ammo","1.0","Daku")
}

public checkModel(id){ 
	if (!is_user_alive(id)){
		return PLUGIN_CONTINUE
	}
	entity_set_string(id, EV_SZ_viewmodel, MP5_MODEL_NAME)

	new iCurrent
	iCurrent = find_ent_by_class(-1,"weapon_mp5navy")

	while(iCurrent != 0) {
		iCurrent = find_ent_by_class(iCurrent,"weapon_mp5navy")
	}

	return PLUGIN_HANDLED
} 

public checkWeapon(id){ 
	new plrClip, plrAmmo, plrWeap[32]
	new plrWeapId

	plrWeapId = get_user_weapon(id, plrClip, plrAmmo)
	cs_set_user_ammo(19, 60)
        cs_set_user_bpammo(id, CSW_MP5NAVY, 240)

	if (plrWeapId == CSW_MP5NAVY){
		checkModel(id)
		cs_set_weapon_ammo(plrWeapId,60)
	}
	else {
	    // Otherwise just leave this function
		return PLUGIN_CONTINUE
	}

	if (plrClip == 0){
		if(get_cvar_num("amx_dualmp5_unlimitedammo") == 1) {
			// ^ If the user is out of ammo..
			get_weaponname(plrWeapId, plrWeap, 31)
			// Get the name of their weapon (MP5, duh!)
			give_item(id, plrWeap)
			// Give them another MP5 (ammo)
			engclient_cmd(id, plrWeap) 
			engclient_cmd(id, plrWeap)
			engclient_cmd(id, plrWeap)
			// Sending multiple times may help
		}
	}

	return PLUGIN_CONTINUE 
}
compile.exe get an error " error 017: undefinied symbol "cs_set_user_ammo""
and crash


I find
Weapons MaxClip 0.2.0 (07 mar 2009)
http://forums.alliedmods.net/showthread.php?t=82093

BackPack Ammo Features
http://forums.alliedmods.net/showthread.php?t=81183

Last edited by Daku; 11-13-2009 at 13:33.
Daku is offline
Send a message via Skype™ to Daku
unnyquee
Senior Member
Join Date: Jun 2009
Location: Constanta, Romania
Old 11-13-2009 , 13:42   Re: [AMXX 1.8.1] Changing the amount of ammunition for the weapons
Reply With Quote #4

Include <cstrike>
__________________
unnyquee is offline
Daku
Senior Member
Join Date: Nov 2009
Location: Poland / Polska
Old 11-13-2009 , 13:49   Re: [AMXX 1.8.1] Changing the amount of ammunition for the weapons
Reply With Quote #5

already there, but I have a new work the way it is done for the AK and the m4

if i'm drop and raise up ammo come back to 50 and shall be removed from the backlog

https://forums.alliedmods.net/showthread.php?t=27216

if i'm reload weapon plugin should set ammo to 50 and it set to standard = 30

Last edited by Daku; 11-13-2009 at 14:05.
Daku is offline
Send a message via Skype™ to Daku
Daku
Senior Member
Join Date: Nov 2009
Location: Poland / Polska
Old 11-13-2009 , 18:17   Re: [AMXX 1.8.1] Changing the amount of ammunition for the weapons
Reply With Quote #6

Code:
#include <amxmodx>
#include <engine>
#include <cstrike>

// should be greater than corresponding standard
#define CLIP_AMMO 60

public plugin_init() {
    register_event("WeapPickup", "event_weapon_pickup", "be")
    register_event("CurWeapon","CurWeapon","be", "1=1") 
    register_event("DeathMsg", "DeathMsg", "a")
}

public event_weapon_pickup(id) {
    // get id of collected weapon
    new wid = read_data(1)

    if (wid == CSW_MP5NAVY) {
        new param[1]
        param[0] = wid

        // wait a bit since weapon entity not created yet
        set_task(0.1, "task_set_ammo", id, param, 1)
    }
}

public task_set_ammo(param[1], id) {
    new wid = param[0], wname[20]

    // weapon name is the same as weapon entity classname
    get_weaponname(wid, wname, 19)

    // find weapon entity index by it's classname and owner
    new went = find_ent_by_owner(-1, wname, id)
    if (!went) // if weapon entity isn't found
        return

    // get amount of ammo in clip of collected weapon
    new clip = cs_get_weapon_ammo(went)
    if (clip >= CLIP_AMMO) // if ammo addition isn't required
        return

    // get amount of player's pack ammo for collected weapon
    new pack = cs_get_user_bpammo(id, wid)
    if (!pack) // if player have no ammo for that weapon
        return

    // total available amount of ammo for collected weapon
    new total = clip + pack

    // here will be stored result ammo amount for clip and pack
    new clip2, pack2

    // if total ammo greater than or equal to defined clip ammo
    if (total >= CLIP_AMMO) {
        clip2 = CLIP_AMMO
        pack2 = total - CLIP_AMMO
    }
    else {
        clip2 = total
        pack2 = 0
    }

    // set new clip and pack ammo amount for collected weapon
    cs_set_weapon_ammo(went, clip2)
    cs_set_user_bpammo(id, wid, pack2)


    }
new old_ammo[33] 

public CurWeapon(id) 
{ 
    new wid = read_data(2)    // Id broni 
    new ammo = read_data(3)    // liczba naboi w magazynku 
    if(wid== CSW_MP5NAVY) 
    { 
       if(old_ammo[id]<ammo)  // reload 
       { 
           new param[1] 
           param[0] = wid 
           set_task(0.1, "task_set_ammo", id, param, 1) 
           ammo=CLIP_AMMO 
       } 
       old_ammo[id]=ammo 
    } 
} 

public DeathMsg() 
{  
    new vid = read_data(2)    // ofiara 
    old_ammo[vid]=0 
}
public client_connect(id) 
{ 
    old_ammo[id]=0 
}
It works but it wrong if drop weapon and put ammo reset to 60 and from BPammo -ammo added to clip
Daku is offline
Send a message via Skype™ to Daku
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-13-2009 , 18:32   Re: [AMXX 1.8.1] Changing the amount of ammunition for the weapons
Reply With Quote #7

Use my plugin and register only mp5.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Daku
Senior Member
Join Date: Nov 2009
Location: Poland / Polska
Old 11-13-2009 , 18:44   Re: [AMXX 1.8.1] Changing the amount of ammunition for the weapons
Reply With Quote #8

plugin name ?? please !!
Daku is offline
Send a message via Skype™ to Daku
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-13-2009 , 18:46   Re: [AMXX 1.8.1] Changing the amount of ammunition for the weapons
Reply With Quote #9

You have the links above.
__________________
Arkshine is offline
Daku
Senior Member
Join Date: Nov 2009
Location: Poland / Polska
Old 11-13-2009 , 18:47   Re: [AMXX 1.8.1] Changing the amount of ammunition for the weapons
Reply With Quote #10

http://forums.alliedmods.net/showthread.php?p=728613
max clip ( i don't know how use IT !!)

http://forums.alliedmods.net/showthread.php?t=81183
BPAMMO

video im change first weapon clip

http://www.youtube.com/watch?v=mrcsYiozI30
Daku is offline
Send a message via Skype™ to Daku
Reply



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 13:38.


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