Speedometer bug - 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: Speedometer bug (
/showthread.php?tid=493631)
Speedometer bug -
Lunixx - 09.02.2014
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;
}
Re: Speedometer bug -
Stinged - 09.02.2014
GameTextForPlayer(playerid, szSpeed, 1500, 3);
https://sampwiki.blast.hk/wiki/GameTextForPlayer
1500 = 1.5 seconds
Try using a textdraw not a gametext.
Re: Speedometer bug -
Lunixx - 09.02.2014
So I should set TextDrawForPlayer?
Re: Speedometer bug -
Lunixx - 09.02.2014
I don't get it... Sorry im newb at scripting
Re: Speedometer bug -
Lunixx - 09.02.2014
HelP?
Re: Speedometer bug -
AlonzoTorres - 09.02.2014
Код:
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.