How to get vehicle speed in this format KMph or Mph ??? - 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: How to get vehicle speed in this format KMph or Mph ??? (
/showthread.php?tid=132013)
How to get vehicle speed in this format KMph or Mph ??? -
mysql - 06.03.2010
How to get vehicle speed in this format KMph or Mph
How can I from x, y, z get KMph ?
Re: How to get vehicle speed in this format KMph or Mph ??? -
SlashPT - 06.03.2010
try this i dont know if works...
pawn Код:
stock GetSpeedKM(playerid)
{
new Float:PosX;
new Float:PosY;
new Float:PosZ;
GetPlayerPos(playerid, PosX, PosY, PosZ);
new value;
new Float:PlayerSpeedDistance;
PlayerSpeedDistance = floatsqroot(floatpower(floatabs(floatsub(PosX,ReadPlayerPosition[playerid][ReadX])),2)+floatpower(floatabs(floatsub(PosY,ReadPlayerPosition[playerid][ReadY])),2)+floatpower(floatabs(floatsub(PosZ,ReadPlayerPosition[playerid][ReadZ])),2));
value = floatround(PlayerSpeedDistance * 5000);
new KPH = floatround(value/800);
return KPH;
}
//==============================================================================
stock GetSpeedMP(playerid)
{
new Float:PosX;
new Float:PosY;
new Float:PosZ;
GetPlayerPos(playerid, PosX, PosY, PosZ);
new value;
new Float:PlayerSpeedDistance;
PlayerSpeedDistance = floatsqroot(floatpower(floatabs(floatsub(PosX,ReadPlayerPosition[playerid][ReadX])),2)+floatpower(floatabs(floatsub(PosY,ReadPlayerPosition[playerid][ReadY])),2)+floatpower(floatabs(floatsub(PosZ,ReadPlayerPosition[playerid][ReadZ])),2));
value = floatround(PlayerSpeedDistance * 5000);
new MPH = floatround(value/1400);
return MPH;
}
Re: How to get vehicle speed in this format KMph or Mph ??? -
mysql - 06.03.2010
Hmm it shows this errors on KMph starting on line 295 to 307:
C:\Users\Sebastian\Desktop\SERVER\filterscripts\ra ces.pwn(295) : error 029: invalid expression, assumed zero
C:\Users\Sebastian\Desktop\SERVER\filterscripts\ra ces.pwn(295) : error 017: undefined symbol "GetSpeedKM"
C:\Users\Sebastian\Desktop\SERVER\filterscripts\ra ces.pwn(303) : error 017: undefined symbol "ReadPlayerPosition"
C:\Users\Sebastian\Desktop\SERVER\filterscripts\ra ces.pwn(303) : warning 215: expression has no effect
C:\Users\Sebastian\Desktop\SERVER\filterscripts\ra ces.pwn(303) : error 001: expected token: ";", but found "]"
C:\Users\Sebastian\Desktop\SERVER\filterscripts\ra ces.pwn(303) : error 029: invalid expression, assumed zero