Skip to content

Commit

Permalink
管理员限制位置个数不受模式人数最低限制
Browse files Browse the repository at this point in the history
  • Loading branch information
fantasylidong committed Mar 4, 2024
1 parent 820fa94 commit ce3b058
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 31 deletions.
Binary file modified addons/sourcemod/plugins/optional/slots_vote.smx
Binary file not shown.
59 changes: 28 additions & 31 deletions addons/sourcemod/scripting/slots_vote.sp
Original file line number Diff line number Diff line change
Expand Up @@ -39,45 +39,42 @@ public Action SlotsRequest(int client, int args)
char sSlots[64];
GetCmdArg(1, sSlots, sizeof(sSlots));
int Int = StringToInt(sSlots);
if (Int > MaxSlots && !((GetUserFlagBits(client) & ADMFLAG_GENERIC ) || client == 0))
if(CheckCommandAccess(client, "", ADMFLAG_GENERIC) || client == 0)
{
CPrintToChat(client, "%t %t", "Tag", "LimitSlotsAbove", MaxSlots);
}
else
{
if(Int > numSlots())
{
if(L4D_LobbyIsReserved())
L4D_LobbyUnreserve();
SetConVarInt(FindConVar("sv_allow_lobby_connect_only"), 0);
}
char sName[MAX_NAME_LENGTH];
if(client == 0)
{
//CPrintToChatAll("{blue}[{default}Slots{blue}] {olive}管理员 {default}将服务器位置设为 {blue}%i {default}个", Int);
char sName[MAX_NAME_LENGTH];
sName="远程管理员";
else
GetClientName(client, sName, sizeof(sName));
CPrintToChatAll("%t %t", "Tag", "LimitedSlotsTo", sName, Int);
SetConVarInt(FindConVar("sv_maxplayers"), Int);
SetConVarInt(FindConVar("sv_visiblemaxplayers"), Int);
}
if (GetUserFlagBits(client) & ADMFLAG_GENERIC)
{
char sName[MAX_NAME_LENGTH];
GetClientName(client, sName, sizeof(sName));
CPrintToChatAll("%t %t", "Tag", "LimitedSlotsTo", sName, Int);
SetConVarInt(FindConVar("sv_maxplayers"), Int);
SetConVarInt(FindConVar("sv_visiblemaxplayers"), Int);
}
else if (Int < GetConVarInt(FindConVar("survivor_limit")))
CPrintToChatAll("%t %t", "Tag", "LimitedSlotsTo", sName, Int);
SetConVarInt(FindConVar("sv_maxplayers"), Int);
SetConVarInt(FindConVar("sv_visiblemaxplayers"), Int);
}
else{
if (Int > MaxSlots)
{
CPrintToChat(client, "%t %t", "Tag", "RequiredPlayers");
CPrintToChat(client, "%t %t", "Tag", "LimitSlotsAbove", MaxSlots);
}
else if (StartSlotVote(client, sSlots))
else
{
strcopy(g_sSlots, sizeof(g_sSlots), sSlots);
FakeClientCommand(client, "Vote Yes");
if(Int > numSlots())
{
if(L4D_LobbyIsReserved())
L4D_LobbyUnreserve();
SetConVarInt(FindConVar("sv_allow_lobby_connect_only"), 0);
}
if (Int < GetConVarInt(FindConVar("survivor_limit")))
{
CPrintToChat(client, "%t %t", "Tag", "RequiredPlayers");
}
else if (StartSlotVote(client, sSlots))
{
strcopy(g_sSlots, sizeof(g_sSlots), sSlots);
FakeClientCommand(client, "Vote Yes");
}
}
}

}
else
{
Expand Down

0 comments on commit ce3b058

Please sign in to comment.