07.02.2018, 08:57
PHP код:
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);
}