View Single Post
Author Message
Kupio
New Member
Join Date: Jun 2020
Old 06-08-2020 , 01:16   CaptainSteamAuthSystem
Reply With Quote #1

Hi, everybody

I wanna create CaptainSystem on my csgo server for knife rounds. So on the internet I found the following code:
Code:
public int RandomCaptainCT()
{
	int PlayersCT[MAXPLAYERS + 1];
	int PlayersCountCT;
	
	for (int i = 1; i <= MaxClients; i++)
	{
		if (IsClientValid(i))
		{
			if (GetClientTeam(i) == CS_TEAM_CT)
			{
				PlayersCT[PlayersCountCT++] = i;
			}
		}
	}
	return PlayersCT[GetRandomInt(0, PlayersCountCT - 1)];
}

public int RandomCaptainT()
{
	int PlayersT[MAXPLAYERS + 1];
	int PlayersCountT;
	
	for (int i = 1; i <= MaxClients; i++)
	{
		if (IsClientValid(i))
		{
			if (GetClientTeam(i) == CS_TEAM_T)
			{
				PlayersT[PlayersCountT++] = i;
			}
		}
	}
	return PlayersT[GetRandomInt(0, PlayersCountT - 1)];
}

public Action GetCaptainCT(client, args)
{
	CaptainCT = RandomCaptainCT();
	GetClientName(CaptainCT, CaptainName_CT, 32);
	GetClientAuthId(CaptainCT, AuthId_Steam2, CaptainID_CT, 32, false);
	PrintToChatAll("[\x07SMP\x01] \x06CT's Captain: \x04%s", CaptainName_CT);
}

public Action GetCaptainT(client, args)
{
	CaptainT = RandomCaptainT();
	GetClientName(CaptainT, CaptainName_T, 32);
	GetClientAuthId(CaptainT, AuthId_Steam2, CaptainID_T, 32, false);
	CaptainsSelected = true;
	PrintToChatAll("[\x07SMP\x01] \x06T's Captain: \x04%s", CaptainName_T);
}
It is choosing random captain. It's cool but i have created my server for team vs team praccs.
I need CVars for choose 2 captains of both teams.
I've not seen anything on this thread on the internet.
How can I get it?

Last edited by Kupio; 06-08-2020 at 01:28.
Kupio is offline