[INC HELP] Speed.inc - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [INC HELP] Speed.inc (
/showthread.php?tid=73881)
[INC HELP] Speed.inc -
szep_anita_01 - 18.04.2009
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 Float
dist = SPos[playerid][3]-SPos[playerid][0];
new Float:ydist = SPos[playerid][4]-SPos[playerid][1];
new Float
qxdist = xdist*xdist;
new Float
qydist = ydist*ydist;
new Float:distance = (sqxdist+sqydist)/31;
return distance;
}
return 1;
}
whats the problem? pls help
Re: [INC HELP] Speed.inc -
Castle - 18.04.2009
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 Float dist = SPos[playerid][3]-SPos[playerid][0];
new Float:ydist = SPos[playerid][4]-SPos[playerid][1];
new Float qxdist = xdist*xdist;
new Float qydist = ydist*ydist;
new Float:distance = (sqxdist+sqydist)/31;
return distance;
}
return 1;
}
whats the problem? pls help
|
have you tried return 1;?
Re: [INC HELP] Speed.inc -
ICECOLDKILLAK8 - 18.04.2009
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;
Re: [INC HELP] Speed.inc -
pspleo - 18.04.2009
Pff.
Use public, not stock. And put Float:
pawn Код:
public Float:GetPlayerSpeed
Leopard
Re: [INC HELP] Speed.inc -
Joe Staff - 18.04.2009
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