15.12.2012, 15:58
You're making a textdraw only for one player and you're not using TextDrawShowForPlayer.
Add this anywhere:
Add this to OnPlayerConnect and remove the code that's in OnGameModeInit.
and the OnPlayerUpdate code:
This will work but I suggest you not to use OnPlayerUpdate, rather use a timer.
Add this anywhere:
pawn Код:
new Text:SpeedTD[MAX_PLAYERS]; // Speed TextDraw
Add this to OnPlayerConnect and remove the code that's in OnGameModeInit.
pawn Код:
SpeedTD[playerid] = TextDrawCreate(487.000000, 425.000000, "Speed");
TextDrawBackgroundColor(SpeedTD[playerid], 255);
TextDrawFont(SpeedTD[playerid], 1);
TextDrawLetterSize(SpeedTD[playerid], 0.500000, 1.300000);
TextDrawColor(SpeedTD[playerid], -1);
TextDrawSetOutline(SpeedTD[playerid], 1);
TextDrawSetProportional(SpeedTD[playerid], 1);
and the OnPlayerUpdate code:
pawn Код:
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER) // Speed TextDraw
{
TextDrawShowForPlayer(playerid, SpeedTD[playerid]);
new string[64], speed = GetVehicleSpeed(GetPlayerVehicleID(playerid), 0);
format(string, sizeof(string), "Speed: %d MPH", speed);
TextDrawSetString(SpeedTD[playerid], string);
}
else TextDrawHideForPlayer(playerid, SpeedTD[playerid]);
This will work but I suggest you not to use OnPlayerUpdate, rather use a timer.