I have a problem with get_distance_f
When i type in chat "lala (registered in clcmd)" automatically creates a entity and shows for me the distance between me and ent...
But it did not work... In first time it works fine but when i type again, the entity creates normally but it shows "[", "u", "(" of distance...
Whats wrong with the code?
PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
new const gModel[ ] = "models/teste.mdl"
public plugin_init()
register_clcmd("say lala", "LALAc")
public plugin_precache()
precache_model( gModel )
public LALAc(id)
{
new ent = create_entity( "info_target" );
if( !pev_valid( ent ) )
{
return;
}
new Float:flPlayerOrigin[ 3 ];
new Float:OrigENT[ 3 ];
pev( id, pev_origin, flPlayerOrigin );
pev( ent, pev_origin, OrigENT );
flPlayerOrigin[ 2 ] += 4.0;
engfunc( EngFunc_SetOrigin, ent, flPlayerOrigin );
engfunc( EngFunc_SetModel, ent, gModel );
set_pev( ent, pev_solid, SOLID_SLIDEBOX );
set_pev( ent, pev_movetype, MOVETYPE_NONE );
set_pev( ent, pev_framerate, 1.0 );
set_pev( ent, pev_sequence, "spin" );
engfunc( EngFunc_SetSize, ent, Float:{ -10.0, -10.0, -10.0 }, Float:{ 10.0, 10.0, 10.0 } );
engfunc( EngFunc_DropToFloor, ent );
set_pev( ent, pev_nextthink, get_gametime( ) + 1.0 );
new Float:distancia
distancia = get_distance_f( flPlayerOrigin, OrigENT )
client_print(id, print_chat, "Distance between me and ent is: %s", distancia)
}