diff --git a/PlayerRankings/scripting/PlayerRankings.sp b/PlayerRankings/scripting/PlayerRankings.sp index 9ca6afb1..992ed0b6 100644 --- a/PlayerRankings/scripting/PlayerRankings.sp +++ b/PlayerRankings/scripting/PlayerRankings.sp @@ -44,7 +44,7 @@ public Plugin myinfo = name = "Player Rankings", author = "Neon & zaCade", description = "Show Top Defenders & Infections after each round", - version = "1.1.0" + version = "1.1.1" }; //---------------------------------------------------------------------------------------------------- @@ -586,16 +586,24 @@ public void OnClientSpawn(Event hEvent, const char[] sEvent, bool bDontBroadcast { int client = GetClientOfUserId(hEvent.GetInt("userid")); + int steamAccountID = GetSteamAccountID(client); + if (!g_bHideCrown[client]) { - int steamAccountID = GetSteamAccountID(client); - if (g_iPlayerWinner[0] == steamAccountID) CreateTimer(7.0, OnClientSpawnPostCrown, GetClientSerial(client), TIMER_FLAG_NO_MAPCHANGE); - else if (g_iPlayerWinner[3] == steamAccountID) CreateTimer(7.0, OnClientSpawnPostSkull, GetClientSerial(client), TIMER_FLAG_NO_MAPCHANGE); } + + for (int i = 0; i < sizeof(g_iPlayerWinner); i++) + { + if (g_iPlayerWinner[i] == steamAccountID) + { + CreateTimer(2.0, OnClientSpawnPostGrenade, GetClientSerial(client), TIMER_FLAG_NO_MAPCHANGE); + break; + } + } } //---------------------------------------------------------------------------------------------------- @@ -628,6 +636,29 @@ public Action OnClientSpawnPostSkull(Handle timer, int serial) SpawnSkull(client); } +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public Action OnClientSpawnPostGrenade(Handle timer, int serial) +{ + int client; + if((client = GetClientFromSerial(serial)) == 0) + return; + + if (!IsClientInGame(client) || !IsPlayerAlive(client)) + return; + + if (!ZR_IsClientHuman(client)) + return; + + int iGrenade = GivePlayerItem(client, "weapon_hegrenade"); + int PrimaryAmmoType = GetEntProp(iGrenade, Prop_Data, "m_iPrimaryAmmoType"); + SetEntProp(client, Prop_Send, "m_iAmmo", 2, _, PrimaryAmmoType); + EquipPlayerWeapon(client, iGrenade); + SetEntProp(client, Prop_Send, "m_iAmmo", 2, _, PrimaryAmmoType); + CPrintToChat(client, "{cyan}%t {white}%t", "Chat Prefix", "Grenade"); +} + //---------------------------------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------------------------------