16.05.2018, 04:29
(
Last edited by JR_Junior; 16/05/2018 at 06:34 PM.
)
Quote:
You shouldn't use != or == operators with floats use >=, <=, <, > for comparisons. Anyways you are not even clear at all about your problem with no explanation of anything of what you are doing.
|
And regarding comparison of values in float, I also use another function (GetDistanceBetweenPoints) and even so it seems that the position of the actor does not change:
PHP Code:
forward Float:GetDistanceBetweenPoints(Float:rx1,Float:ry1,Float:rz1,Float:rx2,Float:ry2,Float:rz2);
stock Float:GetDistanceBetweenPoints(Float:rx1,Float:ry1,Float:rz1,Float:rx2,Float:ry2,Float:rz2)
{
return floatadd(floatadd(floatsqroot(floatpower(floatsub(rx1,rx2),2)),floatsqroot(floatpower(floatsub(ry1,ry2),2))),floatsqroot(floatpower(floatsub(rz1,rz2),2)));
}
stock CheckActorPos()
{
new Float:Pos[3];
Loop(i,GetActorPoolSize()+1,0)
{
if(IsValidActor(i))
{
if(GetActorVirtualWorld(i) == 0)
{
GetActorPos(i, Pos[0], Pos[1], Pos[2]);
new Float:dist = GetDistanceBetweenPoints(Pos[0], Pos[1], Pos[2],ActorPos[i][0],ActorPos[i][1],ActorPos[i][2]);
if(dist > 0.0)
{
SetActorPos(i, ActorPos[i][0],ActorPos[i][1],ActorPos[i][2]);
SetActorFacingAngle(i, ActorPos[i][3]);
}
}
}
}
return 1;
}