textdraw, help please :P
#1

Well guys, I made a textdraw on player death.
But I want it to dissapear in 2 seconds.

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new string[286];
   
    format(string,sizeof(string),"You killed %s",playername[playerid]);
    killdraw = TextDrawCreate(255,45,string);
    TextDrawSetOutline(killdraw,1);
    TextDrawBackgroundColor(killdraw,COLOR_VIOLETRED);
    TextDrawShowForPlayer(playerid,killdraw);
    TextDrawTextSize(killdraw,10,10);
    TextDrawSetShadow(killdraw,10);
    kills[killerid] ++;
    deaths[playerid] ++;
    SetTimer("killtimer",2000,true);
   
   
    return 1;
}
pawn Код:
public killtimer(playerid)
{
    TextDrawHideForPlayer(playerid,killdraw);
    return 1;
}
but it doesn't dissapear.
It stays forever. :O
please help
Reply
#2

Try SetTimerEx.

pawn Код:
SetTimerEx("killtimer",2000,true,"",playerid);
Else it won't work.
Reply
#3

Quote:
Originally Posted by Jochemd
Посмотреть сообщение
Try SetTimerEx.

pawn Код:
SetTimerEx("killtimer",2000,true,"",playerid);
Else it won't work.
You must always use SetTimerEx if its in any callbacks else if its under OnGamemodeInit you can use SetTimer.
Reply
#4

Thanks, but it still doesn't dissapear after 2 seconds
Reply
#5

Dunno, maybe try this :

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new string[286];
   
    format(string,sizeof(string),"You killed %s",playername[playerid]);
    killdraw = TextDrawCreate(255,45,string);
    TextDrawSetOutline(killdraw,1);
    TextDrawBackgroundColor(killdraw,COLOR_VIOLETRED);
    TextDrawShowForPlayer(playerid,killdraw);
    TextDrawTextSize(killdraw,10,10);
    TextDrawSetShadow(killdraw,10);
    kills[killerid] ++;
    deaths[playerid] ++;
    SetTimerEx("KillLOLTimer", 2000, false, "i", playerid);
   
   
    return 1;
}

forward KillLOLTimer(playerid);
public KillLOLTimer(playerid)
{
   TextDrawHideForPlayer(playerid,killdraw);
   return 1;
}
Reply
#6

Its recommended to use
format(gstring, sizeof(gstring),"~w~You killed ~g~%s", playername);
GameTextForPlayer(killerid, 1000, 3);

As it is much easier with less space, and almost the same result
(gstring is not what a woman wears , but gstring = gametextstring )
Reply
#7

Thanks kenneth. This works fine.
Lol not what a women wears xD
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)