Float:Z Check
#1

Hi, with the command /check you should get a message after one second. The message includes the difference between the first coordinate of the Z-axis and it's new position after one second. (The axis belongs to an moving object [Speed=0.0625].)
But the problem is that the difference is too large to be real. (Over 1billion )
Here's the Code, what might be incorrect?
pawn Код:
else if(strcmp("/check",cmdtext,true,6)==0)
    {
      GetObjectPos(obj1,x,y,z);
      SetTimer("ZP",1000,0);
    }
    return 0;
}

public ZP(playerid)
{
    GetObjectPos(obj1,x,y,z2);
    new string[255];
    format(string,sizeof(string),"%d",z-z2);
    SendClientMessage(playerid,WHITE,string);
    return 1;
}
Reply
#2

Its a float not integer
Код:
%.f
not
Код:
%d
Reply
#3

Thx, it works much better now. But the shown number is still without a point.
I need a more exactly number like 1.234!
Reply
#4

Then get rid of the period in that, "%f"
Reply
#5

Thx, now it works well.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)