hlmod.hu
https://hlmod.hu/

Knife knockback
https://hlmod.hu/viewtopic.php?f=9&t=4827
Oldal: 1 / 1

Szerző:  CeDee [2012.06.21. 15:25 ]
Hozzászólás témája:  Knife knockback

Kód:
  1. #include <amxmodx>

  2. #include <fakemeta>

  3. #include <hamsandwich>

  4. #include <xs>

  5. #include <cstrike>

  6.  

  7.  

  8. #define PLUGIN "Knife KnockBack"

  9. #define AUTHOR "ConnorMcLeod"

  10. #define VERSION "0.0.1"

  11.  

  12. new g_pCvarKnockBack

  13.  

  14. public plugin_init()

  15. {

  16.     register_plugin(PLUGIN, VERSION, AUTHOR)

  17.  

  18.     g_pCvarKnockBack = register_cvar("amx_knife_knockback", "10")

  19.  

  20.     RegisterHam(Ham_TakeDamage, "player", "Player_TakeDamage", 1)

  21. }

  22.  

  23. public Player_TakeDamage(id, idinflictor, idattacker, attacker, Float:flDamage, damagebits)

  24. {

  25.     if(    !idattacker

  26.     ||    id == idattacker

  27.     ||    idinflictor != idattacker

  28.     ||    cs_get_user_team(attacker) != CS_TEAM_CT

  29.     ||    get_user_weapon(idattacker) != CSW_KNIFE    )

  30.     {

  31.         return

  32.     }

  33.  

  34.     new Float:fDir[3], Float:fOrigin[3], Float:fVelocity[3]

  35.  

  36.     pev(id, pev_origin, fDir)

  37.     pev(idattacker, pev_origin, fOrigin)

  38.  

  39.     xs_vec_sub(fDir, fOrigin, fDir)

  40.     xs_vec_normalize(fDir, fDir)

  41.  

  42.     flDamage *= get_pcvar_num(g_pCvarKnockBack)

  43.     if( flDamage > 1500.0 )

  44.         flDamage = 1500.0

  45.  

  46.     pev(id, pev_velocity, fVelocity)

  47.     xs_vec_mul_scalar(fDir, flDamage, fDir)

  48.     xs_vec_add(fVelocity, fDir, fVelocity)

  49.     set_pev(id, pev_velocity, fVelocity)

  50. }

Az lenne a baj, hogy nem löki el a Terroristákat, pedig öket kéne el lökni:D
Mi lehet a gond?..

Szerző:  fear_ezmegmi [2012.06.21. 15:58 ]
Hozzászólás témája:  Re: Knife knockback

Try this :
Kód:
  1. #include <amxmodx>

  2. #include <fakemeta>

  3. #include <hamsandwich>

  4. #include <xs>

  5. #include <cstrike>

  6.  

  7.  

  8. #define PLUGIN "Knife KnockBack"

  9. #define AUTHOR "ConnorMcLeod"

  10. #define VERSION "0.0.1"

  11.  

  12. new g_pCvarKnockBack

  13.  

  14. public plugin_init()

  15. {

  16.     register_plugin(PLUGIN, VERSION, AUTHOR)

  17.  

  18.     g_pCvarKnockBack = register_cvar("amx_knife_knockback", "10")

  19.  

  20.     RegisterHam(Ham_TakeDamage, "player", "Player_TakeDamage", 1)

  21. }

  22.  

  23. public Player_TakeDamage(id, idinflictor, idattacker, attacker, Float:flDamage, damagebits)

  24. {

  25.     if(    !idattacker

  26.     ||    id == idattacker

  27.     ||    idinflictor != idattacker

  28.     ||    cs_get_user_team(attacker) != CS_TEAM_T

  29.     ||    get_user_weapon(idattacker) != CSW_KNIFE    )

  30.     {

  31.         return

  32.     }

  33.  

  34.     new Float:fDir[3], Float:fOrigin[3], Float:fVelocity[3]

  35.  

  36.     pev(id, pev_origin, fDir)

  37.     pev(idattacker, pev_origin, fOrigin)

  38.  

  39.     xs_vec_sub(fDir, fOrigin, fDir)

  40.     xs_vec_normalize(fDir, fDir)

  41.  

  42.     flDamage *= get_pcvar_num(g_pCvarKnockBack)

  43.     if( flDamage > 1500.0 )

  44.         flDamage = 1500.0

  45.  

  46.     pev(id, pev_velocity, fVelocity)

  47.     xs_vec_mul_scalar(fDir, flDamage, fDir)

  48.     xs_vec_add(fVelocity, fDir, fVelocity)

  49.     set_pev(id, pev_velocity, fVelocity)

  50. }

Szerző:  CeDee [2012.06.21. 18:11 ]
Hozzászólás témája:  Re: Knife knockback

Nemlett jó ezmegmi... :(
az biztos CS_TEAM_CT

Szerző:  oroszrulett [2012.06.21. 18:22 ]
Hozzászólás témája:  Re: Knife knockback

Idézet:
mosmár csak akkor fut le ha a támadó nem ct

Oldal: 1 / 1 Minden időpont UTC+02:00 időzóna szerinti
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/