new Text:DescriptionText[MAX_PLAYERS];
new DescriptionTimer[MAX_PLAYERS];
forward HideDescriptionText(playerid);
public OnPlayerHeadShot(playerid, issuerid, Float:amount)
{
new
up_string[ 128 ],
pk_string[ 128 char ],
pName[ MAX_PLAYER_NAME ]
;
GetPlayerName(issuerid, pName, sizeof(pName));
strunpack(up_string, pk_string);
//format(up_string, sizeof(up_string), "[DEBUG] - Headshot detected executed by %s[%i] - damage %.3f", pName, playerid, amount);
//SendClientMessage(playerid, -1, up_string);
//GameTextForPlayer(issuerid," ~g~HEAD~b~SHOT!",2000,3);
new string[126], stringh[126];
/*format(string, sizeof(string), "~n~ ~n~ ~n~ ~n~ ~n~ ~r~[HEADSHOT]~w~You got killed by:~y~%s~w~.", gName(issuerid));
format(stringh, sizeof(stringh), "n~ ~n~ ~n~ ~n~ ~n~ ~r~[HEADSHOT]~w~You killed :~y~%s~w~!", gName(playerid));
GameTextForPlayer(issuerid,stringh,2000,3);
GameTextForPlayer(playerid,string,2000,3);*/
format(string, sizeof(string), "~r~[HEADSHOT]~w~You got killed by:~y~%s~w~.", gName(issuerid));
format(stringh, sizeof(stringh), "~r~[HEADSHOT]~w~You killed :~y~%s~w~!", gName(playerid));
ShowDescriptionText(issuerid, stringh);
ShowDescriptionText(playerid, string);
SetPlayerHealth(playerid, 0.0);
return strpack(up_string, pk_string);
}
stock ShowDescriptionText(playerid, string[])
{
KillTimer(DescriptionTimer[playerid]);
TextDrawSetString(DescriptionText[playerid], string);
TextDrawShowForPlayer(playerid, DescriptionText[playerid]);
DescriptionTimer[playerid] = SetTimerEx("HideDescriptionText", 5000, 0, "i", playerid);
return 1;
}
forward HideDescriptionText(playerid);
public HideDescriptionText(playerid)
{
TextDrawHideForPlayer(playerid, DescriptionText[playerid]);
return 1;
}
public OnPlayerConnect(playerid)
{
DescriptionText[playerid] = TextDrawCreate(310.0, 270.0, " ");
TextDrawAlignment(DescriptionText[playerid], 2);
TextDrawFont(DescriptionText[playerid], 1);
TextDrawLetterSize(DescriptionText[playerid], 0.320000, 1.700000);
TextDrawSetOutline(DescriptionText[playerid], 1);
TextDrawHideForPlayer(playerid, DescriptionText[playerid]);
return 1;
}
public OnPlayerDisconnect(playerid)
{
DescriptionText[playerid] = Text: INVALID_TEXT_DRAW;
return 1;
}
You want to Show a textdraw whenever a player shots someone in head and hide the TD after 5 seconds?
|
Well maybe because you are creating one textdraw again and again? Destroy it on disconnect or use playertextdraw.
|
#define FILTERSCRIPT
#include <a_samp>
#include <zcmd>
#if defined FILTERSCRIPT
new Text:TDEditor_TD[2];
forward HideDescriptionText(playerid);
forward OnPlayerHeadShot(playerid, issuerid, Float:amount);
public OnFilterScriptInit()
{
TDEditor_TD[0] = TextDrawCreate(402.199584, 4.378755, "Watch_movies_online_for_free_at_movies1337.com"); //This one here is changing to [HEADSHOT]blablabla
TextDrawLetterSize(TDEditor_TD[0], 0.400000, 0.800000);
TextDrawAlignment(TDEditor_TD[0], 2);
TextDrawColor(TDEditor_TD[0], 255);
TextDrawSetShadow(TDEditor_TD[0], 0);
TextDrawSetOutline(TDEditor_TD[0], 1);
TextDrawBackgroundColor(TDEditor_TD[0], 16711935);
TextDrawFont(TDEditor_TD[0], 2);
TextDrawSetProportional(TDEditor_TD[0], 1);
TextDrawSetShadow(TDEditor_TD[0], 0);
TDEditor_TD[1] = TextDrawCreate(166.000000, 432.044494, "play.bestsampserver.com:7777__/teles_/cmds_/rules");
TextDrawLetterSize(TDEditor_TD[1], 0.400000, 1.600000);
TextDrawAlignment(TDEditor_TD[1], 1);
TextDrawColor(TDEditor_TD[1], -1);
TextDrawSetShadow(TDEditor_TD[1], 0);
TextDrawSetOutline(TDEditor_TD[1], 1);
TextDrawBackgroundColor(TDEditor_TD[1], 255);
TextDrawFont(TDEditor_TD[1], 1);
TextDrawSetProportional(TDEditor_TD[1], 1);
TextDrawSetShadow(TDEditor_TD[1], 0);
TextDrawShowForAll(TDEditor_TD[0]);
TextDrawShowForAll(TDEditor_TD[1]);
return 1;
}
public OnFilterScriptExit()
{
TextDrawDestroy(TDEditor_TD[0]);
TextDrawDestroy(TDEditor_TD[1]);
return 1;
}
#else
main()
{
}
#endif
public OnGameModeInit()
{
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
return 1;
}
public OnPlayerConnect(playerid)
{
TextDrawShowForAll(TDEditor_TD[0]);
TextDrawShowForAll(TDEditor_TD[1]);
return 1;
}