Textdraw problem
#1

Hey guys,

Im currencly trying to get my textdraws working, but i kinda got stuck.
Atm, i got 2 textdraws. One which should show your kills & deaths, and the other one is for the time left in the round. Now, its only showing ONE textdraw. The kills/deaths one. Ive created both of them, they (should) be visible, since im showing them when the player spawns. Is this a bug, or is it just how im scripting it?
pawn Код:
//OnGameModeInit
    TimeLeft = TextDrawCreate(496.000000, 0.000000, "Time left: ~b~10:00");
    TextDrawBackgroundColor(TimeLeft, 255);
    TextDrawFont(TimeLeft, 1);
    TextDrawLetterSize(TimeLeft, 0.400000, 2.099999);
    TextDrawColor(TimeLeft, -1);
    TextDrawSetOutline(TimeLeft, 0);
    TextDrawSetProportional(TimeLeft, 1);
    TextDrawSetShadow(TimeLeft, 1);
    TextDrawHideForAll(TimeLeft);

//OnPlayerConnect
    MyKills[playerid] = TextDrawCreate(538.000000, 406.000000, "Kills:    ~g~99 ~n~~w~Deaths: ~g~99");
    TextDrawBackgroundColor(MyKills[playerid], 255);
    TextDrawFont(MyKills[playerid], 1);
    TextDrawLetterSize(MyKills[playerid], 0.509999, 1.700000);
    TextDrawColor(MyKills[playerid], -1);
    TextDrawSetOutline(MyKills[playerid], 0);
    TextDrawSetProportional(MyKills[playerid], 1);
    TextDrawSetShadow(MyKills[playerid], 1);
    TextDrawUseBox(MyKills[playerid], 1);
    TextDrawBoxColor(MyKills[playerid], 120);
    TextDrawTextSize(MyKills[playerid], 630.000000, 0.000000);
    TextDrawHideForPlayer(playerid, MyKills[playerid]);
TextDrawShowForPlayer( playerid, TimeLeft );

//OnPlayerSpawn
TextDrawShowForPlayer( playerid, MyKills[playerid] );
Reply
#2

Quote:
pawn Код:
//OnPlayerSpawn
TextDrawShowForPlayer( playerid, MyKills[playerid] );
Have you just forgot to add the other one, or you don't even have it in your script?
Anyways, if not that, the problem might be in another part of your code. Show the part where you are setting the TD string to show the time left.
Reply
#3

I think that
pawn Код:
MyKills[playerid] = TextDrawCreate(538.000000, 406.000000, "Kills:    ~g~99 ~n~~w~Deaths: ~g~99");
    TextDrawBackgroundColor(MyKills[playerid], 255);
    TextDrawFont(MyKills[playerid], 1);
    TextDrawLetterSize(MyKills[playerid], 0.509999, 1.700000);
    TextDrawColor(MyKills[playerid], -1);
    TextDrawSetOutline(MyKills[playerid], 0);
    TextDrawSetProportional(MyKills[playerid], 1);
    TextDrawSetShadow(MyKills[playerid], 1);
    TextDrawUseBox(MyKills[playerid], 1);
    TextDrawBoxColor(MyKills[playerid], 120);
    TextDrawTextSize(MyKills[playerid], 630.000000, 0.000000);
    TextDrawHideForPlayer(playerid, MyKills[playerid]);
should be under OnGameModeInIt also
Reply
#4

Quote:
Originally Posted by AeroBlast
Посмотреть сообщение
I think that
pawn Код:
MyKills[playerid] = TextDrawCreate(538.000000, 406.000000, "Kills:    ~g~99 ~n~~w~Deaths: ~g~99");
    TextDrawBackgroundColor(MyKills[playerid], 255);
    TextDrawFont(MyKills[playerid], 1);
    TextDrawLetterSize(MyKills[playerid], 0.509999, 1.700000);
    TextDrawColor(MyKills[playerid], -1);
    TextDrawSetOutline(MyKills[playerid], 0);
    TextDrawSetProportional(MyKills[playerid], 1);
    TextDrawSetShadow(MyKills[playerid], 1);
    TextDrawUseBox(MyKills[playerid], 1);
    TextDrawBoxColor(MyKills[playerid], 120);
    TextDrawTextSize(MyKills[playerid], 630.000000, 0.000000);
    TextDrawHideForPlayer(playerid, MyKills[playerid]);
