convert kilometers
#1

PHP код:
if(strcmp(cmd"/work"true) == 0)
    {
        new
        
FloatfX,
        
FloatfY,
        
FloatfZ,
        
Float:Distance
        
;
        
GetPlayerPos(playeridfXfYfZ);
        
Distance GetPointDistanceToPoint3D(fXfYfZ925.8821,-1757.5184,13.5469);
        
format(stringsizeof(string), " Kilomters %f to the point"Distance);
        
SendClientMessage(playerid, -1string);
        return 
1;
    } 
PHP код:
forward Float:GetPointDistanceToPoint3D(FloatfX1FloatfY1FloatfZ1FloatfX2FloatfY2FloatfZ2);
public 
Float:GetPointDistanceToPoint3D(FloatfX1FloatfY1FloatfZ1FloatfX2FloatfY2FloatfZ2)
{
    return 
floatsqroot(((fX1 -= fX2) * fX1) + ((fY1 -= fY2) * fY1) + ((fZ1 -= fZ2) * fZ1));

show meters, how to convert to kilometers ?
Reply
#2

1000 meter = 1 kilo meter !

So

Meter/1000 = KM
Reply
#3

my script show


I want to look

Kilometers 34.7 to the point

Do You Understand?

Bad English
Reply
#4

I don't know if this works, but try to do:
pawn Код:
Distance = GetPointDistanceToPoint3D(fX, fY, fZ, 925.8821,-1757.5184,13.5469 / 100);
Reply
#5

Quote:
Originally Posted by gabitzu4ever
Посмотреть сообщение
my script show


I want to look

Kilometers 34.7 to the point

Do You Understand?

Bad English
format it like this
pawn Код:
format(string, sizeof(string), " Kilomters %.2f to the point", Distance);
and it'll be 2 decimal places

do: %.1f for only 1
or: %.0f for none
Reply
#6

Quote:
Originally Posted by CalvinC
Посмотреть сообщение
I don't know if this works, but try to do:
pawn Код:
Distance = GetPointDistanceToPoint3D(fX, fY, fZ, 925.8821,-1757.5184,13.5469 / 100);
No work
Reply
#7

Quote:
Originally Posted by CutX
Посмотреть сообщение
format it like this
pawn Код:
format(string, sizeof(string), " Kilomters %.2f to the point", Distance);
and it'll be 2 decimal places

do: %.1f for only 1
or: %.0f for none


Reply
#8

Omfg.

pawn Код:
new Float: d, string[16];

d = GetPlayerDistanceFromPoint(playerid, 925.8821, -1757.5184, 13.5469) / 1000;

format(string, sizeof (string), "Distance: %.2f", d);
SendClientMessage(playerid, ~1, string);
Reply
#9

Quote:
Originally Posted by fordawinzz
Посмотреть сообщение
Omfg.

pawn Код:
new Float: d, string[16];

d = GetPlayerDistanceFromPoint(playerid, 925.8821, -1757.5184, 13.5469) / 1000;

format(string, sizeof (string), "Distance: %.2f", d);
SendClientMessage(playerid, ~1, string);
work, thanks !!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)