How to get vehicle speed in this format KMph or Mph ???
#1

How to get vehicle speed in this format KMph or Mph
How can I from x, y, z get KMph ?
Reply
#2

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;
}
Reply
#3

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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)