29.09.2015, 21:05
Quote:
Then..show the code under OnPlayerDeath...but actually it should work
|
Код:
public OnPlayerDeath(playerid, killerid, reason) { if(reason == 255) reason = 53; new iString[180]; new bool:TempPlaying; if(Player[playerid][Playing] == true) TempPlaying = true; else TempPlaying = false; if(killerid == INVALID_PLAYER_ID) { if(Current == -1) SendDeathMessage(INVALID_PLAYER_ID, playerid, reason); if(TempPlaying == true) { SendDeathMessage(INVALID_PLAYER_ID, playerid, reason); Player[playerid][RoundDeaths]++; Player[playerid][TotalDeaths]++; format(iString, sizeof(iString), "%s%s {FFFFFF}has died by: {FFFFFF}%s", TextColor[Player[playerid][Team]], Player[playerid][Name], WeaponNames[reason]); SendClientMessageToAll(-1, iString); OnPlayerAmmoUpdate(playerid); } } else if( killerid != INVALID_PLAYER_ID && IsPlayerConnected(killerid)) { format(iString, sizeof(iString), "~w~~h~~h~You Killed: %s~h~~h~%s", TDC[Player[playerid][Team]], Player[playerid][Name]); PlayerTextDrawSetString(killerid, DeathText[0][killerid], iString); PlayerTextDrawShow(killerid, DeathText[0][killerid]); format(iString, sizeof(iString), "~w~~h~~h~Killed by: %s~h~~h~%s", TDC[Player[killerid][Team]], Player[killerid][Name]); PlayerTextDrawSetString(playerid, DeathText[1][playerid], iString); PlayerTextDrawShow(playerid, DeathText[1][playerid]); SetTimerEx("DeathMessage", 4000, false, "ii", killerid, playerid); if(Current == -1) SendDeathMessage(killerid, playerid, reason); if(Player[killerid][InDM] == true) { SetPlayerHealth(killerid, 100); SetPlayerArmour(killerid, 100); Player[playerid][VWorld] = GetPlayerVirtualWorld(killerid); } if(TempPlaying == true) { SendDeathMessage(killerid, playerid, reason); Player[killerid][RoundKills]++; Player[killerid][TotalKills]++; Player[playerid][RoundDeaths]++; Player[playerid][TotalDeaths]++; format(iString, sizeof(iString), "~n~~n~~w~~h~~h~Kills ~r~~h~~h~%d~n~~w~~h~~h~Damage ~r~~h~~h~%.0f~n~~w~~h~~h~Total Dmg ~r~~h~~h~%.0f", Player[killerid][RoundKills], Player[killerid][RoundDamage], Player[killerid][TotalDamage]); PlayerTextDrawSetString(killerid, RoundKillDmgTDmg[killerid], iString); new Float:HP[2]; GetPlayerHealth(killerid, HP[0]); GetPlayerArmour(killerid, HP[1]); format(iString, sizeof(iString), "%s%s {FFFFFF}has killed %s%s {FFFFFF}with %s from %.1f ft - Health Remaining %.0f", TextColor[Player[killerid][Team]], Player[killerid][Name], TextColor[Player[playerid][Team]], Player[playerid][Name], WeaponNames[reason],GetDistanceBetweenPlayers(killerid, playerid), (HP[0] + HP[1])); SendClientMessageToAll(-1, iString); OnPlayerAmmoUpdate(playerid); } } Player[playerid][InDM] = false; Player[playerid][Playing] = false; if(Player[playerid][WeaponPicked] > 0){ TimesPicked[Player[playerid][Team]][Player[playerid][WeaponPicked]-1]--; Player[playerid][WeaponPicked] = 0; } if(Player[playerid][WasInCP] == true) { PlayersInCP--; Player[playerid][WasInCP] = false; if(PlayersInCP <= 0) { CurrentCPTime = ConfigCPTime; } } if(Player[playerid][BeingSpeced] == true) { foreach(new i : Player) { if(Player[i][Spectating] == true && Player[i][IsSpectatingID] == playerid) { if(Current != -1 && (Player[i][Team] == ATTACKER || Player[i][Team] == ATTACKER_SUB || Player[i][Team] == DEFENDER || Player[i][Team] == DEFENDER_SUB)) { SpectateNextTeamPlayer(i); } else { SpectateNextPlayer(i); } } } } if(TempPlaying == true) { new Float:Pos[3]; GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]); foreach(new i : Player) { if(Player[playerid][Team] == ATTACKER) { if(Player[i][Team] == ATTACKER && Player[i][Playing] == true) { SetPlayerMapIcon( i, Player[playerid][DeathIcon], Pos[0], Pos[1], Pos[2],23, 0, MAPICON_GLOBAL ); IconTimer[playerid] = SetTimerEx("PlayerDeathIcon", 5000, false, "i", playerid); } } else if(Player[playerid][Team] == DEFENDER) { if(Player[i][Team] == DEFENDER) { SetPlayerMapIcon( i, Player[playerid][DeathIcon], Pos[0], Pos[1], Pos[2],23, 0, MAPICON_GLOBAL ); IconTimer[playerid] = SetTimerEx("PlayerDeathIcon", 5000, false, "i", playerid); } } } } PlayerTextDrawHide(playerid, AreaCheckTD[playerid]); PlayerTextDrawHide(playerid, AreaCheckBG[playerid]); if(TempPlaying == true) { if(Player[playerid][Team] == ATTACKER) { foreach(new i : Player) { if(Player[i][Team] == ATTACKER && Player[i][Playing] == true) { ColorFix(playerid); SpectatePlayer(playerid, i); return 1; } } } else if(Player[playerid][Team] == DEFENDER) { foreach(new i : Player) { if(Player[i][Team] == DEFENDER && Player[i][Playing] == true) { ColorFix(playerid); SpectatePlayer(playerid, i); return 1; } } } } SetPlayerHealth(playerid, 100); SpawnPlayerEx(playerid); return 1; }