24.08.2013, 13:34
No, you don't need it.
You created per-player textdraw but the tag was for glabal TDs. Anyways, I fixed few things, it should work.
PS: Per-player's textdraws get destroyed automatically when a player disconnects.
You created per-player textdraw but the tag was for glabal TDs. Anyways, I fixed few things, it should work.
pawn Код:
#include <a_samp>
#undef MAX_PLAYERS
#define MAX_PLAYERS 50 // Define it with the slots you want (no need 500.. waste)
new
PlayerText: KillTextDraw[ MAX_PLAYERS ]
;
public OnPlayerConnect(playerid)
{
KillTextDraw[playerid] = CreatePlayerTextDraw(playerid, 188.0, 89.0, "You got killed by N/A");
PlayerTextDrawLetterSize(playerid, KillTextDraw[playerid], 0.449999, 1.600000);
PlayerTextDrawAlignment(playerid, KillTextDraw[playerid], 1);
PlayerTextDrawColor(playerid, KillTextDraw[playerid], 16777215);
PlayerTextDrawSetShadow(playerid, KillTextDraw[playerid], 0);
PlayerTextDrawSetOutline(playerid, KillTextDraw[playerid], 1);
PlayerTextDrawBackgroundColor(playerid, KillTextDraw[playerid], 51);
PlayerTextDrawFont(playerid, KillTextDraw[playerid], 1);
PlayerTextDrawSetProportional(playerid, KillTextDraw[playerid], 1);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
new
ptname[ MAX_PLAYER_NAME ],
string[ 43 ]
;
GetPlayerName(killerid,ptname,MAX_PLAYER_NAME);
format(string,sizeof(string),"You got killed by %s",ptname);
PlayerTextDrawSetString(playerid, KillTextDraw[playerid], string);
PlayerTextDrawShow(playerid, KillTextDraw[playerid]);
SetTimerEx("HideKillDraw", 3000, false, "d", playerid);
return 1;
}
forward HideKillDraw(playerid);
public HideKillDraw(playerid)
{
PlayerTextDrawHide(playerid, KillTextDraw[playerid]);
}