11.03.2018, 17:48
GetVehicleSpeed:
Types:
Example:
PHP код:
GetVehicleSpeed(vehicleid, type)
{
new s;
new Float:x, Float:y, Float:z;
GetVehicleVelocity(vehicleid, x, y, z);
switch(type)
{
case 1: s = floatround((floatsqroot(floatpower(x, 2) + floatpower(y, 2) + floatpower(z, 2)))*112.1577, floatround_round);
default: s = floatround((floatsqroot(floatpower(x, 2) + floatpower(y, 2) + floatpower(z, 2)))*180.5000, floatround_round);
}
return s;
}
Код:
type 1 - mph any other type - kmh
PHP код:
public sometcallaback(playerid)
{
new str[3];
format(str, sizeof(str), "%d", GetVehicleSpeed(GetPlayerVehicleID(playerid), 0));
GameTextForPlayer(playerid, str, 100, 4);
return 1;
}