Raised This Month: $12 Target: $400
 3% 

CSGO hns plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Tanttinen
Junior Member
Join Date: Jan 2023
Old 01-19-2023 , 15:55   CSGO hns plugin
Reply With Quote #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;
}
Tanttinen is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:41.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode