[HELP PLEEASE] calculating kilometers from a point
#1

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));
Reply
#2

wich line is the 282?
Reply
#3

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.
Reply
#4

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)