SA-MP Forums Archive
Textdraws confusing 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Textdraws confusing bug (/showthread.php?tid=187021)



Textdraws confusing bug - admantis - 31.10.2010

I have made some textdraws, but the problem is that I don't see my own stats, I see somebody stats (with textdraws) If anybody know why this bug is caused please reply here.

Like I kill somebody, but it doesn't go up Kills for me, but I see his textdraw stats with a death more.

By the way the textdraw updates every spawn and other callbacks, not in OnPlayerDeath tho yet.


Re: Textdraws confusing bug - Mr.Jvxmc - 31.10.2010

please show the code


Re: Textdraws confusing bug - Kitten - 31.10.2010

whats the code u got so we can help you how the hell we would help you?!


Re: Textdraws confusing bug - admantis - 01.11.2010

Right, sorry for late response, I wasn't home.

pawn Код:
// ongamemodeinit
Textdraw1 = TextDrawCreate(70.000000, 430.000000, "kills");
    TextDrawAlignment(Textdraw1, 2);
    TextDrawBackgroundColor(Textdraw1, 0);
    TextDrawFont(Textdraw1, 3);
    TextDrawLetterSize(Textdraw1, 0.709999, 2.100000);
    TextDrawColor(Textdraw1, 2021837055);
    TextDrawSetOutline(Textdraw1, 0);
    TextDrawSetProportional(Textdraw1, 1);
    TextDrawSetShadow(Textdraw1, 1);
    TextDrawUseBox(Textdraw1, 1);
    TextDrawBoxColor(Textdraw1, 255);
    TextDrawTextSize(Textdraw1, 125.000000, 712.000000);


    Textdraw2 = TextDrawCreate(280.000000, 430.000000, "deaths");
    TextDrawAlignment(Textdraw2, 2);
    TextDrawBackgroundColor(Textdraw2, 255);
    TextDrawFont(Textdraw2, 3);
    TextDrawLetterSize(Textdraw2, 0.709999, 2.100000);
    TextDrawColor(Textdraw2, 2021837055);
    TextDrawSetOutline(Textdraw2, 0);
    TextDrawSetProportional(Textdraw2, 1);
    TextDrawSetShadow(Textdraw2, 1);
    TextDrawUseBox(Textdraw2, 1);
    TextDrawBoxColor(Textdraw2, 255);
    TextDrawTextSize(Textdraw2, 125.000000, 712.000000);

    Textdraw3 = TextDrawCreate(520.000000, 430.000000, "permissons");
    TextDrawAlignment(Textdraw3, 2);
    TextDrawBackgroundColor(Textdraw3, 255);
    TextDrawFont(Textdraw3, 3);
    TextDrawLetterSize(Textdraw3, 0.709999, 2.100000);
    TextDrawColor(Textdraw3, 2021837055);
    TextDrawSetOutline(Textdraw3, 0);
    TextDrawSetProportional(Textdraw3, 1);
    TextDrawSetShadow(Textdraw3, 1);
    TextDrawUseBox(Textdraw3, 1);
    TextDrawBoxColor(Textdraw3, 255);
    TextDrawTextSize(Textdraw3, 125.000000, 712.000000);

    Textdraw4 = TextDrawCreate(300.000000, 2.100000, "san fierro harbor");
    TextDrawAlignment(Textdraw4, 2);
    TextDrawBackgroundColor(Textdraw4, 255);
    TextDrawFont(Textdraw4, 3);
    TextDrawLetterSize(Textdraw4, 0.709999, 1.500000);
    TextDrawColor(Textdraw4, 2021837055);
    TextDrawSetOutline(Textdraw4, 0);
    TextDrawSetProportional(Textdraw4, 1);
    TextDrawSetShadow(Textdraw4, 1);
    TextDrawUseBox(Textdraw4, 1);
    TextDrawBoxColor(Textdraw4, 255);
    TextDrawTextSize(Textdraw4, 125.000000, 712.000000);
pawn Код:
//onplayerspawn
    TextDrawShowForPlayer(playerid,Textdraw1);
    TextDrawShowForPlayer(playerid,Textdraw2);
    TextDrawShowForPlayer(playerid,Textdraw3);
    TextDrawShowForPlayer(playerid,Textdraw4);
    SetupTextdraws(playerid);
pawn Код:
//onplayedeath
    TextDrawHideForPlayer(playerid,Textdraw1);
    TextDrawHideForPlayer(playerid,Textdraw2);
    TextDrawHideForPlayer(playerid,Textdraw3);
    TextDrawHideForPlayer(playerid,Textdraw4);
pawn Код:
forward SetupTextdraws(playerid)
public SetupTextdraws(playerid)
{
    new string[116];
    format(string, sizeof(string), "Kills: %d", PlayerInfo[playerid][pKills]);
    TextDrawSetString(Textdraw1, string);
    format(string, sizeof(string), "Deaths: %d", PlayerInfo[playerid][pDeaths]);
    TextDrawSetString(Textdraw2, string);
    format(string, sizeof(string), "Permissons: %d", PlayerInfo[playerid][pPermissons]);
    TextDrawSetString(Textdraw3, string);
    return 1;
}
please help ASAP


Re: Textdraws confusing bug - (SF)Noobanatior - 01.11.2010

looks like you only make one textdraw and try load everyones stats into it you will need to make one for each player

heres a sample of 1 i made
Код:
stock CreatePlayerTextd() {
    for(new i=0; i<MAX_PLAYERS; i++){
	   	tdforplayer[i] = TextDrawCreate(610,5," ");
		TextDrawFont(tdforplayer[i],1);
		TextDrawLetterSize(tdforplayer[i],0.4,1.0);
		TextDrawAlignment(tdforplayer[i],3);
		TextDrawSetString(tdforplayer[i]," ");
	}
}
hope this helps