Commit 91e1e50c authored by Mikleo's avatar Mikleo
Browse files

Add cvar to disable autopick spam for autodraft modes. For some reason players...

Add cvar to disable autopick spam for autodraft modes. For some reason players in east asia seem to crash during team selection. Maybe something to do with the text spam and text display.
parent 1fc724b3
Pipeline #6139 passed with stages
in 16 seconds
......@@ -8,7 +8,7 @@
#include <empstats>
#include <updater>
#define PluginVersion "0.90"
#define PluginVersion "0.91"
#define UPDATE_URL "https://sourcemod.docs.empiresmod.com/DraftPick/dist/updater.txt"
......@@ -51,7 +51,7 @@ int stage = STAGE_DISABLED;
#define TEAM_BE 1;
ConVar mp_autoteambalance,mp_autoteambalance_skilldifference,cv_autoassign,cv_allowspectators,dp_default_draftmode, dp_default_draftmode_min_players,dp_captain_vote_time,dp_pick_wait_time,dp_pick_initial_multiplier,dp_time_increment,dp_in_draft,dp_maxpick,dp_squadlimitdefault,dp_autopick_randomizer,dp_forceauto_max_imbalance;
ConVar mp_autoteambalance,mp_autoteambalance_skilldifference,cv_autoassign,cv_allowspectators,dp_default_draftmode, dp_default_draftmode_min_players,dp_captain_vote_time,dp_pick_wait_time,dp_pick_initial_multiplier,dp_time_increment,dp_in_draft,dp_maxpick,dp_squadlimitdefault,dp_autopick_randomizer,dp_autodraft_display_pick,dp_forceauto_max_imbalance;
int mp_autoteambalance_default = 1;
int cv_autoassign_default = 0;
......@@ -248,6 +248,8 @@ public void OnPluginStart()
dp_in_draft = CreateConVar("dp_in_draft", "0", "Notification of drafting. ignore");
dp_maxpick = CreateConVar("dp_maxpick", "40", "maximum number of picks before autopick");
dp_autodraft_display_pick = CreateConVar("dp_autodraft_display_pick", "0", "Should autodraft pick be displayed in chat");
dp_music = CreateConVar("dp_music", "1", "If music is enabled");
dp_music_volume = CreateConVar("dp_music_volume", "0.5", "The volume music plays at");
dp_music.AddChangeHook(dp_music_changed);
......@@ -611,12 +613,12 @@ int numClientsNotInDraftTeam()
public Action Command_Join_Team(int client, const String:command[], args)
{
GetCmdArg(1, arg1, sizeof(arg1));
int team = StringToInt(arg1);
int oldTeam = GetClientTeam(client);
if(team == oldTeam)
int newTeam = StringToInt(arg1);
int currentTeam = GetClientTeam(client);
if(newTeam == currentTeam)
return Plugin_Continue;
if(team == 4 && oldTeam < 2)
if(newTeam == 4 && currentTeam < 2)
{
usedAutoAssign[client] = true;
}
......@@ -628,7 +630,7 @@ public Action Command_Join_Team(int client, const String:command[], args)
if(!draftEnabled)
{
return CheckTeamBalance(client,oldTeam,team);
return CheckTeamBalance(client,currentTeam,newTeam);
}
......@@ -649,7 +651,7 @@ public Action Command_Join_Team(int client, const String:command[], args)
}
// prevent players joining after the draft has begun, if they are not already in nf.
if(draftBegun && gameTeam == -1 && team >=2 && oldTeam != 2)
if(draftBegun && gameTeam == -1 && newTeam >=2 && currentTeam != 2)
{
if(stage != STAGE_GAME)
{
......@@ -685,7 +687,7 @@ public Action Command_Join_Team(int client, const String:command[], args)
}
}
if(stage == STAGE_GAME && gameTeam != -1 && team >= 2 )
if(stage == STAGE_GAME && gameTeam != -1 && newTeam >= 2 )
{
if(joinTime[client] == 0)
{
......@@ -697,20 +699,26 @@ public Action Command_Join_Team(int client, const String:command[], args)
numPlayers[0] = GetTeamClientCount(2);
numPlayers[1] = GetTeamClientCount(3);
int t = team - 2;
if(team != 4 && numPlayers[t] > numPlayers[OppTeam(t)] && cv_autoassign.IntValue == 0)
if(currentTeam == 2)
numPlayers[0] --;
else if(currentTeam == 3)
numPlayers[1] --;
int t = newTeam - 2;
if(newTeam != 4 && numPlayers[t] > numPlayers[OppTeam(t)] && cv_autoassign.IntValue == 0)
{
PrintToChat(client,"\x04[DP] \x01Can't join team,numbers not balanced. ",teamcolors[gameTeam],teamnames[gameTeam]);
return Plugin_Handled;
}
if(EU_HasGameStarted() && oldTeam == 1) //only apply to spectators when the game has started
if(EU_HasGameStarted() && currentTeam == 1) //only apply to spectators when the game has started
{
StartJoin(client,10);
PrintToChat(client,"\x04[DP] \x01Anti Ghost: You will rejoin %s%s\x01 in %d seconds. Please Wait.",teamcolors[gameTeam],teamnames[gameTeam],joinTime[client] );
return Plugin_Handled;
}
else if(team == 4)
else if(newTeam == 4)
{
PrintToChat(client,"\x04[DP] \x01Rejoining %s%s ",teamcolors[gameTeam],teamnames[gameTeam]);
ForceTeam(client,gameTeam + 2);
......@@ -723,7 +731,7 @@ public Action Command_Join_Team(int client, const String:command[], args)
}
ForceTeam(client,team);
ForceTeam(client, newTeam);
return Plugin_Handled;
}
......@@ -731,9 +739,9 @@ public Action Command_Join_Team(int client, const String:command[], args)
if(stage == STAGE_CAPTAINVOTE || stage == STAGE_PICKWAIT || stage == STAGE_PICK || stage == STAGE_AUTOPICKWAIT)
{
// brenodi or autoassign.
if(team >= 3)
if(newTeam >= 3)
{
if(oldTeam == 2)
if(currentTeam == 2)
{
PrintToChat(client,"\x04[DP] \x01Draft Mode: You must stay in %sNF\x01 during the drafting proccess." ,teamcolors[0]);
}
......@@ -1556,7 +1564,7 @@ void Pick(int client,int target)
cName = "AutoPick";
}
bool displayText = draftMode == MODE_DRAFT || draftMode == MODE_SQUADDRAFT || dp_autodraft_display_pick.IntValue == 1;
char targetName[64];
GetClientName(target,targetName,sizeof(targetName));
......@@ -1579,13 +1587,14 @@ void Pick(int client,int target)
Format(names,sizeof(names),"%s %s",names,targetName);
}
}
PrintToChatAll("\x04[DP] %s%s\x01 picked \x04%s\x01: \x07ff6600%s",teamcolors[teamToPick],cName,squadnames[squad], names);
if(displayText)
PrintToChatAll("\x04[DP] %s%s\x01 picked \x04%s\x01: \x07ff6600%s",teamcolors[teamToPick],cName,squadnames[squad], names);
}
else
{
OnClientDrafted(target);
PrintToChatAll("\x04[DP] %s%s\x01 picked \x07ff6600%s",teamcolors[teamToPick],cName,targetName);
if(displayText)
PrintToChatAll("\x04[DP] %s%s\x01 picked \x07ff6600%s",teamcolors[teamToPick],cName,targetName);
}
......
......@@ -4,7 +4,7 @@
{
"Version"
{
"Latest" "0.90"
"Latest" "0.91"
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment