Код:
public OnPlayerDeath(playerid, killerid, reason)
{
Alive[playerid] = 0;
CheckDelay[playerid] = 10;
PlayerTextDrawHide(playerid, Status[playerid]);
MyKiller[ playerid ] = killerid;
if(IsPlayerConnected(killerid)) {
if( InEvent[ playerid ] != 0 && InEvent[ killerid ] == InEvent[ playerid ] && EventOn == 1 ){
if( reason == 4 ){
EventLevel[ killerid ] ++;
EventStatus[ playerid ] = 0;
EventLevel[ playerid ] -= ( EventLevel[ playerid ] == 0 ) ? ( 0 ) : ( 1 );
ResetPlayerWeapons( killerid );
GivePlayerWeapon( killerid, 4, 1 );
GivePlayerWeapon( killerid, ( EventLevel[ killerid ] == 1 ) ? ( 22 ) : ( EventLevel[ killerid ] == 2 ) ? ( 25 ) : ( EventLevel[ killerid ] == 3 ) ? ( 27 ) : ( EventLevel[ killerid ] == 4 ) ? ( 28 ) : ( EventLevel[ killerid ] == 5 ) ? ( 30 ) : ( EventLevel[ killerid ] == 6 ) ? ( 31 ) : ( 24 ), 1500 );
SCM( killerid, -1, ""HP11"[Event]: "HP22"Ai avansat la un nou tip de arma %s.", GetGGWeaponName( EventLevel[ killerid ] ) );
}
new last_level = EventLevel[ killerid ];
EventStatus[ killerid ] ++;
EventScore[ killerid ] ++;
WinNewWeapon( killerid );
if( last_level == 7 && EventStatus[ killerid ] >= 2 ){
EndAutoEvent( killerid );
return 1;
}
if( last_level != EventLevel[ killerid ] ){
SCM( killerid, -1, ""HP11"[Event]: "HP22"Ai avansat la un nou tip de arma %s.", GetGGWeaponName( EventLevel[ killerid ] ) );
}
SCM( killerid, -1, "L-ai omorat pe %s.", GetName( playerid ) );
SCM( playerid, -1, "Ai fost omorat de %s.", GetName( killerid ) );
UpdateGGTD( playerid, 1 );
UpdateGGTD( killerid, 1 );
}
}
if( inLMS[ playerid ] )
{
SetPlayerWorldBounds( playerid, 20000.0000, -20000.0000, 20000.0000, -20000.0000 );
inLMS[ playerid ] = false;
new xCount, szString[ 144 ];
foreach(Player, p) if( inLMS[ p ] ) xCount++;
if( xCount == 1 )
{
foreach(Player, p)
{
if( inLMS[ p ] )
{
SpawnPlayer( p );
GivePlayerCash( p, LMS_Prize, "Premiu LMS" );
SetPlayerWorldBounds( p, 20000.0000, -20000.0000, 20000.0000, -20000.0000 );
inLMS[ p ] = false;
format( szString, sizeof( szString ), LMS_Message[ 6 ], GetName( p ), FormatMoney( LMS_Prize ) );
SendClientMessageToAll( -1, szString );
LmsOn = 0;
break;
}
}
}
}
if(PlayerPaintballing[playerid] != 0)
{
foreach(Player, x)
{
if((PlayerPaintballing[playerid] != 0 && PlayerPaintballing[killerid] != 0) && PlayerPaintballing[x])
{
SendDeathMessageToPlayer(x, killerid, playerid, reason);
}
}
new string[500];
new pinfo[128];
KillP[killerid]++;
DeathP[playerid]++;
format(string, sizeof(string), "You have killed %s. You now have %d kills.",GetName(playerid), KillP[killerid]);
SendClientMessage(killerid, COLOR_GENANNOUNCE, string);
format(string, sizeof(string), "You have been killed by %s.",GetName(killerid));
SendClientMessage(playerid, COLOR_GENANNOUNCE, string);
PlayerPaintballScore[killerid] = KillP[killerid];
if(PlayerPaintballScore[killerid] > PaintballWinnerScore)
{
PaintballWinner = killerid;
PaintballWinnerScore = PlayerPaintballScore[killerid];
foreach(Player,i)
{
if(IsPlayerConnected(i))
{
if(PlayerPaintballing[i] != 0)
{
format(pinfo,sizeof(pinfo),""HP11"[Paintball]: "HP22"%s is now in lead with %d kills.",GetName(PaintballWinner),PaintballWinnerScore);
SCM(i, COLOR_YELLOW, pinfo);
}
}
}
}
return 1;
}
if(PlayerData[playerid][pHeadValue] > 0)
{
if(IsPlayerConnected(killerid))
{
if(PlayerData[killerid][pGroup] == 5)
{
if(GoChase[killerid] == playerid)
{
new string[256];
new killer[MAX_PLAYER_NAME];
new name[MAX_PLAYER_NAME];
GetPlayerName(killerid, killer, sizeof(killer));
GetPlayerName(playerid, name, sizeof(name));
GivePlayerCash(killerid,PlayerData[playerid][pHeadValue],"OPD:Hitman kill");
format(string,128,"%s has succesfully completed the contract on %s for $%d, distance: %.0fm.",killer,name,PlayerData[playerid][pHeadValue], GetDistanceBetweenPlayers(killerid, playerid));
SendToGroup(5, COLOR_HIT, string);
PlayerData[playerid][pHeadValue] = -1;
GotHit[playerid] = 0;
GetChased[playerid] = 999;
GoChase[killerid] = 999;
savePlayerData(playerid);
}
}
}
}
if(killerid != INVALID_PLAYER_ID && IsPlayerConnected(killerid)) {
if(IsGangster(playerid) && IsGangster(killerid)) {
if(groupVariables[PlayerData[playerid][pGroup]][gInWar] && groupVariables[PlayerData[killerid][pGroup]][gInWar]) {
for(new i; i < TotalTurfs;i++) {
if(IsPlayerInTurf(playerid,i) && IsPlayerInTurf(killerid,i)) {
if((PlayerData[playerid][pGroup] == TurfData[i][turf_att] || PlayerData[killerid][pGroup] == TurfData[i][turf_def]) || (PlayerData[playerid][pGroup] == TurfData[i][turf_def] || PlayerData[killerid][pGroup] == TurfData[i][turf_att])) {
if(PlayerData[killerid][pGroup] == PlayerData[playerid][pGroup]) return 1;
if(PlayerData[playerid][pWarCombo] > 1) {
SCM(playerid,COLOR_BB,"[WAR]: "HP44"%s{FFFFFF} ended your killstreak of "HP44"x%d{FFFFFF}.",GetName(killerid),PlayerData[playerid][pWarCombo]);
SCM(killerid,COLOR_BB,"[WAR]:{FFFFFF} You ended "HP44"%s{FFFFFF}'s killstreak "HP44"x%d{FFFFFF}.",GetName(playerid),PlayerData[playerid][pWarCombo]);
}
PlayerData[playerid][pWarDeaths]++;
PlayerData[playerid][pWarCombo] = 0;
PlayerData[killerid][pWarScore]++;
PlayerData[killerid][pWarCombo]++;
groupVariables[PlayerData[killerid][pGroup]][gScore]++;
SCM(playerid,COLOR_BB,"[WAR]:{FFFFFF} You have been killed by "HP44"%s{FFFFFF}.",GetName(killerid));
SCM(killerid,COLOR_BB,"[WAR]:{FFFFFF} You killed "HP44"%s{FFFFFF}.",GetName(playerid));
new Float:h[MAX_PLAYERS]; GetPlayerHealth(killerid,h[killerid]);
switch(PlayerData[killerid][pWarCombo]) {
case 0..3: {
if(h[killerid] <= 95) SetPlayerHealth(killerid,h[killerid] + 5);
else if(h[killerid] > 95) SetPlayerHealth(killerid, 100);
SCM(killerid,COLOR_BB,"[WAR]:{FFFFFF} You received "HP44"5HP{FFFFFF} by having a killstreak of "HP44"%d",PlayerData[killerid][pWarCombo]);
}
case 4..8: {
if(h[killerid] <= 90) SetPlayerHealth(killerid,h[killerid] + 10);
else if(h[killerid] > 90) SetPlayerHealth(killerid, 100);
SCM(killerid,COLOR_BB,"[WAR]:{FFFFFF} You received "HP44"10HP{FFFFFF} by having a killstreak of "HP44"%d",PlayerData[killerid][pWarCombo]);
}
case 9..30: {
if(h[killerid] <= 80) SetPlayerHealth(killerid,h[killerid] + 20);
else if(h[killerid] > 80) SetPlayerHealth(killerid, 100);
SCM(killerid,COLOR_BB,"[WAR]:{FFFFFF} You received "HP44"20HP{FFFFFF} by having a killstreak of "HP44"%d",PlayerData[killerid][pWarCombo]);
}
}
foreach(Player, x)
{
if(PlayerData[x][pGroup] == TurfData[i][turf_att] || PlayerData[x][pGroup] == TurfData[i][turf_def] && groupVariables[ PlayerData[ x ][ pGroup ] ][ gInWar ] )
{
SendDeathMessageToPlayer(x, killerid, playerid, reason);
}
}
szLargeString[0] = 0;
format(szLargeString, sizeof(szLargeString), "INSERT INTO log_warkills (`war_warid`,`war_killerid`,`war_killerid_group`,`war_weaponid`,`war_userid`,`war_userid_group`,`war_time`,`war_killcount`) VALUES (%d,%d,%d,%d,%d,%d,%d,%d)", TurfData[i][turf_warid],PlayerData[killerid][pInternalID],PlayerData[killerid][pGroup],reason,PlayerData[playerid][pInternalID],PlayerData[playerid][pGroup],gettime(),PlayerData[killerid][pWarCombo]);
mysql_tquery(handle,szLargeString);
szQueryOutput[0] = 0;
format(szQueryOutput, sizeof(szQueryOutput), "UPDATE log_warplayers SET war_kills = %d WHERE war_warid = %d AND war_userid = %d",PlayerData[killerid][pWarScore], TurfData[i][turf_warid],PlayerData[killerid][pInternalID]);
mysql_tquery(handle,szQueryOutput);
//wKills
szQueryOutput[0] = 0;
format(szQueryOutput, sizeof(szQueryOutput), "UPDATE log_warplayers SET war_deaths = %d WHERE war_warid = %d AND war_userid = %d",PlayerData[playerid][pWarDeaths], TurfData[i][turf_warid],PlayerData[playerid][pInternalID]);
mysql_tquery(handle,szQueryOutput);
szQueryOutput[0] = 0;
format(szQueryOutput, sizeof(szQueryOutput), "UPDATE `playeraccounts` SET wKills = wKills + 1 WHERE `playerID` = %d", PlayerData[ killerid ][ pInternalID ] );
mysql_tquery(handle,szQueryOutput);
szQueryOutput[0] = 0;
format(szQueryOutput, sizeof(szQueryOutput), "UPDATE `playeraccounts` SET wDeaths = wDeaths + 1 WHERE `playerID` = %d", PlayerData[ playerid ][ pInternalID ] );
mysql_tquery(handle,szQueryOutput);
}
}
}
}
}
}
if(InEvent[ playerid ] != 0 && killerid == INVALID_PLAYER_ID && !IsPlayerConnected(killerid) && killerid != playerid) {}
if(killerid != INVALID_PLAYER_ID && !IsPlayerConnected(killerid) && killerid != playerid) {
WantedID[playerid] = killerid;
SCM(playerid, COLOR_GENANNOUNCE, ""HP11"[Server]: "HP22"Ai fost omorat de catre un alt jucator, ai 60 de secunde sa folosesti /call 112.");
WantedIDTime[playerid] = 60;
}
// SetTimerEx("Spawn", 3999, 0, "d", playerid);
SetPlayerHealth(playerid, 0);
savePlayerData(playerid);
savePlayerData(killerid);
killerid = INVALID_PLAYER_ID;
return 1;
}