pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(PlayerInfo[killerid][jail] || PlayerInfo[playerid][jail]) return 1;
if(gPlayerUsingLoopingAnim[playerid])
{
gPlayerUsingLoopingAnim[playerid] = 0;
TextDrawHideForPlayer(playerid,txtAnimHelper);
}
File::SaveAccount(playerid);
if(reason == 38 && GetAdminLevel(killerid) && !IsPlayerInAnyVehicle(killerid) && !PlayerTemp[killerid][isevent])
{
new Float:pP[4];
GetPlayerPos(playerid,pP[0], pP[1], pP[2]);
SetTimerEx("SetPlayerPosExEx", 2000, false, "dfffddd", playerid, pP[0], pP[1], pP[2], GetPlayerInterior(playerid), GetPlayerVirtualWorld(playerid), INVALID_VEHICLE_ID);
return 1;
}
if(killerid != INVALID_PLAYER_ID && killerid != 54 && killerid != 255)
{
if(PlayerTemp[playerid][onpaint])
{
PlayerLoop(i)
{
if(!PlayerTemp[i][onpaint]) continue;
SendClientMSG(i, COLOR_YELLOW, " [PB]: %s has killed %s with a %s (Distance: %dm)", RPName(killerid), RPName(playerid), aWeaponNames[reason], GetDistanceBetweenPlayers(playerid, killerid));
OnPlayerKillSpree(killerid);
}
return 1;
}
if(PlayerTemp[killerid][isevent])
{
PlayerLoop(i)
{
if(!PlayerTemp[i][isevent]) continue;
SendClientMSG(i, COLOR_YELLOW, "[EVENT]: %s has killed %s with a %s (Distance: %dm).", RPName(killerid), RPName(playerid), aWeaponNames[reason], GetDistanceBetweenPlayers(playerid, killerid));
OnPlayerKillSpree(killerid);
}
PlayerTemp[playerid][isevent] = 0;
return 1;
}
if(PlayerTemp[playerid][deaded]==0 && killerid != INVALID_PLAYER_ID){
new wname[ 40 ],string[200];
new Float:px, Float:py, Float:pz;
GetPlayerPos(playerid,px,py,pz);
GetWeaponName(reason, wname, sizeof(wname));
format( string, sizeof(string), "5[DEATH] %s[%d] has been killed by %s[%d] (%s).",PlayerName(playerid),playerid, PlayerName(killerid), killerid,wname);
iEcho( string );
PlayerTemp[playerid][deathINT]=GetPlayerInterior(playerid);
PlayerTemp[playerid][deathX]=px;
PlayerTemp[playerid][deathY]=py;
PlayerTemp[playerid][deathZ]=pz;
PlayerTemp[playerid][deathVW]=GetPlayerVirtualWorld(playerid);
PlayerTemp[playerid][deaded] = 1;
PlayerTemp[playerid][killedby]=killerid;
PlayerTemp[playerid][weaponome]=reason;
EzeeCubeH[playerid] = SetTimerEx("EzeeCubeHeal",500,0,"ii",playerid,1);
return 1;
}
PlayerTemp[playerid][weaponome]=-1;
PlayerTemp[playerid][killedby]=INVALID_PLAYER_ID;
if(killerid != INVALID_PLAYER_ID && PlayerInfo[killerid][playerteam] != EMS) SendDeathMessage(killerid,playerid,reason);
{
CheckWar();
new winpoints;
{
switch(PlayerInfo[playerid][ranklvl])
{
case 0: winpoints = 10;
case 1: winpoints = 5;
case 2: winpoints = 2;
default: winpoints = 1;
}
}
if(PlayerInfo[killerid][playerteam] == dini_Int(warfile,"faction1") && PlayerInfo[playerid][playerteam] == dini_Int(warfile,"faction2"))
{
dini_IntSet(warfile, "faction1points", dini_Int(warfile,"faction1points") + winpoints);
}
else if(PlayerInfo[killerid][playerteam] == dini_Int(warfile,"faction2") && PlayerInfo[playerid][playerteam] == dini_Int(warfile,"faction1"))
{
dini_IntSet(warfile, "faction2points", dini_Int(warfile,"faction2points") + winpoints);
}
}
//SetPlayerWantedLevel(playerid, 0);
TextDrawHideForPlayer(playerid, PlayerTemp[playerid][Status]);
TextDrawHideForPlayer(playerid, TextDraw__News);
TextDrawHideForPlayer(playerid, IMtxt);
new
string[ MAX_STRING ], wname[ 40 ], ragione[ 40 ];
GetWeaponName(reason, wname, sizeof(wname));
format( string, sizeof(string), "[DEATH] %s[%d] has been killed by %s[%d] (%s).",PlayerName(playerid),playerid, PlayerName(killerid), killerid,wname);
iEcho( string );
format( string, sizeof(string), "[KILL] %s has killed %s with a %s", PlayerName(killerid), PlayerName(playerid), wname);
AppendTo(deathlog, string);
GetWeaponName(reason,ragione,40);
if(PlayerInfo[killerid][playerteam] == CIV)SendClientMessageToAll(COLOR_RED, string);
if(IsPlayerDriver(killerid) && PlayerInfo[killerid][playerteam]!=SASF && PlayerInfo[killerid][playerteam]!=FBI && PlayerInfo[killerid][playerteam]!=COPS && PlayerInfo[killerid][power]==0)
{
PlayerTemp[killerid][imprisoned] = 1;
Jail(killerid,600,777,"Drive-by");
format(iStr,sizeof(iStr),"{FFFFFF}[ {FF0000}ADMIN{FFFFFF} ] {FF6347}* SERVER has jailed %s for 10 minutes. Reason: Drive-by *",RPName(killerid));
SendMessageToAll(COLOR_RED,iStr);
}
if(killerid != INVALID_PLAYER_ID && IsPlayerInPaintball(killerid))
{
if(PlayerTemp[playerid][pbteam] == 1) PBTeams[PlayerTemp[playerid][onpaint]][redscore]++;
else PBTeams[PlayerTemp[playerid][onpaint]][bluescore]++;
UpdatePBScore(PlayerTemp[playerid][onpaint], PBTeams[PlayerTemp[playerid][onpaint]][redscore], PBTeams[PlayerTemp[playerid][onpaint]][bluescore]);
return 1;
}
if(killerid != INVALID_PLAYER_ID) PlayerInfo[killerid][kills]++;
PlayerInfo[playerid][deaths]++;
if(!strlen(ragione)) ragione="Fists";
new deathmsg[MAX_STRING]; format(deathmsg,sizeof(deathmsg),"Info: You have paid $%d for the medical bills, have a nice day!",dini_Int(globalstats, "medicals"));
SendClientMessage(playerid,COLOR_ORANGE,deathmsg);
if(killerid != INVALID_PLAYER_ID && PlayerInfo[killerid][playerteam]==EMS && PlayerInfo[playerid][head]>0)
{
if(strcmp(ragione,"Knife",true)==0)
{
new total;
total=PlayerInfo[playerid][head]+((PlayerInfo[playerid][head]*15)/100);
dini_IntSet(globalstats,"EMSBank",dini_Int(globalstats,"EMSBank")+total/2);
GivePlayerMoneyEx(killerid, total/2);
format(string,sizeof(string),"[HEAD] You earned $%d from %s head, plus 15-percent of his head because of knifekill.",PlayerInfo[playerid][head]/2,PlayerName(playerid));
SendClientMessage(killerid,COLOR_YELLOW, string);
PlayerInfo[playerid][head]=0;
}
else
{
GivePlayerMoneyEx(killerid, PlayerInfo[playerid][head]/2);
dini_IntSet(globalstats,"EMSBank",dini_Int(globalstats,"EMSBank")+PlayerInfo[playerid][head]/2);
format(string,sizeof(string),"[HEAD] You earned $%d from %s head.",PlayerInfo[playerid][head]/2,PlayerName(playerid));
SendClientMessage(killerid,COLOR_YELLOW, string);
PlayerInfo[playerid][head]=0;
}
}
}
else
{
if(PlayerInfo[playerid][power])
{
PlayerLoop(i)
{
SendDeathMessage(killerid, playerid, reason);
}
return 1;
}
new string[ 128 ];
format(string,sizeof(string), "Suicide: %s has suicided", RPName(playerid));
if(GetPVarInt(playerid, "SkinSelect") == 0) SendClientMessageToAll(COLOR_RED, string);
format( string, sizeof(string), "[DEATH] %s[%d] has suicided.",PlayerName(playerid),playerid);
iEcho( string );
format( string, sizeof(string), "[KILL] %s has killed himself", PlayerName(playerid));
AppendTo(deathlog, string);
}
return 1;
}