OnPlayerStateChange - textdraw not show
#1

Hello,

I am making myself an easy speedometer. I got the job done, but when it came to final part - showing it, i experienced a problem. This is my code:
Код:
	if(newstate == PLAYER_STATE_DRIVER)
 	{
		new string[128];
		format(string, sizeof(string), "Vehicle: %s~n~Speed: %fkm/h", VehicleNames[VehicleModel[playerid]-400], floatround(GetVehicleSpeed(playerid), floatround_ceil));
		PlayerTextDrawSetString(playerid, tachometerText[playerid], string);
		PlayerTextDrawShow(playerid, tachometerText[playerid]);
		speedchange_timer[playerid] = SetTimerEx("SpeedChange",1000,true,"i",playerid);
		PlayerInfo[playerid][pInVeh] = 1;
	}
What I have tried:

1. Putting function into command - I executed command in car, while going certain speed. With no problem, everything worked out perfectly.

2. Putting function into OnPlayerEnterVehicle - I used it in (!ispassanger) parameter, because I want it to be shown only to driver. But as soon as I entered vehicle, I was not surprised. Nothing was shown.

3. Printing the function - I printed out whole entire function and found out, that nothing is executing. Like my state was not changing from pedestrian to driver.

4. Using old state. - I have put an oldstate, before checking for newstate, like this: if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER) but nothing shown up.

If anyone would be enable to help me, that reputation button for him, would be on point for me.

Thanks.
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: 1 Guest(s)