should be under OnGameModeInIt also
No it shouldn't, because it contains a pvar and it would bug even if he does a loop on OnGameModeInit(an unefficient of doing it, as well).
Reply
#5

Well, ive just created the textdraws, and didnt do anything else to it yet. I just wanted to test it, and found that bug. Its showing the textdra when he connects, should it be in OnPlayerSpawn aswell?
Reply
#6

Oh, well try showing it when the players spawns instead of when the player connects as when the OnPlayerConnect function gets called the player isn't completely connected, and that could couse bugs such as this in your case. You might set a timer, but there isn't any sense in doing it when you can just use OnPlayerSpawn callback to show the textdraw.
Reply
#7

I just edited it, and now it doesnt show up at onplayerconnect anymore, but at onplayerspawn.
When i go ingame, im still having the same problem. If you dont know what the problem is, you can just come in my server. (Pm me for ip)
Reply
#8

pawn Код:
new Timer,message1[50],message2[50];

// OnGameModeInit
TimeLeft = TextDrawCreate(496.000000, 0.000000, "Time left: ~b~10:00");
TextDrawBackgroundColor(TimeLeft, 255);
TextDrawFont(TimeLeft, 1);
TextDrawLetterSize(TimeLeft, 0.400000, 2.099999);
TextDrawColor(TimeLeft, -1);
TextDrawSetOutline(TimeLeft, 0);
TextDrawSetProportional(TimeLeft, 1);
TextDrawSetShadow(TimeLeft, 1);

MyKills[playerid] = TextDrawCreate(538.000000, 406.000000, "Kills:    ~g~99 ~n~~w~Deaths: ~g~99");
TextDrawBackgroundColor(MyKills[playerid], 255);
TextDrawFont(MyKills[playerid], 1);
TextDrawLetterSize(MyKills[playerid], 0.509999, 1.700000);
TextDrawColor(MyKills[playerid], -1);
TextDrawSetOutline(MyKills[playerid], 0);
TextDrawSetProportional(MyKills[playerid], 1);
TextDrawSetShadow(MyKills[playerid], 1);
TextDrawUseBox(MyKills[playerid], 1);
TextDrawBoxColor(MyKills[playerid], 120);
TextDrawTextSize(MyKills[playerid], 630.000000, 0.000000);


// OnPlayerConnect
Timer=SetTimerEx("Textdrawtimer", 200, true, "i", playerid);


forward Textdrawtimer(playerid);
stock Textdrawtimer(playerid)
{
    format(message1, sizeof(message1),"Time left: ~b~%i", Your Count Down Timer);
    format(message2, sizeof(message2),"Kills:    ~g~%i ~n~~w~Deaths: ~g~%i", Your Kills variable, Your Deaths variable);
    TextDrawSetString(TimeLeft,message1);
    TextDrawSetString(MyKills[playerid],message2);
    return 1;
}


// It's your choice where to put these. OnPlayerConnect or OnPlayerSpawn.
TextDrawHideForAll(TimeLeft);
TextDrawHideForPlayer(playerid, MyKills[playerid]);
TextDrawShowForPlayer( playerid, TimeLeft );
Reply
#9

Thats not the problem at all. One textdraw is showing, and the other one isnt. The one that is being showed, is at the location of the one that isnt showing.

Код:
				TD1
				
				
				TD2
TD1 isnt showing up (TimeLeft), and the TD2 is loading, but its at the location of TD1.
Reply
#10

Well for me it shows like this:

http://www.part.lt/perziura/dcf5c3ed...24c314b353.jpg
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)