c4 replacement help
I one of my mods i need to replace c4 with other weapon - the portal gun. But i have some troubles in weapon animation.
I need to play one sequence at one second, and other at the other second. In my code it looks like this:
PHP Code:
public on_PreThink(id) { if (!g_Mod) return if (is_user_alive(id)) { new wpnid, clip, ammo wpnid = get_user_weapon(id, clip, ammo) if (wpnid == CSW_C4) { new attack = get_user_button(id) & IN_ATTACK new oldattack = get_user_oldbutton(id) & IN_ATTACK new attack2 = get_user_button(id) & IN_ATTACK2 new oldattack2 = get_user_oldbutton(id) & IN_ATTACK2 if (attack && !oldattack && g_CanShoot1[id]) { portalgun_spin(id) client_print(id,print_chat,"TEST 3") } if (g_PlaySpin[id]) { entity_set_int(id,EV_INT_weaponanim,2) } if (g_PlayFire[id]) { entity_set_int(id,EV_INT_weaponanim,4) } } } } ... public portalgun_spin(id) { if (!is_user_connected(id)) return new wpnid, clip, ammo wpnid = get_user_weapon(id, clip, ammo) if (wpnid == CSW_C4) { g_CanShoot1[id]=false g_PlaySpin[id]=true emit_sound(id, CHAN_WEAPON, g_Gun_Sound_Spin, 0.9, ATTN_NORM, 0, PITCH_NORM) client_print(id,print_chat,"TEST 1") set_task(1.0,"portalgun_fire",id) } } public portalgun_fire(id) { if (!is_user_connected(id)) return new wpnid, clip, ammo wpnid = get_user_weapon(id, clip, ammo) if (wpnid == CSW_C4) { g_CanShoot1[id]=false g_PlaySpin[id]=false g_PlayFire[id]=true emit_sound(id, CHAN_WEAPON, g_Gun_Sound_Fire, 0.9, ATTN_NORM, 0, PITCH_NORM) client_print(id,print_chat,"TEST 2") set_task(1.0,"portalgun_dropfire",id) } } public portalgun_dropfire(id) { if (!is_user_connected(id)) return new wpnid, clip, ammo wpnid = get_user_weapon(id, clip, ammo) if (wpnid == CSW_C4) { g_CanShoot1[id]=true g_PlayFire[id]=false } }
u can see there my test sequences :wink:. I'll tried to put if's in prethink in postthink, but nothing helps - after one left mouse click - aimation starting but then momentally sets idle 0 (no animation). But if i holding left mouse button animation playing correctly - charge, then fire.
If u can help me did it faster as u can - I want very much to make "pOrtal" in CS
|