PDA

View Full Version : BUG with textdraw


Papacool
20/05/2012, 03:54 PM
Hi guys,
I have a problem with my speedometer
When ID 0 enter in his vehicle, he sees the speedo perfectly like I want,
But ID 1 see the speedo in double
ID 2 In triple
ID 3 Crash
ID 4 Crash etc...

Where is the problem ?
Here my timer with the speedometer.


public Speedometer()
{
new vehicleid, Float:health;
new engine, lights, alarm, doors, bonnet, boot, objective;
new fstring[32], string[512];

for(new i=0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
{

vehicleid = GetPlayerVehicleID(i);
GetVehicleHealth(vehicleid, health);
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);



strcat(string, "~n~~b~~h~GPS: ~w~", sizeof(string));
strcat(string, GetPlayer3DZone(i), sizeof(string));

strcat(string, "~n~~b~~h~Life: ~n~ ~g~", sizeof(string));
fstring = "||||||||||";
if(health > 1000.0) strins(fstring, "~r~", 10, sizeof(fstring));
else if(health < 0.0) strins(fstring, "~r~", 0, sizeof(fstring));
else strins(fstring, "~r~", floatround(health/100.0), sizeof(fstring));
strcat(string, fstring, sizeof(string));

strcat(string, "~n~~b~~h~Fuel:~n~ ~g~", sizeof(string));
fstring = "||||||||||";
if(Fuel[vehicleid] > 100.0) strins(fstring, "~r~", 10, sizeof(fstring));
else if(Fuel[vehicleid] < 0.0) strins(fstring, "~r~", 0, sizeof(fstring));
else strins(fstring, "~r~", floatround(Fuel[vehicleid]/10.0), sizeof(fstring));
strcat(string, fstring, sizeof(string));

strcat(string, " ~b~~h~", sizeof(string));


PlayerTextDrawSetString(i, speedo[i][5], string);
}
}
}

here the textdraw create under OnPlayerConnect:


speedo[playerid][5] = CreatePlayerTextDraw(playerid,436.000000, 319.000000, " ");
PlayerTextDrawBackgroundColor(playerid,speedo[playerid][5], 255);
PlayerTextDrawFont(playerid,speedo[playerid][5], 1);
PlayerTextDrawLetterSize(playerid,speedo[playerid][5], 0.470000, 1.400000);
PlayerTextDrawColor(playerid,speedo[playerid][5], -1);
PlayerTextDrawSetOutline(playerid,speedo[playerid][5], 0);
PlayerTextDrawSetProportional(playerid,speedo[playerid][5], 1);
PlayerTextDrawSetShadow(playerid,speedo[playerid][5], 1);

I of course put new PlayerText:speedo[MAX_PLAYERS][6]; In the top of my GM.
Thanks for your help,
PapaCool

[FMJ]PowerSurge
20/05/2012, 04:02 PM
Maybe irrelevant, but what's the 6 array slots for..?

Papacool
20/05/2012, 04:06 PM
Its for the decor of my speedometer

Papacool
20/05/2012, 05:01 PM
UP please :o