[INC HELP] Speed.inc
#1

Hello Guys...i want make a Speed.inc but i have a warning "warning 213: tag mismatch" when i want compile my script...

stock GetPlayerSpeed(playerid)
{
GetPlayerPos(playerid, SPos[playerid][3], SPos[playerid][4], SPos[playerid][5]);
if(SPos[playerid][5] > 550.0)
{
SPos[playerid][0] = 0.0;
SPos[playerid][1] = 0.0;
}
if(SPos[playerid][0] != 0.0)
{
new Floatdist = SPos[playerid][3]-SPos[playerid][0];
new Float:ydist = SPos[playerid][4]-SPos[playerid][1];
new Floatqxdist = xdist*xdist;
new Floatqydist = ydist*ydist;
new Float:distance = (sqxdist+sqydist)/31;
return distance;
}
return 1;
}

whats the problem? pls help
Reply
#2

Quote:
Originally Posted by szep_anita_01
Hello Guys...i want make a Speed.inc but i have a warning "warning 213: tag mismatch" when i want compile my script...

stock GetPlayerSpeed(playerid)
{
GetPlayerPos(playerid, SPos[playerid][3], SPos[playerid][4], SPos[playerid][5]);
if(SPos[playerid][5] > 550.0)
{
SPos[playerid][0] = 0.0;
SPos[playerid][1] = 0.0;
}
if(SPos[playerid][0] != 0.0)
{
new Floatdist = SPos[playerid][3]-SPos[playerid][0];
new Float:ydist = SPos[playerid][4]-SPos[playerid][1];
new Floatqxdist = xdist*xdist;
new Floatqydist = ydist*ydist;
new Float:distance = (sqxdist+sqydist)/31;
return distance;
}
return 1;
}

whats the problem? pls help
have you tried return 1;?
Reply
#3

You have to define the variable that GetPlayerSpeed is going into as a Float e.g.
pawn Код:
// Instead of
new Speed;
// You would use
new Float:Speed;
Reply
#4

Pff.
Use public, not stock. And put Float:
pawn Код:
public Float:GetPlayerSpeed
Leopard
Reply
#5

Don't use anything, just put
Float:GetPlayerSpeed(playerid)
{
..
}

and FYI that is an inaccurate representation of speed
try

floatsqroot(floatpower(x2-x1,2)+floatpower(y2-y1,2)+floatpower(z2-z1,2));

that is the algorithm to get the distance between 2 3 dimensional points
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)