20.09.2010, 19:03
hehe y_less this i already expected... :P but thanks for the explanation anyways
Ryder see this one based on SetSpeed i did a GetSpeed
Tested and worked if you want theres all you need to test :P
Mode 1 = KMH
Mode 0 = MPH
EDIT : SOmethings confused with my GM xD
Ryder see this one based on SetSpeed i did a GetSpeed
pawn Code:
new
Float:poskm[3]
;
cmd(speed,playerid,params[])
{
new
string[35]
;
format(string, sizeof string, "Speed: KMH %d MPH %d",GetSpeed(playerid, 1),GetSpeed(playerid, 0));
SendClientMessage(playerid, 0xF60000AA, string);
return 1;
}
stock
GetSpeed(playerid, mode = 1)
{
if(IsPlayerInAnyVehicle(playerid))
{
GetVehicleVelocity(GetPlayerVehicleID(playerid), poskm[0], poskm[1], poskm[2]);
return floatround(((!mode) ? floatmul(floatsqroot(floatadd(floatadd(floatpower(poskm[0], 2), floatpower(poskm[1], 2)), floatpower(poskm[2], 2))), 105.0) : floatmul(floatsqroot(floatadd(floatadd(floatpower(poskm[0], 2), floatpower(poskm[1], 2)), floatpower(poskm[2], 2))), 170.0)) * 1);
}
else
return false;
}
Mode 1 = KMH
Mode 0 = MPH
EDIT : SOmethings confused with my GM xD