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