02.10.2015, 11:23
Код:
public OnPlayerDeath(playerid, killerid, reason) { if(god[playerid] == 0) SaveWeaponsToFile(playerid); SendDeathMessage(killerid,playerid,reason); killstreak[playerid] = 0; if(killerid != INVALID_PLAYER_ID) { killstreak[killerid]++; GivePlayerMoney(killerid, 400*((killstreak[killerid]+1)/2)); // give money $1000 new distance = GetDistanceBetweenPlayers(playerid, killerid); new randomcolor = random(sizeof(PlayerColors)), money[64], amount=0, killstreakamount[64]; amount = 400*((killstreak[killerid]+1)/2); format(money,sizeof(money),"%d",amount); format(killstreakamount,sizeof(killstreakamount), "%d", killstreak[killerid]); format(string2,sizeof(string2),"[KILL] You killed %s, distance: %dm, killstreak: %d",gName2(playerid), distance, killstreak[killerid]); SendClientMessage(killerid, PlayerColors[randomcolor], string2); TextDrawSetString(killstreakcount[killerid], killstreakamount); TextDrawSetString(killstreakmoneycount[killerid], money); TextDrawShowForPlayer(killerid, killstreakcount[killerid]); TextDrawShowForPlayer(killerid, killstreakmoneycount[killerid]); TextDrawShowForPlayer(killerid, killstreaktd[killerid]); TextDrawShowForPlayer(killerid, killstreakdollar[killerid]); SetTimerEx("Hidekillstreak", 2000, false, "i", killerid); } if(pInfo[playerid][pLogged] == 1 && playerid != INVALID_PLAYER_ID) SaveStats(playerid); if(PlayerAtEvent[playerid] != 0) { new distance = GetDistanceBetweenPlayers(playerid, killerid); SetTimer("EndEventCheck", 5000, false); //SetTimer("EndEventCheck", 3000, 0); if(CageFightOn == 1) NumCageFighters--; else if (CurrentPosOn == 1) NumCurrentFighters--; PlayerAtEvent[playerid] = 0; //DM[playerid]=0; new gunname[32]; GetWeaponName(reason,gunname,sizeof(gunname)); format(string2,sizeof(string2),"[EVENT] Player %s has been eliminated by %s (%s), distance: %dm.",gName2(playerid), gName2(killerid) , gunname, distance); SendEventMessage(COLOR2_YELLOW, string2); } if(killerid != INVALID_PLAYER_ID) { pInfo[killerid][pKills]++; SetPlayerScore(killerid, GetPlayerScore(killerid) + 10); } pInfo[playerid][pDeaths]++; GivePlayerMoney(playerid, -100); if(InDual[playerid] == 1) { new string[256]; new killername[MAX_PLAYER_NAME]; new playername[MAX_PLAYER_NAME]; GetPlayerName(killerid, killername, sizeof(killername)); GetPlayerName(playerid, playername, sizeof(playername)); if(DualRoom1 == playerid || DualRoom1 == killerid) { Inventation[playerid] = -1; InventationSent[playerid] = -1; Inventation[killerid] = -1; InventationSent[killerid] = -1; InDual[playerid] = 0; InDual[killerid] = 0; format(string, sizeof(string), "%s defeated %s in a duel and wins $%d", killername, playername, DualRoom1price); SendClientMessageToAll(GREEN, string); GivePlayerMoney(killerid, (DualRoom1price*2)); SpawnPlayer(killerid); SendDeathMessage(killerid, playerid, reason); DualRoom1 = -1; return 1; } if(DualRoom2 == playerid || DualRoom2 == killerid) { Inventation[playerid] = -1; InventationSent[playerid] = -1; Inventation[killerid] = -1; InventationSent[killerid] = -1; InDual[playerid] = 0; InDual[killerid] = 0; format(string, sizeof(string), "%s defeated %s in a duel and wins $%d", killername, playername, DualRoom2price); SendClientMessageToAll(GREEN, string); GivePlayerMoney(killerid, (DualRoom2price*2)); SpawnPlayer(killerid); SendDeathMessage(killerid, playerid, reason); DualRoom2 = -1; return 1; } if(DualRoom3 == playerid || DualRoom3 == killerid) { Inventation[playerid] = -1; InventationSent[playerid] = -1; Inventation[killerid] = -1; InventationSent[killerid] = -1; InDual[playerid] = 0; InDual[killerid] = 0; format(string, sizeof(string), "%s defeated %s in a duel and wins $%d", killername, playername, DualRoom3price); SendClientMessageToAll(GREEN, string); GivePlayerMoney(killerid, (DualRoom3price*2)); SpawnPlayer(killerid); SendDeathMessage(killerid, playerid, reason); DualRoom3 = -1; return 1; } if(DualRoom4 == playerid || DualRoom4 == killerid) { Inventation[playerid] = -1; InventationSent[playerid] = -1; Inventation[killerid] = -1; InventationSent[killerid] = -1; InDual[playerid] = 0; InDual[killerid] = 0; format(string, sizeof(string), "%s defeated %s in a duel and wins $%d", killername, playername, DualRoom4price); SendClientMessageToAll(GREEN, string); GivePlayerMoney(killerid, (DualRoom4price*2)); SpawnPlayer(killerid); SendDeathMessage(killerid, playerid, reason); DualRoom4 = -1; return 1; } return 1; } return 1; }