[+ REP] Problem speedometer
#1

Hi,
I have a problem,
ID 0 sees the speedo perfectly, but ID 1 sees in double, ID 3 in triple, etc..

Here the ID 5 screenshot for example:
http://www.noelshack.com/2012-21-133...-sa-mp-094.png

Here my script:

IN THE TOP:
pawn Код:
new PlayerText:speedo[MAX_PLAYERS][6];
the array [6] is for some decor of my speedo

The Timer:
pawn Код:
public Speedometer()
{
    new fstring[32], string[512];

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

                      // I have other stuff here, but i have comment them
            format(fstring,sizeof(fstring),"~n~Km/h: ~w~%d", GetPlayerSpeed(i, true));
            strcat(string, fstring, sizeof(string));
           

            PlayerTextDrawSetString(i, speedo[i][5], string);
        }
    }
}
Under OnPlayerConnect I create textdraw for player:
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);

What's wrong please ?

Thanks and Have a nice day
Reply
#2

You don't need to add [MAX_PLAYERS] when creating textdraw using PlayerTextDraw remove it
Reply
#3

Why you're using

pawn Код:
new PlayerText:speedo[MAX_PLAYERS][6];
6 here and:

pawn Код:
PlayerTextDrawSetString(i, speedo[i][5], string);
5 here?

Also you dont need to create MAX_PLAYERS.
Reply
#4

heres the code without [MAX_PLAYERS]

pawn Код:
new PlayerText:speedo[6];

public Speedometer()
{
    new fstring[32], string[512];

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


                      // I have other stuff here, but i have comment them
            format(fstring,sizeof(fstring),"~n~Km/h: ~w~%d", GetPlayerSpeed(i, true));
            strcat(string, fstring, sizeof(string));


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

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

didn't work
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)