Author
|
Message
|
Junior Member
|
01-20-2023
, 10:01
CSGO hns plugin
|
#1
|
Currently making a hns server and created a plugin for team switching but im kinda stuck with it.
Plugin atm takes the first t to die and puts him to ct and takes the old ct to t so the hunter switches.
I need the plugin to check the amount of players and if there are more then 6 players on the server and if there is it takes to first 2 to die and puts them to ct so there are more hunters otherwise it continues with one hunter. Also if its possible it would be awesome if it could disable manual team switching. Thx alot to everyone who tries to help
code:
#include <cstrike>
#include <cstrike>
#include <sourcemod>
#include <sdktools>
public Plugin:myinfo =
{
name = "Team switch",
author = "Tanttinen",
description = "Team Switch for SourceMod.",
version = "1",
url = ""
};
new s_firstT;
new s_oldCT;
new bool:firstTdead = false;
public OnPluginStart()
{
HookEvent("player_death", OnPlayerDeath);
HookEvent("round_start", OnRoundStart, EventHookMode_Pre);
}
public Action:OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
new victim = GetClientOfUserId(GetEventInt(event, "userid"));
if (GetClientTeam(victim) == CS_TEAM_T && !firstTdead) {
firstTdead = true;
s_firstT = victim;
s_oldCT = GetClientOfUserId(GetEventInt(event, "attacker"));
}
return Plugin_Continue;
}
public OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{ if (s_firstT > 0 && s_oldCT > 0) {
ChangeClientTeam(s_firstT, CS_TEAM_CT);
ChangeClientTeam(s_oldCT, CS_TEAM_T);
}
firstTdead = false;
s_firstT = 0;
s_oldCT = 0;
}
public void OnMapEnd() {
firstTdead = false;
s_firstT = 0;
s_oldCT = 0;
}
|
|
|
|