killed = TextDrawCreate(247.000000, 351.000000, "killed by"); TextDrawBackgroundColor(killed, 255); TextDrawFont(killed, 3); TextDrawLetterSize(killed, 0.459998, 2.000000); TextDrawColor(killed, 227526655); TextDrawSetOutline(killed, 0); TextDrawSetProportional(killed, 1); TextDrawSetShadow(killed, 1); killedby = TextDrawCreate(247.000000, 351.000000, "you killed"); TextDrawBackgroundColor(killedby, 255); TextDrawFont(killedby, 3); TextDrawLetterSize(killedby, 0.459998, 2.000000); TextDrawColor(killedby, 227526655); TextDrawSetOutline(killedby, 0); TextDrawSetProportional(killedby, 1); TextDrawSetShadow(killedby, 1);
new Text:killed;
new Text:killedby;
public OnGameModeInit()
{
//All things above this.
killed = TextDrawCreate(247.000000, 351.000000, "_____");
TextDrawBackgroundColor(killed, 255);
TextDrawFont(killed, 3);
TextDrawLetterSize(killed, 0.459998, 2.000000);
TextDrawColor(killed, 227526655);
TextDrawSetOutline(killed, 0);
TextDrawSetProportional(killed, 1);
TextDrawSetShadow(killed, 1);
killedby = TextDrawCreate(247.000000, 351.000000, "_____");
TextDrawBackgroundColor(killedby, 255);
TextDrawFont(killedby, 3);
TextDrawLetterSize(killedby, 0.459998, 2.000000);
TextDrawColor(killedby, 227526655);
TextDrawSetOutline(killedby, 0);
TextDrawSetProportional(killedby, 1);
TextDrawSetShadow(killedby, 1);
return 1;
}
public OnGameModeExit()
{
TextDrawHideForPlayer(playerid, killed);
TextDrawDestroy(killed);
TextDrawHideForPlayer(playerid, killedby);
TextDrawDestroy(killedby);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
TextDrawHideForPlayer(playerid, killed);
TextDrawDestroy(killed);
TextDrawHideForPlayer(playerid, killedby);
TextDrawDestroy(killedby);
return 1;
}
public OnPlayerSpawn(playerid)
{
TextDrawHideForPlayer(playerid, killed);
TextDrawHideForPlayer(playerid, killedby);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
new killinfo[210];
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(killinfo, sizeof(killinfo), "You killed %s(%d).", playername, playerid);
TextDrawSetString(killed, killinfo);
TextDrawShowForPlayer(playerid, killed);
SetTimerEx("HideTextdraw", 5000, false, "i", killerid); // 1000 = 1 Second, therefore 5000 = 5 Second
new deathinfo[210];
new killername[MAX_PLAYER_NAME];
GetPlayerName(playerid,killername,sizeof(killername));
format(deathinfo, sizeof(deathinfo), "%s(%d) has killed you.", killername, killerid);
TextDrawSetString(killedby, deathinfo);
TextDrawShowForPlayer(playerid, killedby); // No need of timers here as I've hidden the textdraw for player when he spawn.
return 1;
}
forward HideTextdraw(playerid);
public HideTextdraw(playerid)
{
TextDrawHideForPlayer(playerid, killed);
}
new timer_death[MAX_PLAYERS], timer_death2[MAX_PLAYERS];
public OnPlayerDeath(playerid, killerid, reason)
{
new str[60], str2[60], pName1[MAX_PLAYER_NAME], pName2[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName1, MAX_PLAYER_NAME);
GetPlayerName(killerid, pName2, MAX_PLAYER_NAME);
TextDrawShowForPlayer(playerid, killed);
format(str, sizeof(str), "You death by: %s", pName2(killerid));
TextDrawSetString(killed, str);
timer_death[playerid] = SetTimerEx("hidetd_player", 4000, false, "d", playerid);
TextDrawShowForPlayer(killerid, killedby);
format(str2, sizeof(str2), "You killed by: %s", pName(playerid);
TextDrawSetString(killedby, str);
timer_death2[killerid] = SetTimerEx("hidetd_killer", 4000, false, "d", killerid);
return 1;
}
forward hidetd_player(playerid);
public hidetd_player(playerid){
TextDrawHideForPlayer(playerid, killed);
KillTimer(timer_death[playerid]);
return 1;
}
forward hidetd_killer(killerid);
public hidetd_killer(killerid){
TextDrawHideForPlayer(killerid, killedby);
KillTimer(timer_death2[killerid]);
return 1;
}
example:
Код:
new timer_death[MAX_PLAYERS], timer_death2[MAX_PLAYERS]; PHP код:
|