PDA

View Full Version : Get possition


iNexus
01-05-2012, 09:57
Hello,
I want freeze a player by crosshair and calculate the distance between two entity
this code is valide or not

new aim = GetClientAimTarget(client, true);
new v_team = GetClientTeam(aim);
new p_team = GetClientTeam(client);
new Float:f_victim[3], Float:f_client[3], Float:distance;
GetEntPropVector(aim, Prop_Send, "m_vecOrigin", f_victim);
GetEntPropVector(client, Prop_Send, "m_vecOrigin", f_client);
distance = GetVectorDistance(f_victim, f_client);
if (distance > 200.0)
{
Client_PrintToChat(client, true, "Tu est trop loin pour pouvoir tazer");
}
else
{
if (aim > 0 && v_team == 2 && p_team == 3 || p_team == 2)
{
Client_PrintToChat(client, true, "Tu taze %N", aim);
SetEntityMoveType(aim, MOVETYPE_NONE);
CreateTimer(10.0, UnFreeze, aim);
Client_PrintToChat(aim, true, "Tu a etait taze par %N", client);
}
}