SA-MP Forums Archive
textdraw, help please :P - 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: textdraw, help please :P (/showthread.php?tid=162690)



textdraw, help please :P - bartje01 - 24.07.2010

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


Re: textdraw, help please :P - Jochemd - 24.07.2010

Try SetTimerEx.

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


Re: textdraw, help please :P - Jay. - 24.07.2010

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.


Re: textdraw, help please :P - bartje01 - 24.07.2010

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


Re: textdraw, help please :P - ViruZZzZ_ChiLLL - 24.07.2010

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;
}



Re: textdraw, help please :P - KennethRandall - 24.07.2010

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 )


Re: textdraw, help please :P - bartje01 - 24.07.2010

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