SA-MP Forums Archive
BUG with textdraw - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: BUG with textdraw (/showthread.php?tid=344313)



BUG with textdraw - Papacool - 20.05.2012

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.

pawn Код:
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:

pawn Код:
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
pawn Код:
new PlayerText:speedo[MAX_PLAYERS][6];
In the top of my GM.
Thanks for your help,
PapaCool


Re: BUG with textdraw - [FMJ]PowerSurge - 20.05.2012

Maybe irrelevant, but what's the 6 array slots for..?


Re : BUG with textdraw - Papacool - 20.05.2012

Its for the decor of my speedometer


Re : BUG with textdraw - Papacool - 20.05.2012

UP please