A problem with speedo/fuel -
Rabea - 20.01.2015
i have real problem.
i use speedometter/fuel system with TextDraws.
the problem is when two players in the server using /tog speedo/fuel in the same time, it will show the speedo/fuel for both players.
anyone can help me with this?
Re: A problem with speedo/fuel -
xVIP3Rx - 20.01.2015
You're probably using one global variable instead of per-player one, post some codes.
Re: A problem with speedo/fuel -
Rabea - 20.01.2015
pawn Код:
// Fuelmeter
fuelmeter = TextDrawCreate(200.000000, 432.000000, "Fuel:");
TextDrawBackgroundColor(fuelmeter, 255);
TextDrawFont(fuelmeter, 1);
TextDrawLetterSize(fuelmeter, 0.500000, 1.000000);
TextDrawColor(fuelmeter, 16777215);
TextDrawSetOutline(fuelmeter, 0);
TextDrawSetProportional(fuelmeter, 1);
TextDrawSetShadow(fuelmeter, 1);
TextDrawSetSelectable(fuelmeter, 0);
// Speedometer
speedometer = TextDrawCreate(292.000000, 432.000000, "MPH:");
TextDrawBackgroundColor(speedometer, 255);
TextDrawFont(speedometer, 1);
TextDrawLetterSize(speedometer, 0.500000, 1.000000);
TextDrawColor(speedometer, 16777215);
TextDrawSetOutline(speedometer, 0);
TextDrawSetProportional(speedometer, 1);
TextDrawSetShadow(speedometer, 1);
TextDrawSetSelectable(speedometer, 0);
Re: A problem with speedo/fuel -
xVIP3Rx - 20.01.2015
As I expected, it's a global textdraw.
Read this
Re: A problem with speedo/fuel -
LivingLikeYouDo - 20.01.2015
It must be a Per-Player Textdraw.
https://sampwiki.blast.hk/wiki/CreatePlayerTextDraw
Global variables are for global things, but per-player variables are declared for only one player.
Re: A problem with speedo/fuel -
Rabea - 20.01.2015
pawn Код:
new PlayerText:gMyPlayerText[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW, ...};
thats you mean?
Re: A problem with speedo/fuel -
Rabea - 20.01.2015
its giving me error on this line:
pawn Код:
speedometer1Text[playerid] = TextDrawShowForPlayer(playerid, 240.0, 580.0, "KMH: %s", speed);
Error:
pawn Код:
invalid function or declaration
Re: A problem with speedo/fuel -
xVIP3Rx - 20.01.2015
an example of how this should be:
pawn Код:
//Declaring it
new PlayerText:mytextdraw[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW, ...};
//Creating it
mytextdraw[playerid] = CreatePlayerTextDraw(playerid, x, y, "blabla");
//Showing it
PlayerTextDrawShow(playerid, mytextdraw[playerid]);
Here are more functions for the per-player textdraws
Re: A problem with speedo/fuel -
Rabea - 20.01.2015
what i must type here "..."
Re: A problem with speedo/fuel -
xVIP3Rx - 20.01.2015
Probably doesn't matter, but better type what's in the original script of yours..