Code:
#include <sourcemod>
#include <sdktools>
#include <cstrike>
#include <rankme>
public void OnPluginStart()
{
if (GetEngineVersion() != Engine_CSGO)
SetFailState("This plugin is only for CS:GO !");
HookEvent("player_spawn", OnPlayerSpawn);
}
public void OnPlayerSpawn(Handle event, const char[] name, bool dontBroadcast)
{
int userID = GetEventInt(event, "userid");
int client = GetClientOfUserId(userID);
if(!IsValidClient(client))
return;
RankMe_GetRank(client, RankME_GetRank, userID);
}
public int RankME_GetRank(int client, int rank, any data)
{
if(rank > 3)
CreateTimer(0.5, TMR_GiveVest, data);
}
public Action TMR_GiveVest(Handle tmr, any userID)
{
int client = GetClientOfUserId(userID);
if(IsValidClient(client))
{
GivePlayerItem(client, "item_kevlar");
}
}
stock bool IsValidClient(iClient, bool bReplay = true)
{
if (iClient <= 0 || iClient > MaxClients)
return false;
if (!IsClientInGame(iClient))
return false;
if (bReplay && (IsClientSourceTV(iClient) || IsClientReplay(iClient)))
return false;
return true;
}
Trying to figure out a way to reward the top 3 players in scoreboard, for both teams in csgo with free armor on spawn