Raised This Month: $ Target: $400
 0% 

c4 replacement help


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
AlMod
Member
Join Date: Nov 2006
Old 09-15-2007 , 13:37   c4 replacement help
Reply With Quote #1

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 
wpnidclipammo
  wpnid 
get_user_weapon(idclipammo)
  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 
wpnidclipammo
 wpnid 
get_user_weapon(idclipammo)
 if (
wpnid == CSW_C4)
 {
  
g_CanShoot1[id]=false
  g_PlaySpin
[id]=true
  emit_sound
(idCHAN_WEAPONg_Gun_Sound_Spin0.9ATTN_NORM0PITCH_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 
wpnidclipammo
 wpnid 
get_user_weapon(idclipammo)
 if (
wpnid == CSW_C4)
 {
  
g_CanShoot1[id]=false
  g_PlaySpin
[id]=false
  g_PlayFire
[id]=true
  emit_sound
(idCHAN_WEAPONg_Gun_Sound_Fire0.9ATTN_NORM0PITCH_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 
wpnidclipammo
 wpnid 
get_user_weapon(idclipammo)
 if (
wpnid == CSW_C4)
 {
  
g_CanShoot1[id]=true
  g_PlayFire
[id]=false
 
}

u can see there my test sequences . 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
AlMod is offline
 



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 16:08.


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