17.01.2015, 10:52
(
Последний раз редактировалось Aasim; 18.01.2015 в 14:28.
)
Hi, I'm having an issue with textdraws, so when a player hits someone in the head with either a deagle or sniper, both players get something like:
After approx 24 hours of uptime(server uptime) for some reason the textdraws stop appearing for all players, even if reconnected to the server, the headshot system still works tho as it's called by onplayertakedamage.
I think this may be a timer problem so I'm hoping someone here will help me understand how can I show the textdraw temporarly without creating a timer for each player.
Thanks in advance!
PHP код:
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;
}
I think this may be a timer problem so I'm hoping someone here will help me understand how can I show the textdraw temporarly without creating a timer for each player.
Thanks in advance!