07.03.2015, 19:00
Hi friends!
i have a problem with my fuel and speedometer textdraws
when a player seat in a vehicle it will work good but when when two players drive in same time fuel meter and speedometer will start blinking!
i put it under onplayerupdate
and put it under onplayerstatechange
Help for +rep
i have a problem with my fuel and speedometer textdraws
when a player seat in a vehicle it will work good but when when two players drive in same time fuel meter and speedometer will start blinking!
PHP код:
// Fuelmeter
fuelmeter = TextDrawCreate(200.000000, 432.000000, "Fuel:");
TextDrawBackgroundColor(fuelmeter, 255);
TextDrawFont(fuelmeter, 1);
TextDrawLetterSize(fuelmeter, 0.500000, 1.000000);
TextDrawColor(fuelmeter, 16777215);
TextDrawSetOutline(fuelmeter, 0);
TextDrawSetProportional(fuelmeter, 1);
TextDrawSetShadow(fuelmeter, 1);
TextDrawSetSelectable(fuelmeter, 0);
// Speedometer
speedometer = TextDrawCreate(301.000000, 432.000000, "MPH:");
TextDrawBackgroundColor(speedometer, 255);
TextDrawFont(speedometer, 1);
TextDrawLetterSize(speedometer, 0.500000, 1.000000);
TextDrawColor(speedometer, 16777215);
TextDrawSetOutline(speedometer, 0);
TextDrawSetProportional(speedometer, 1);
TextDrawSetShadow(speedometer, 1);
TextDrawSetSelectable(speedometer, 0);
PHP код:
if(Speedo[playerid] && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new string[64], speed = GetVehicleSpeed(GetPlayerVehicleID(playerid), 0);
format(string,sizeof(string),"MPH: %d", speed);
TextDrawSetString(speedometer, string);
}
if(fMeter[playerid] && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new string[64];
format(string,sizeof(string),"Fuel: %d%", Fuel[GetPlayerVehicleID(playerid)]);
TextDrawSetString(fuelmeter, string);
}
PHP код:
if(newstate == PLAYER_STATE_DRIVER)
{
fMeter[playerid] =1;
Speedo[playerid] = 1;
TextDrawShowForPlayer(playerid,speedometer);
TextDrawShowForPlayer(playerid,fuelmeter);
}