Hey =)
Only 1 last day to finish my naruto mod , i have 1 probleme if someone could help
1
SEt Damage To Entity
PHP Code:
#include <amxmodx>
#include <fun>
#include <engine>
#include <fakemeta>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "EaGle"
new frostsprite;
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_forward(FM_CmdStart, "fw_Start")
}
public plugin_precache()
{
frostsprite = precache_model( "sprites/fire_nade.spr" )
}
public fw_Start(id, uc_handle, seed)
{
new button = get_uc(uc_handle,UC_Buttons)
if((button & IN_ATTACK2))
{
use_cmd(id)
}
}
public use_cmd(player)
{
new target, body
get_user_aiming( player, target, body, 1000)
if( is_user_alive( target ))
{
sprite_control( player )
}
return PLUGIN_HANDLED
}
public sprite_control( player )
{
new vec[ 3 ]
new aimvec[ 3 ]
new velocityvec[ 3 ]
new length
new speed = 10
get_user_origin( player, vec )
get_user_origin( player, aimvec, 2 )
velocityvec[ 0 ] = aimvec[ 0 ] - vec[ 0 ]
velocityvec[ 1 ] = aimvec[ 1 ] - vec[ 1 ]
velocityvec[ 2 ] = aimvec[ 2 ] - vec[ 2 ]
length = sqrt( velocityvec[ 0 ] * velocityvec[ 0 ] + velocityvec[ 1 ] * velocityvec[ 1 ] + velocityvec[ 2 ] * velocityvec[ 2 ] )
velocityvec[ 0 ] = velocityvec[ 0 ] * speed / length
velocityvec[ 1 ] = velocityvec[ 1 ] * speed / length
velocityvec[ 2 ] = velocityvec[ 2 ] * speed / length
new args[ 8 ]
args[ 0 ] = vec[ 0 ]
args[ 1 ] = vec[ 1 ]
args[ 2 ] = vec[ 2 ]
args[ 3 ] = velocityvec[ 0 ]
args[ 4 ] = velocityvec[ 1 ]
args[ 5 ] = velocityvec[ 2 ]
set_task( 0.1, "te_spray", 0, args, 8, "a", 2 )
}
public te_spray( args[ ] )
{
message_begin( MSG_BROADCAST,SVC_TEMPENTITY )
write_byte( 120 ) // Throws a shower of sprites or models
write_coord( args[ 0 ] ) // start pos
write_coord( args[ 1 ] )
write_coord( args[ 2 ] )
write_coord( args[ 3 ] ) // velocity
write_coord( args[ 4 ] )
write_coord( args[ 5 ] )
write_short( frostsprite ) // spr
write_byte( 8 ) // count
write_byte( 70 ) // speed
write_byte( 100 ) //(noise)
write_byte( 5 ) // (rendermode)
message_end( )
return PLUGIN_CONTINUE
}
public sqrt( num )
{
new div = num
new result = 1
while( div > result )
{
div = ( div + result ) / 2
result = num / div
}
return div
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1036\\ f0\\ fs16 \n\\ par }
*/
What to do if we want that the target receive Damages from the fire of the entity ?
thank you
__________________