PHP Code:
#include <sourcemod>
#include <sdktools>
new String:storeNextMap[100];
new String:storeMapReason[100];
new storeMapWinner;
public Plugin:myinfo =
{
name = "Kill Limit",
author = "Alex",
description ="If a client reaches 100 kills, the map is moved on to the next one.",
version = "0.4",
url = ""
}
public OnPluginStart()
{
HookEvent("player_death", APlayerHasDied);
}
public APlayerHasDied(Handle:event, const String:name[], bool:dontBroadcast){
new attackerId = GetEventInt(event, "attacker");
new attackerClient = GetClientOfUserId(attackerId);
if(attackerClient && IsClientInGame(attackerClient))
{
if(GetClientFrags(attackerClient) >= 99){
storeMapWinner = attackerId;
GetNextMap(storeNextMap, sizeof(storeNextMap));
PrintToChatAll("%N is the winner with 100 kills.", attackerClient);
CreateTimer(10.0, DelayedMapChange, _, TIMER_FLAG_NO_MAPCHANGE);
}
}
}
public Action:DelayedMapChange(Handle:timer)
{
new attackerClient = GetClientOfUserId(storeMapWinner);
if(attackerClient && IsClientInGame(attackerClient))
Format(storeMapReason, sizeof(storeMapReason), "%N has reached 100 kills. Moving on to the next map.", attackerClient);
else
Format(storeMapReason, sizeof(storeMapReason), "A player has reached 100 kills. Moving on to the next map.");
ForceChangeLevel(storeNextMap, storeMapReason);
}