Member
|
04-17-2012
, 06:41
Crossbow
|
#1
|
Bonjour,
J'utilise actuellement le plugin suivant : https://forums.alliedmods.net/showthread.php?t=106729 que j'ai traduis (le plugin actuellement traduit en français est buggé).
Le problème est, que lorsque j'utilise l'arbalète (du chasseur), la flèche est créée mais ne part pas, elle reste figée à l'endroit où elle a été créée (au niveau de l'arbalète).
J'ai fais des tests, et ça donne ça :
PHP Code:
public command_arrow( id )
{
if( !is_user_alive( id ) ) return PLUGIN_HANDLED
new Float:Origin[ 3 ], Float:Velocity[ 3 ], Float:vAngle[ 3 ], Ent
entity_get_vector( id, EV_VEC_origin, Origin )
entity_get_vector( id, EV_VEC_v_angle, vAngle )
Ent = create_entity( "info_target" )
if( !Ent ) return PLUGIN_HANDLED
entity_set_string( Ent, EV_SZ_classname, "xbow_arrow" )
entity_set_model( Ent, cbow_bolt )
new Float:MinBox[ 3 ] = { -2.8, -2.8, -0.8 }
new Float:MaxBox[ 3 ] = { 2.8, 2.8, 2.0 }
entity_set_vector( Ent, EV_VEC_mins, MinBox )
entity_set_vector( Ent, EV_VEC_maxs, MaxBox )
vAngle[ 0 ] *= -1
Origin[ 2 ] +=10
entity_set_origin( Ent, Origin )
entity_set_vector( Ent, EV_VEC_angles, vAngle )
entity_set_int( Ent, EV_INT_effects, 2 )
entity_set_int( Ent, EV_INT_solid, 1 )
entity_set_int( Ent, EV_INT_movetype, 5 )
entity_set_edict( Ent, EV_ENT_owner, id )
client_print( id, print_chat, "1" ) // ce test est appelé
new Float:dmg = get_pcvar_float( diablo_arrow ) + player_intelligence[ id ] * get_pcvar_float( diablo_arrow_multi )
client_print( id, print_chat, "2" ) // ce test n'est pas appelé
velocity_by_aim( id, get_pcvar_num( diablo_arrow_speed ), Velocity )
set_rendering( Ent, kRenderFxGlowShell, 255, 0, 0, kRenderNormal, 56 )
entity_set_vector( Ent, EV_VEC_velocity, Velocity )
entity_set_float( Ent, EV_FL_dmg, dmg )
return PLUGIN_HANDLED
}
J'ai donc remonter le code pour la velocité comme ceci :
PHP Code:
public command_arrow( id )
{
if( !is_user_alive( id ) ) return PLUGIN_HANDLED
new Float:Origin[ 3 ], Float:Velocity[ 3 ], Float:vAngle[ 3 ], Ent
entity_get_vector( id, EV_VEC_origin, Origin )
entity_get_vector( id, EV_VEC_v_angle, vAngle )
Ent = create_entity( "info_target" )
if( !Ent ) return PLUGIN_HANDLED
entity_set_string( Ent, EV_SZ_classname, "xbow_arrow" )
entity_set_model( Ent, cbow_bolt )
new Float:MinBox[ 3 ] = { -2.8, -2.8, -0.8 }
new Float:MaxBox[ 3 ] = { 2.8, 2.8, 2.0 }
entity_set_vector( Ent, EV_VEC_mins, MinBox )
entity_set_vector( Ent, EV_VEC_maxs, MaxBox )
vAngle[ 0 ] *= -1
Origin[ 2 ] +=10
entity_set_origin( Ent, Origin )
entity_set_vector( Ent, EV_VEC_angles, vAngle )
entity_set_int( Ent, EV_INT_effects, 2 )
entity_set_int( Ent, EV_INT_solid, 1 )
entity_set_int( Ent, EV_INT_movetype, 5 )
entity_set_edict( Ent, EV_ENT_owner, id )
velocity_by_aim( id, get_pcvar_num( diablo_arrow_speed ), Velocity )
set_rendering( Ent, kRenderFxGlowShell, 255, 0, 0, kRenderNormal, 56 )
entity_set_vector( Ent, EV_VEC_velocity, Velocity )
client_print( id, print_chat, "1" ) // ce test est appelé
new Float:dmg = get_pcvar_float( diablo_arrow ) + player_intelligence[ id ] * get_pcvar_float( diablo_arrow_multi )
client_print( id, print_chat, "2" ) // ce test n'est pas appelé
entity_set_float( Ent, EV_FL_dmg, dmg )
return PLUGIN_HANDLED
}
La flèche se lance correctement, mais les dégâts ne se font pas.
Quel problème y a-t-il avec la décimale dmg ?
Merci d'avance.
|
|