maybe you can help me ? textdraw problem - 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: maybe you can help me ? textdraw problem (
/showthread.php?tid=351304)
maybe you can help me ? textdraw problem -
Papacool - 15.06.2012
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[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[5], string);
}
}
}
Under
OnPlayerConnect I create textdraw for player:
pawn Код:
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);
What's wrong please ?
Thanks and Have a nice day
Re: maybe you can help me ? textdraw problem -
Vince - 15.06.2012
Every time you create a new textdraw in OnPlayerConnect, it overwrites the previous id. You need a MAX_PLAYER array to save all ids separately.
Re: maybe you can help me ? textdraw problem -
Papacool - 16.06.2012
Even with an MAX_PLAYERS array, it do the same problem... :/