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

REPAir plugin 1CT


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
vegeta1241
AlliedModders Donor
Join Date: Apr 2017
Location: Switzerland
Old 09-28-2018 , 17:11   REPAir plugin 1CT
Reply With Quote #1

Hello who can repair my script please..

I need a plugin which swap ALL PLAYER to T (CT AND T) at the round end , and choose one random Terrorist to go in team CT.

THANK YOU

Quote:
#include <sourcemod>
#include <cstrike>
#include <sdktools>

new getrandom;

public void OnPluginStart()
{
HookEvent("round_end", round_end);
}

public Action round_end(Handle event, const char[] name, bool dontbroadcast)
{
ServerCommand("mp_autoteambalance 0");
getrandom= GetRandomPlayer();
for (int i = 1; i <= MaxClients; i++)
{
if (IsClientInGame(i) && !IsFakeClient(i))
{
CreateTimer(0.1, delaycheck, i);
ChangeClientTeam(i, CS_TEAM_T);
}
}

}

public Action delaycheck(Handle timer, int client)
{
swapct(client);
}

public void swapct(int client)
{
if(client == getrandom && IsClientInGame(client))
{
ChangeClientTeam(client, CS_TEAM_CT);
}
}

GetRandomPlayer()
{
new clients[MaxClients+1], clientCount;
for (new i = 1; i <= MaxClients; i++)
if (IsClientInGame(i) && GetClientTeam(CS_TEAM_T))
clients[clientCount++] = i;
return (clientCount == 0) ? -1 : clients[GetRandomInt(0, clientCount-1)];
}
vegeta1241 is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 09-28-2018 , 17:35   Re: REPAir plugin 1CT
Reply With Quote #2

Post your code in a CODE block not a QUOTE block.
__________________
Neuro Toxin is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 09-28-2018 , 19:53   Re: REPAir plugin 1CT
Reply With Quote #3

On top of the code block, should the terrorist be considered after he was transfered from ct to t or before?
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
vegeta1241
AlliedModders Donor
Join Date: Apr 2017
Location: Switzerland
Old 09-28-2018 , 20:59   Re: REPAir plugin 1CT
Reply With Quote #4

Before i think, all players swap in terro and after one random player is choosen to go ct for the next round.

The round start with one player on ct. (Hidenseek) i Mase a plugin When ct kill a terro, the terro is swapped on ct.

But when all terro Die, all players are in ct.

And the next round start with 10 players for exAmple on ct and 0 players on t.

And i want when round is end, all players swap in t and one t is choosen to go ct.

Sorry for m’y bad engluée
vegeta1241 is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 10-01-2018 , 06:37   Re: REPAir plugin 1CT
Reply With Quote #5

use round_prestart event to switch players (with cs_switchteam)
round_prestart event is not called on competitive mode, you must use the casual mode.
Ilusion9 is offline
Reply



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 09:21.


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