help with this textdraw
#1

Код:
//top of the script
forward HideKillDraw(playerid);
new Text:KillTextDraw[MAX_PLAYERS];
new KillTextTimer[MAX_PLAYERS];

public OnPlayerDeath(playerid, killerid, reason)
{
	new ptname[256];
	GetPlayerName(killerid,ptname,256);
    format(string,sizeof(string),"%s Owned",ptname);
	KillTextDraw[killerid] = TextDrawCreate(320.0, 360.0,string);
	TextDrawFont(KillTextDraw[killerid], 2);
	TextDrawSetShadow(KillTextDraw[killerid], 0);
	TextDrawSetOutline(KillTextDraw[killerid], 1);
	TextDrawAlignment(KillTextDraw[killerid], 2);
	TextDrawColor(KillTextDraw[killerid], COLOR_SRED);
	TextDrawShowForPlayer(killerid, KillTextDraw[killerid]);
	KillTextTimer[killerid] = SetTimerEx("HideKillDraw", 3000, false, "d", killerid);
    return 1;
}

public HideKillDraw(playerid)
{
    TextDrawHideForPlayer(playerid, KillTextDraw[playerid]);
	return 1;
}

public OnPlayerDisconnect(playerid,reason)
{
	TextDrawDestroy(KillTextDraw[playerid]);
    return 1;
}
well the i don't know what's wrong with the code, but when i enter the server and i kill someone it says that i got owned, and it's supposed to say that the other player got owned...
any help here please?
Reply
#2

Change

pawn Код:
new ptname[256];
GetPlayerName(killerid,ptname,256);
to

pawn Код:
new ptname[MAX_PLAYER_NAME];
GetPlayerName(playerid,ptname,MAX_PLAYER_NAME);
And you also create another textdraw every time player kills someone. You should do TextDrawCreate OnPlayerConnect and when player kills someone then use TextDrawSetString and TextDrawShowForPlayer.
Reply
#3

Quote:
Originally Posted by MadeMan
Change

pawn Код:
new ptname[256];
GetPlayerName(killerid,ptname,256);
to

pawn Код:
new ptname[MAX_PLAYER_NAME];
GetPlayerName(playerid,ptname,MAX_PLAYER_NAME);
And you also create another textdraw every time player kills someone. You should do TextDrawCreate OnPlayerConnect and when player kills someone then use TextDrawSetString and TextDrawShowForPlayer.
i don't understand well about TextDrawSetString even by reading the wiki... can u help?
Reply
#4

It's just like TextDrawCreate but instead of putting in text for a new textdraw, you're just changing a pre-made one.

TextDrawSetString(YourTextDraw,"WordZ");
Reply
#5

well now i have
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	new ptname[MAX_PLAYER_NAME];
	GetPlayerName(killerid,ptname,MAX_PLAYER_NAME);
    format(string,sizeof(string),"%s Owned",ptname);
    TextDrawSetString(KillTextDraw[killerid],string);
  	TextDrawShowForPlayer(killerid, KillTextDraw[killerid]);
	KillTextTimer[killerid] = SetTimerEx("HideKillDraw", 3000, false, "d", killerid);
    return 1;
}

public OnPlayerConnect()
{
	KillTextDraw[playerid] = TextDrawCreate(320.0, 360.0," ");
	TextDrawFont(KillTextDraw[playerid], 2);
	TextDrawSetShadow(KillTextDraw[playerid], 0);
	TextDrawSetOutline(KillTextDraw[playerid], 1);
	TextDrawAlignment(KillTextDraw[playerid], 2);
	TextDrawColor(KillTextDraw[playerid], COLOR_SRED);
    return 1;
}
and this is still not working...
Reply
#6

pawn Код:
GetPlayerName(playerid,ptname,MAX_PLAYER_NAME);
Do you have it like this?
Reply
#7

well i think problem is solved for now, but i wonder if 2 players die at the same time the textdraw stays on the screen and don't disappears, i'll test it, if the problem happens i'll post it here, thanks for the help guys
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)