OnPlayerStateChange - textdraw not show
#3

Mhm, maybe format line is not correctly..

Try this:
Код:
VehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid))-400]
And try this function to take vehicle speed:
Код:
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);
}
And don't format with %f ( float ).

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


Messages In This Thread
OnPlayerStateChange - textdraw not show - by MrakBuster - 09.10.2018, 07:30
Re: OnPlayerStateChange - textdraw not show - by NaS - 09.10.2018, 14:26
Re: OnPlayerStateChange - textdraw not show - by Dennis12 - 09.10.2018, 18:53

Forum Jump:


Users browsing this thread: 2 Guest(s)