Speedometer bug
#1

If I type /speedo the speedometer appears but after 2-3 seconds it disappears
pawn Код:
CMD:speedo(playerid, params[]) {
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) {
        SendClientMessageEx(playerid, COLOR_GREY, "You're not driving a vehicle.");
    }
    else if(!PlayerInfo[playerid][pSpeedo]) {
        SendClientMessageEx(playerid, COLOR_WHITE, "You have enabled your speedometer.");
        PlayerInfo[playerid][pSpeedo] = 1;

        if(!FindTimePoints[playerid] && arr_Engine{GetPlayerVehicleID(playerid)} != 0) {

            new
            szSpeed[42];

            format(szSpeed, sizeof(szSpeed),"~n~~n~~n~~n~~n~~n~~n~~n~~n~~w~%.0f MPH", player_get_speed(playerid));
            GameTextForPlayer(playerid, szSpeed, 1500, 3);
        }
    }
    else {
        SendClientMessageEx(playerid, COLOR_WHITE, "You have disabled your speedometer.");
        PlayerInfo[playerid][pSpeedo] = 0;
        if(!FindTimePoints[playerid] && arr_Engine{GetPlayerVehicleID(playerid)} != 0) GameTextForPlayer(playerid, " ", 1500, 3);
    }
    return 1;
}
Reply
#2

GameTextForPlayer(playerid, szSpeed, 1500, 3);

https://sampwiki.blast.hk/wiki/GameTextForPlayer

1500 = 1.5 seconds

Try using a textdraw not a gametext.
Reply
#3

So I should set TextDrawForPlayer?
Reply
#4

I don't get it... Sorry im newb at scripting
Reply
#5

HelP?
Reply
#6

Код:
new PlayerText:text[MAX_PLAYERS];
CreatePlayerTextDraw(playerid, Float: x, Float:y, text[]);

PlayerTextDrawLetterSize(playerid, PlayerText:text, Float: x, Float:y);

PlayerTextDrawAlignment(playerid, PlayerText:text, alignment);

PlayerTextDrawColor(playerid, PlayerText:text, color);

PlayerTextDrawSetShadow(playerid, PlayerText:text, size);

PlayerTextDrawSetOutline(playerid, PlayerText:text, size);

PlayerTextDrawBackgroundColor(playerid, PlayerText:text, color);

PlayerTextDrawFont(playerid, PlayerText:text, font);

PlayerTextDrawSetProportional(playerid, PlayerText:text, set);

Then all you have to do is to create a timer for a function that updates the string of the textdraw,
DO NOT FORGET TO HIDE THEN SHOW THE SPEEDO AFTER YOU'VE SET THE STRING.

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)