when I use this code and try to switch to m3 it doesn't switch.
what's the error I made?
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
public plugin_init ()
{
RegisterHam(Ham_Item_AddToPlayer, "weapon_m3" , "Fw_Item_AddToPlayer_Post", 1);
}
public Fw_Item_AddToPlayer_Post(weapon, id)
{
if(!pev_valid(weapon))
return HAM_IGNORED
message_begin(MSG_ONE, get_user_msgid("WeaponList"), .player = id);
write_string("weapon_xm1014"); // WeaponName
write_byte(5); // PrimaryAmmoID
write_byte(5); // PrimaryAmmoMaxAmount
write_byte(-1); // SecondaryAmmoID
write_byte(-1); // SecondaryAmmoMaxAmount
write_byte(0); // SlotID (0...N)
write_byte(5); // NumberInSlot (1...N)
write_byte(CSW_M3); // WeaponID
write_byte(0); // Flags
message_end();
return HAM_HANDLED
}
__________________