until now, I have changed the codes many times and decided not to use
ham_item_holster and
ham_item_deploy because is not called when player use
quick change to last weapon used button. This is my current code:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>
#include <engine>
#define PLUGIN "Weapon"
#define VERSION "1.0"
#define AUTHOR "Gian Yagami"
new ent_hWpn[18]
new ent_dWpn[18]
new playerid
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("CurWeapon", "Event_Cur_Weapon", "b")
}
stock UTIL_SenwWeaponAnim(const playerid, const Sequence)
{
set_pev(playerid, pev_weaponanim, Sequence)
message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, .player = playerid)
write_byte(Sequence)
write_byte(pev(playerid, pev_body))
message_end()
}
public Event_Cur_Weapon(ent) // Always looping whenever player grab a weapon
{
playerid = pev(ent, pev_owner)
if (!pev(playerid, pev_weaponanim, 8)) //Checking if animation is still play or not. idk this work or not
set_pev(playerid, pev_weapons, ent_dWpn)
for (new i = 0; i < sizeof ent_hWpn; i++)
{
for (new j = 0; j < sizeof ent_dWpn; j++)
{
if (ent_hWpn[i] != ent_dWpn[j] )
{
set_pev(playerid, pev_weapons, ent_hWpn) // change weapon to previous idk this work or not
UTIL_SenwWeaponAnim(playerid, 8)
i = sizeof ent_hWpn; j = sizeof ent_dWpn;
}
}
}
}
I'm still wonder how to use pev_weapons and checking animation
Quote:
Originally Posted by Arkshine
|
I see owner keyword and the value is zero, how I can input player index? because I want specific player meet the conditions. Who change the weapon.