GetActorPos is not working or updating!
#3

Quote:
Originally Posted by Pottus
View Post
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.
I'm trying to say that I have a function that checks if the actor is not in the original position it was created (CheckActorPos ()), and if it is not, I try to put it back. According to my images, I move the actors but their current position is not updated, so for the server it is still in the original position.

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(iPos[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(iActorPos[i][0],ActorPos[i][1],ActorPos[i][2]);
                    
SetActorFacingAngle(iActorPos[i][3]);
                }
            }
        }
    }
    return 
1;

Reply


Messages In This Thread
GetActorPos is not working or updating! - by JR_Junior - 15.05.2018, 17:17
Re: GetActorPos is not working or updating! - by Pottus - 15.05.2018, 22:48
Re: GetActorPos is not working or updating! - by JR_Junior - 16.05.2018, 04:29
Re: GetActorPos is not working or updating! - by Spmn - 16.05.2018, 16:53
Re: GetActorPos is not working or updating! - by NaS - 16.05.2018, 23:04

Forum Jump:


Users browsing this thread: 1 Guest(s)