09.10.2018, 18:53
Mhm, maybe format line is not correctly..
Try this:
And try this function to take vehicle speed:
And don't format with %f ( float ).
Your code is now:
Try this:
Код:
VehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid))-400]
Код:
stock GetVehicleSpeed(vehicleid) { new Float:xPos[3]: GetVehicleVelocity(vehicleid, xPos[0], xPos[1], xPos[2]); return floatround(floatsqroot(xPos[0] * xPos[0] + xPos[1] * xPos[1] + xPos[2] * xPos[2]) * 170.00); }
Your code is now:
Код:
if(newstate == PLAYER_STATE_DRIVER) { new string[128]; format(string, sizeof(string), "Vehicle: %s~n~Speed: %dkm/h", VehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid))-400], GetVehicleSpeed(GetPlayerVehicleID(playerid)); PlayerTextDrawSetString(playerid, tachometerText[playerid], string); PlayerTextDrawShow(playerid, tachometerText[playerid]); speedchange_timer[playerid] = SetTimerEx("SpeedChange",1000,true,"i",playerid); PlayerInfo[playerid][pInVeh] = 1; }