SA-MP Forums Archive
[HELP PLEEASE] calculating kilometers from a point - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP PLEEASE] calculating kilometers from a point (/showthread.php?tid=283418)



[HELP PLEEASE] calculating kilometers from a point - TheArcher - 14.09.2011

Hello first thing i have this error.

Код:
....\gamemodes\lvdm.pwn(282) : error 076: syntax error in the expression, or invalid function call
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
My code is

pawn Код:
new string[128];
    new
        Float: fX,
        Float: fY,
        Float: fZ
    ;
    GetPlayerPos(playerid, fX, fY, fZ);
    GetPointDistanceToPoint3D(fX, fY, fZ, 792.0, 1212.0, 24.5);
    format(string, sizeof(string), " Kilomters %d to the point", GetPointDistanceToPoint3D);
    SendClientMessage(playerid, -1, string);
pawn Код:
stock Float: GetPointDistanceToPoint3D(Float: fX1, Float: fY1, Float: fZ1, Float: fX2, Float: fY2, Float: fZ2)
    return floatsqroot(((fX1 -= fX2) * fX1) + ((fY1 -= fY2) * fY1) + ((fZ1 -= fZ2) * fZ1));



Re: [HELP PLEEASE] calculating kilometers from a point - rt-2 - 14.09.2011

wich line is the 282?


Re: [HELP PLEEASE] calculating kilometers from a point - [HiC]TheKiller - 14.09.2011

pawn Код:
GetPointDistanceToPoint3D(fX, fY, fZ, 792.0, 1212.0, 24.5);
format(string, sizeof(string), " Kilomters %d to the point", GetPointDistanceToPoint3D);
What are you trying to do here? You're first using GetPointDistanceToPoint3D without actually assigning the value to any variables at all. Then you try use the function without any params. In addition to that, you're trying to use a float as a integer, %d = integer, %f = Float.

pawn Код:
new Float:Distance;
Distance = GetPointDistanceToPoint3D(fX, fY, fZ, 792.0, 1212.0, 24.5);
format(string, sizeof(string), " Kilomters %f to the point", Distance);
Give that a go.


Re: [HELP PLEEASE] calculating kilometers from a point - TheArcher - 15.09.2011

Quote:
Originally Posted by ******
Посмотреть сообщение
Have you ever heard of variables? If not you REALLY need to go and read the MOST BASIC introductions to coding in general.
Yes, sometime i'm just confused.

Quote:
Originally Posted by [HiC]TheKiller
Посмотреть сообщение
pawn Код:
GetPointDistanceToPoint3D(fX, fY, fZ, 792.0, 1212.0, 24.5);
format(string, sizeof(string), " Kilomters %d to the point", GetPointDistanceToPoint3D);
What are you trying to do here? You're first using GetPointDistanceToPoint3D without actually assigning the value to any variables at all. Then you try use the function without any params. In addition to that, you're trying to use a float as a integer, %d = integer, %f = Float.

pawn Код:
new Float:Distance;
Distance = GetPointDistanceToPoint3D(fX, fY, fZ, 792.0, 1212.0, 24.5);
format(string, sizeof(string), " Kilomters %f to the point", Distance);
Give that a go.
True, i know that %d is an integer and %f is a float. I thought that for knowing the point from a distance i needed a integer beacuse float is like 0.0.