05.08.2010, 23:11
Hey!
I want this function to return a float value, but the compiler writes a warning..Here is the code:
What's the problem?
I want this function to return a float value, but the compiler writes a warning..Here is the code:
pawn Код:
new Float:OldPos[MAX_PLAYERS][3];
pawn Код:
stock GetMovedDistance(playerid, Float:posx, Float:posy, Float:posz)
{
if(OldPos[playerid][0] == 0 || OldPos[playerid][1] == 0 || OldPos[playerid][2] == 0)
{
GetPlayerPos(playerid, OldPos[playerid][0], OldPos[playerid][1], OldPos[playerid][2]);
return 0;
}
new
Float:TempPos[MAX_PLAYERS][3],
Float:distance;
TempPos[playerid][0] = floatabs(posx-OldPos[playerid][0]);
TempPos[playerid][1] = floatabs(posy-OldPos[playerid][1]);
TempPos[playerid][2] = floatabs(posz-OldPos[playerid][2]);
distance = floatsqroot(floatpower(TempPos[playerid][0], 2)+floatpower(TempPos[playerid][1], 2)+floatpower(TempPos[playerid][2], 2));
OldPos[playerid][0] = posx;
OldPos[playerid][1] = posy;
OldPos[playerid][2] = posz;
return distance;//Tag Mismatch warning here
}