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

Player List Panel Modification / Help Requests/ can Authors help?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Darkwob
BANNED
Join Date: Oct 2018
Old 09-26-2020 , 13:34   Player List Panel Modification / Help Requests/ can Authors help?
Reply With Quote #1

I tried to show this panel in two page, but I couldn't. can anyone help me with that ?

on the first page , there will be survivors at the top and spectators at the bottom, and on the other page, there will be an infected team, and at the bottom it will show the total number of people connected.
when we want to go to the other page, it will say:;

1-next page /When we press 1, it will move to the infected page.

0-first page

By the way, is it possible to open the player list by typing "! list" in the chat panel or pressing the tab key?


PHP Code:
#include <sourcemod>
#include <sdktools>

//Define CVARS
#define MAX_SURVIVORS GetConVarInt(FindConVar("survivor_limit"))
#define MAX_INFECTED GetConVarInt(FindConVar("z_max_player_zombies"))
#define PLUGIN_VERSION "1.6.1"

// Sdk calls
new Handle:gConf INVALID_HANDLE;
new 
Handle:fSHS INVALID_HANDLE;
new 
Handle:fTOB INVALID_HANDLE;

//Handles
new Handle:cc_plpOnConnect INVALID_HANDLE;
new 
Handle:cc_plpTimer INVALID_HANDLE;
new 
Handle:cc_plpAutoRefreshPanel INVALID_HANDLE;
new 
Handle:cc_plpPaSTimer INVALID_HANDLE;
new 
Handle:cc_plpPaShowscores INVALID_HANDLE;
new 
Handle:cc_plpAnnounce INVALID_HANDLE;
new 
Handle:cc_plpSelectTeam INVALID_HANDLE;
new 
Handle:cc_plpHintStatic INVALID_HANDLE;
new 
Handle:cc_plpSpectatorSelect INVALID_HANDLE;
new 
Handle:cc_plpSurvivorSelect INVALID_HANDLE;
new 
Handle:cc_plpInfectedSelect INVALID_HANDLE;
new 
Handle:cc_plpShowBots INVALID_HANDLE;

//Strings
new String:hintText[2048];

//CVARS
new plpOnConnect;
new 
plpTimer;
new 
plpPaSTimer;
new 
plpAutoRefreshPanel;
new 
plpPaShowscores;
new 
plpAnnounce;
new 
plpSelectTeam;
new 
plpHintStatic;
new 
plpSpectatorSelect;
new 
plpSurvivorSelect;
new 
plpInfectedSelect;
new 
plpShowBots;
new 
ClientAutoRefreshPanel[33];
new 
wantedrefresh[33];
new 
hintstatic[33];
new 
maxcl;

//Plugin Info Block
public Plugin:myinfo =
{
    
name "Playerlist Panel",
    
author "OtterNas3",
    
description "Shows Panel for Teams on Server",
    
version PLUGIN_VERSION,
    
url "http://www.sourcemod.net/"
};

//Plugin start
public OnPluginStart()
{
    
//Load Translation file
    
LoadTranslations("l4d_teamspanel.phrases");
    
    
//SDK Calls (copied, credits to L4DSwitchPlayers)
    
gConf LoadGameConfigFile("l4dteamspanel");
    
    
StartPrepSDKCall(SDKCall_Player);
    
PrepSDKCall_SetFromConf(gConfSDKConf_Signature"SetHumanSpec");
    
PrepSDKCall_AddParameter(SDKType_CBasePlayerSDKPass_Pointer);
    
fSHS EndPrepSDKCall();
    
    
StartPrepSDKCall(SDKCall_Player);
    
PrepSDKCall_SetFromConf(gConfSDKConf_Signature"TakeOverBot");
    
PrepSDKCall_AddParameter(SDKType_BoolSDKPass_Plain);
    
fTOB EndPrepSDKCall();
    

    
//Reg Commands
    
RegConsoleCmd("sm_teams"PrintTeamsToClient);

    
//Reg Cvars
    
CreateConVar("l4d_plp_version"PLUGIN_VERSION"Playerlist Panel Display Version"FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD);
    
cc_plpOnConnect CreateConVar("l4d_plp_onconnect""1""Show Playerlist Panel on connect?");
    
cc_plpTimer CreateConVar("l4d_plp_timer""20""How long, in seconds, the Playerlist Panel stay before it close automatic");
    
cc_plpAutoRefreshPanel CreateConVar("l4d_plp_autorefreshpanel""0""Should the Panel be static & refresh itself every second?");
    
cc_plpPaShowscores CreateConVar("l4d_plp_pashowscores""0""Show Playerlist Panel after Showscores? NO REFRESH!");
    
cc_plpPaSTimer CreateConVar("l4d_plp_pastimer""5""How long, in seconds, the Playerlist Panel stay after Showscores \nIf l4d_plp_pashowscores is = 1");
    
cc_plpAnnounce CreateConVar("l4d_plp_announce""1""Show Hint-Message about the command to players on Spectator?");
    
cc_plpSelectTeam CreateConVar ("l4d_plp_select_team""1""Should the user be able to select a team on Playerlist Panel?");
    
cc_plpHintStatic CreateConVar ("l4d_plp_hint_static""0""Should the Hint for Panel options be Static?");
    
cc_plpSpectatorSelect CreateConVar ("l4d_plp_select_team_spectator""1""If l4d_plp_select_team = 1 \nShould the Spectator selection be functional?");
    
cc_plpSurvivorSelect CreateConVar ("l4d_plp_select_team_survivor""1""If l4d_plp_select_team = 1 \nShould the Survivor selection be functional?");
    
cc_plpInfectedSelect CreateConVar ("l4d_plp_select_team_infected""1""If l4d_plp_select_team = 1 \nShould the Infected selection be functional?");
    
cc_plpShowBots CreateConVar ("l4d_plp_show_bots""1""Should bots be listed in Panel?");
    
    
//Execute the config file
    
AutoExecConfig(true"l4d_teamspanel");

    
//Hook Cvars
    
HookConVarChange(cc_plpOnConnectConVarChanged);
    
HookConVarChange(cc_plpTimerConVarChanged);
    
HookConVarChange(cc_plpAutoRefreshPanelConVarChanged);
    
HookConVarChange(cc_plpPaSTimerConVarChanged);
    
HookConVarChange(cc_plpPaShowscoresConVarChanged);
    
HookConVarChange(cc_plpAnnounceConVarChanged);
    
HookConVarChange(cc_plpSelectTeamConVarChanged);
    
HookConVarChange(cc_plpHintStaticConVarChanged);
    
HookConVarChange(cc_plpSpectatorSelectConVarChanged);
    
HookConVarChange(cc_plpSurvivorSelectConVarChanged);
    
HookConVarChange(cc_plpInfectedSelectConVarChanged);
    
HookConVarChange(cc_plpShowBotsConVarChanged);
    
    
//Build Hint Text depending on cvars
    
HintText();
    
    
//Checking !REAL! MaxClients
    
maxcl maxclToolzDowntownCheck();
    
    
//Re read CVARS
    
ReadCvars();
}

//Search for running L4DToolz and/or L4Downtown (or none of them) to get correct Max Clients
maxclToolzDowntownCheck()
{
    new 
Handle:invalid INVALID_HANDLE;
    new 
Handle:downtownrun FindConVar("l4d_maxplayers");
    new 
Handle:toolzrun FindConVar("sv_maxplayers");
    
    
//Downtown is running!
    
if (downtownrun != (invalid))
    {
        
//Is Downtown used for slot patching? if yes use it for Max Players
        
new downtown = (GetConVarInt(FindConVar("l4d_maxplayers")));
        if (
downtown >= 1)
        {
            
maxcl = (GetConVarInt(FindConVar("l4d_maxplayers")));
        }
    }

    
//L4DToolz is running!
    
if (toolzrun != (invalid))
    {
        
//Is L4DToolz used for slot patching? if yes use it for Max Players
        
new toolz = (GetConVarInt(FindConVar("sv_maxplayers")));
        if (
toolz >= 1)
        {
            
maxcl = (GetConVarInt(FindConVar("sv_maxplayers")));
        }
    }

    
//No Downtown or L4DToolz running using fallback (possible x/32)
    
if (downtownrun == (invalid) && toolzrun == (invalid))
    {
        
maxcl = (MaxClients);
    }
    return 
maxcl;
}

//Prepare & Print Playerlist Panel
public BuildPrintPanel(client)
{
    
//Get correct Max Clients
    
maxcl maxclToolzDowntownCheck();

    
//Build panel
    
new Handle:TeamPanel CreatePanel();
    
SetPanelTitle(TeamPanel"\x04Playerlist Panel");
    
DrawPanelText(TeamPanel" \n");
    new 
count;
    new 
isumallsumspecsumsurvsuminf;
    new 
String:text[64];

    
//Counting
    
sumall CountAllHumanPlayers();
    
sumspec CountPlayersTeam(1);
    
sumsurv CountPlayersTeam(2);
    
suminf CountPlayersTeam(3)
    
    
    
//Draw Spectators count line
    
Format(textsizeof(text), "\x04Spectators \x03(%d of %d) \x01\n"sumspecsumall);
    
    
//Slectable Spectators or not
    
if (plpSelectTeam == 1)
    {
        
DrawPanelItem(TeamPaneltext);
    }
    if (
plpSelectTeam == 0)
    {
        
DrawPanelText(TeamPaneltext);
    }

    
//Get & Draw Spectator Player Names
    
count 1;
    for (
i=1;i<=MaxClients;i++)
    {
        if (
IsValidPlayer(i) && GetClientTeam(i) == 1)
        {
            
Format(textsizeof(text), "%d. %N"counti);
            
DrawPanelText(TeamPaneltext);
            
count++;
        }
    }
    
DrawPanelText(TeamPanel" \n");
    
    
//Draw Survivors count line
    
Format(textsizeof(text), "\x04Survivors \x03(%d of %d) \x01\n"sumsurvMAX_SURVIVORS);

    
//Selectable Survivors or not
    
if (plpSelectTeam == 1)
    {
        
DrawPanelItem(TeamPaneltext);
    }
    if (
plpSelectTeam == 0)
    {
        
DrawPanelText(TeamPaneltext);
    }

    
//Get & Draw Survivor Player Names
    
count 1;
    for (
i=1;i<=MaxClients;i++)
    {
        if (
plpShowBots 0)
        {
            if (
IsClientConnected(i) && IsClientInGame(i) && GetClientTeam(i) == 2)
            {
                
Format(textsizeof(text), "%d. %N"counti);
                
DrawPanelText(TeamPaneltext);
                
count++;
            }
        }
        else
        {
            if (
IsValidPlayer(i) && GetClientTeam(i) == 2)
            {
                
Format(textsizeof(text), "%d. %N"counti);
                
DrawPanelText(TeamPaneltext);
                
count++;
            }
        }
    }
    
DrawPanelText(TeamPanel" \n");

    
//Draw Infected part depending on gamemode
    //
    //Gamemode is Versus
    
if (GameModeCheck() == 2)
    {
        
//Draw Infected count line
        
Format(textsizeof(text), "\x04Infected \x03(%d of %d) \x01\n"suminfMAX_INFECTED);

        
//Get & Draw Infected Player Names
        
if (plpSelectTeam == 1)
        {
            
DrawPanelItem(TeamPaneltext);
        }
        if (
plpSelectTeam == 0)
        {
            
DrawPanelText(TeamPaneltext);
        }
        
count 1;
        for (
i=1;i<=MaxClients;i++)
        {
            if (
plpShowBots 0)
            {
                if (
IsClientConnected(i) && IsClientInGame(i) && GetClientTeam(i) == 3)
                {
                    
Format(textsizeof(text), "%d. %N"counti);
                    
DrawPanelText(TeamPaneltext);
                    
count++;
                }
            }
            else
            {
                if (
IsValidPlayer(i) && GetClientTeam(i) == 3)
                {
                    
Format(textsizeof(text), "%d. %N"counti);
                    
DrawPanelText(TeamPaneltext);
                    
count++;
                }
            }
        }
        
//Draw Total connected Players & Draw Final
        
DrawPanelText(TeamPanel" \n");
        
Format(textsizeof(text), "\x04Connected: %d/%d"sumallmaxcl);
        
DrawPanelText(TeamPaneltext);
    }

    
//Gamemode is Coop
    
if (GameModeCheck() == 1)
    {
        
//Draw Total connected Players & Draw Final
        
Format(textsizeof(text), "\x04Connected: %d/%d"sumsurvmaxcl);
        
DrawPanelText(TeamPaneltext);
    }

    
//Send Panel to client
    
if (plpSelectTeam == 1)
    {
        
SendPanelToClient(TeamPanelclientTeamPanelHandlerBplpTimer);
        
CloseHandle(TeamPanel);
    }
    if (
plpSelectTeam == 0)
    {
        
SendPanelToClient(TeamPanelclientTeamPanelHandlerplpTimer);
        
CloseHandle(TeamPanel);
    }
}

//TeamPanelHandler
public TeamPanelHandler(Handle:TeamPanelMenuAction:actionparam1param2)
{
    if (
action == MenuAction_End)
    {
        if (
wantedrefresh[param1] == 0)
        {
            
ClientAutoRefreshPanel[param1] = 0;
            
hintstatic[param1] = 0;
        }
    }
    else if (
action == MenuAction_Select)
    {
        if (
param2 >= 1)
        {
            
ClientAutoRefreshPanel[param1] = 0;
            
hintstatic[param1] = 0;
        }
    }
}

//TeamPanelHandlerB
public TeamPanelHandlerB(Handle:TeamPanelMenuAction:actionparam1param2)
{
    if (
action == MenuAction_Select)
    {
        if (
param2 == 1)
        {
            if (
plpSpectatorSelect == 1)
            {
                
PerformSwitch(param11);
            }
            
ClientAutoRefreshPanel[param1] = 0;
            
hintstatic[param1] = 0;
        }
        else if (
param2 == 2)
        {
            if (
plpSurvivorSelect == 1)
            {
                
PerformSwitch(param12);
            }
            
ClientAutoRefreshPanel[param1] = 0;
            
hintstatic[param1] = 0;
        }
        else if (
param2 == 3)
        {
            if (
plpInfectedSelect == 1)
            {
                
PerformSwitch(param13);
            }
            
ClientAutoRefreshPanel[param1] = 0;
            
hintstatic[param1] = 0;
        }
    }
    else if (
action == MenuAction_Cancel)
    {
        
ClientAutoRefreshPanel[param1] = 0;
        
hintstatic[param1] = 0;
    }
}

//Send the Panel to the Client
public Action:PrintTeamsToClient(clientargs)
{
    if (
plpAutoRefreshPanel == && plpSelectTeam == 0)
    {
        
wantedrefresh[client] = 1;
        
ClientAutoRefreshPanel[client] = 1;
        if (
plpHintStatic == 1)
        {
            
hintstatic[client] = 1;
            
CreateTimer(3.0HintStaticTimerclientTIMER_REPEAT);
        }
        
CreateTimer(3.0RefreshPanelclientTIMER_REPEAT);
    }
    if (
plpAutoRefreshPanel == 0)    
    {
        
wantedrefresh[client] = 0;
        
plpTimer GetConVarInt(cc_plpTimer);
        if (
plpSelectTeam == 1)
        {
            if (
IsValidPlayer(client)) PrintHintText(client"%s"hintText);
        }
        if (
plpSelectTeam == 0)
        {
            if (
IsValidPlayer(client)) PrintHintText(client"Press '0' \nTo close the Panel!");
        }
        
BuildPrintPanel(client);
    }
    if (
plpAutoRefreshPanel == && plpSelectTeam == 1)
    {
        
wantedrefresh[client] = 0;
        
plpTimer GetConVarInt(cc_plpTimer);
        if (
plpSelectTeam == 1)
        {
            if (
IsValidPlayer(client)) PrintHintText(client"%s"hintText);
        }
        if (
plpSelectTeam == 0)
        {
            if (
IsValidPlayer(client)) PrintHintText(client"Press '0' \nTo close the Panel!");
        }
        
BuildPrintPanel(client);
    }
    
}

//Show Announcement for !teams Command
public Action:AnnounceCommand(Handle:timer)
{
    if (
plpAnnounce >0)
    {
        for(new 
i=1i<=32i++)
        {
            if (
IsValidPlayer(i) && GetClientTeam(i) == 1)
            {
                
PrintHintText(i"Say !teams to see a list of Players \nThen 2 for Survivor \nOr 3 for Infected");
            }
        }
        return 
Plugin_Continue;
    }
    return 
Plugin_Stop;
}

//Dow we Show Panel On Connect? (on by default)
public Action:OnConnect(Handle:timerany:client)
{
    if (
plpOnConnect == && ClientAutoRefreshPanel[client] == 1)
    {
        if (
plpSelectTeam == 1)
        {
            
hintstatic[client] = 0;
            
plpTimer GetConVarInt(cc_plpTimer);
        }
        else
        {
            
plpTimer 0;
        }
        
CreateTimer(3.0RefreshPanelclientTIMER_REPEAT);
        if (
plpSelectTeam == && plpHintStatic == 1)
        {
            
hintstatic[client] = 1;
            
CreateTimer(4.0HintStaticTimerclientTIMER_REPEAT);
        }
        if (
plpHintStatic == 0)
        {
            
hintstatic[client] = 0;
            
CreateTimer(4.0HintStaticTimerclientTIMER_FLAG_NO_MAPCHANGE);
        }
    }
    if (
plpOnConnect == && ClientAutoRefreshPanel[client] == 0)
    {
        
hintstatic[client] = 0;
        
wantedrefresh[client] = 0;
        
plpTimer GetConVarInt(cc_plpTimer);
        if (
plpSelectTeam == 1)
        {
            if (
IsValidPlayer(client)) PrintHintText(client"%s"hintText);
        }
        if (
plpSelectTeam == 0)
        {
            if (
IsValidPlayer(client)) PrintHintText(client"Press '0' \nTo close the Panel!");
        }
        
BuildPrintPanel(client);
    }
}

//HintStatic Timer
public Action:HintStaticTimer(Handle:Timerany:client)
{
    if (
hintstatic[client] == 1)
    {
        if (
IsValidPlayer(client)) PrintHintText(client"Press '0' \nTo close the Panel!");
    }
    return 
Plugin_Stop;
}

//Refreshing Panel Timer
public Action:RefreshPanel(Handle:Timerany:client)
{
    if (
ClientAutoRefreshPanel[client] == 1)
    {
        if (
plpSelectTeam == 1)
        {
            
plpTimer GetConVarInt(cc_plpTimer);
        }
        else
        {
            
plpTimer 0;
        }
        
BuildPrintPanel(client);
        return 
Plugin_Continue;
    }
    return 
Plugin_Stop;
}

//Check if Player fresh connected
public OnClientPostAdminCheck(client)
{
    if (
IsValidPlayer(client) && plpAutoRefreshPanel == 1)
    {
        
ClientAutoRefreshPanel[client] = 1;
        
wantedrefresh[client] = 1;
    }
    if (
IsValidPlayer(client) && plpAutoRefreshPanel == 0)
    {
        
ClientAutoRefreshPanel[client] = 0;
        
wantedrefresh[client] = 0;
    }
    
//Only show Playerlist Panel to "new" connected Players
    
if (IsValidPlayer(client) && GetClientTime(client) <= 120)
    {
        
CreateTimer(5.0OnConnectclientTIMER_FLAG_NO_MAPCHANGE);
    }
}

//Client Disconnects
public OnClientDisconnect(client)
{
    if (
IsValidPlayer(client))
    {
        
ClientAutoRefreshPanel[client] = 0;
        
wantedrefresh[client] = 0;
        
hintstatic[client] = 0;
    }
}

//Gamemode Check
GameModeCheck()
{
    new 
GameMode 0;
    new 
String:gamemodecvar[16];
    
GetConVarString(FindConVar("mp_gamemode"), gamemodecvarsizeof(gamemodecvar));
    if (
StrContains(gamemodecvar"versus"false) != -|| StrContains(gamemodecvar"mutation12"false) != -|| StrContains(gamemodecvar"scavenge"false) != -1)
    {
        
GameMode 2;
        return 
GameMode;
    }
    if (
StrContains(gamemodecvar"coop"false) != -|| StrContains(gamemodecvar"survival"false) != -1)
    {
        
GameMode 1;
        return 
GameMode;
    }
    return 
GameMode;
}

//Cvar changed check
public ConVarChanged(Handle:convar, const String:oldValue[], const String:newValue[])
{
    
ReadCvars();
}

//Re-Read Cvars
public ReadCvars()
{
    
plpAutoRefreshPanel=GetConVarInt(cc_plpAutoRefreshPanel);
    
plpHintStatic=GetConVarInt(cc_plpHintStatic);
    
plpSelectTeam=GetConVarInt(cc_plpSelectTeam);
    
plpSpectatorSelect=GetConVarInt(cc_plpSpectatorSelect);
    
plpSurvivorSelect=GetConVarInt(cc_plpSurvivorSelect);
    
plpInfectedSelect=GetConVarInt(cc_plpInfectedSelect);
    
plpOnConnect=GetConVarInt(cc_plpOnConnect);
    
plpPaSTimer=GetConVarInt(cc_plpPaSTimer);
    
plpAnnounce=GetConVarInt(cc_plpAnnounce);
    
plpPaShowscores=GetConVarInt(cc_plpPaShowscores);
    
plpTimer=GetConVarInt(cc_plpTimer);
    
plpShowBots=GetConVarInt(cc_plpShowBots);
    
HintText();
}

//Show Playerlist Panel after Scoreboard
public Action:OnPlayerRunCmd(client, &buttons, &impulseFloat:vel[3], Float:angles[3])
{
    
//Check if its a valid player
    
if (!IsValidPlayer(client)) return;
    if (
plpPaShowscores == 1)
    {
        if (
buttons IN_SCORE)
        {
            
wantedrefresh[client] = 0;
            
ClientAutoRefreshPanel[client] = 0;
            
plpTimer plpPaSTimer;
            if (
plpSelectTeam == 1)
            {
                if (
IsValidPlayer(client)) PrintHintText(client"%s"hintText);
            }
            if (
plpSelectTeam == 0)
            {
                if (
IsValidPlayer(client)) PrintHintText(client"Press '0' \nTo close the Panel!");
            }
            if (
IsValidPlayer(client))
            {
                
BuildPrintPanel(client);
            }
        }
    }  
}  

//Check of Full Teams (copied, credits to L4DSwitchPlayers)
bool:IsTeamFull (team)
{
    
// Spectator's team is never full :P
    
if (team == 1)
        return 
false;
    
    new 
max;
    new 
count;
    new 
i;
    
    
// we count the players in the survivor's team
    
if (team == 2)
    {
        
max MAX_SURVIVORS;
        
count 0;
        for (
i=1;i<=MaxClients;i++)
            if (
IsValidPlayer(i) && GetClientTeam(i)==2)
                
count++;
        }
    else if (
team == 3// we count the players in the infected's team
    
{
        
max MAX_INFECTED;
        
count 0;
        for (
i=1;i<=MaxClients;i++)
            if (
IsValidPlayer(i) && GetClientTeam(i)==3)
                
count++;
        }
    
    
// If full ...
    
if (count >= max)
        return 
true;
    else
    return 
false;
}

//Do switching of Client (copied and edited, credits to L4DSwitchPlayers)
PerformSwitch (clientteam)
{
    if (!
IsValidPlayer(client))
    {
        return;
    }
    
    
// If teams are the same ...
    
if (GetClientTeam(client) == team)
    {
        
PrintToChat(client"Hello? You are already on that team!");
        return;
    }
    
    
// If we should check if teams are fulll ...
    // We check if target team is full...
    
if (IsTeamFull(team))
    {
        if (
team == 2)
        {
            
PrintToChat(client"The \x03Survivor\x01's team is already full.");
        }
        if (
team == 3)
        {
            
PrintToChat(client"The \x03Infected\x01's team is already full.");
        }
        return;
    }
    
    
// If player was on infected .... 
    
if (GetClientTeam(client) == 3)
    {
        
// ... and he wasn't a tank ...
        
new String:iClass[100];
        
GetClientModel(clientiClasssizeof(iClass));
        if (
StrContains(iClass"hulk"false) == -1)
            
ForcePlayerSuicide(client);    // we kill him
    
}
    
    
// If target is survivors .... we need to do a little trick ....
    
if (team == || team == 3)// We change it's team ...
    
{
        
ChangeClientTeam(clientteam);
    }
    if (
team == 2)
    {
        
// first we switch to spectators ..
        
ChangeClientTeam(client1); 
        
        
// Search for an empty bot
        
for (new bot=0;bot<=32;bot++)
        {
            if (
bot && IsClientConnected(bot) && IsFakeClient(bot) && (GetClientTeam(bot) == 2))
            {
                
// force player to spec humans
                
SDKCall(fSHSbotclient); 
        
                
// force player to take over bot
                
SDKCall(fTOBclienttrue);
                return;
            }
        }    
    }
}

//Hint Text
public HintText()
{
    
//Define text parts
    
new String:specTextOn[] = "1 to join Spectator";
    new 
String:specTextOff[] = "Spec = !spectate";
    new 
String:survTextOn[] = "2 to join Survivor";
    new 
String:survTextOff[] = "Survivor = !jointeam2";
    new 
String:infTextOn[] = "3 to join Infected";
    new 
String:infTextOff[] = "Infected = !jointeam3";
    new 
String:secondLine[] = "\nPress '0' to just close the Panel!"
    
    
//Check selectable switches and format text
    
if (plpSpectatorSelect == && plpSurvivorSelect == && plpInfectedSelect == 1)
    {
        
Format(hintText255"%s | %s | %s%s"specTextOnsurvTextOninfTextOnsecondLine);
    }
    if (
plpSpectatorSelect == && plpSurvivorSelect == && plpInfectedSelect == 0)
    {
        
Format(hintText255"%s | %s | %s%s"specTextOnsurvTextOffinfTextOffsecondLine);
    }
    if (
plpSpectatorSelect == && plpSurvivorSelect == && plpInfectedSelect == 0)
    {
        
Format(hintText255"%s | %s | %s%s"specTextOnsurvTextOninfTextOffsecondLine);
    }
    if (
plpSpectatorSelect == && plpSurvivorSelect == && plpInfectedSelect == 1)
    {
        
Format(hintText255"%s | %s | %s%s"specTextOnsurvTextOffinfTextOnsecondLine);
    }
    if (
plpSpectatorSelect == && plpSurvivorSelect == && plpInfectedSelect == 1)
    {
        
Format(hintText255"%s | %s | %s%s"specTextOffsurvTextOninfTextOnsecondLine);
    }
    if (
plpSpectatorSelect == && plpSurvivorSelect == && plpInfectedSelect == 0)
    {
        
Format(hintText255"%s | %s | %s%s"specTextOffsurvTextOninfTextOffsecondLine);
    }
    if (
plpSpectatorSelect == && plpSurvivorSelect == && plpInfectedSelect == 1)
    {
        
Format(hintTextsizeof(hintText), "%s | %s | %s %s"specTextOffsurvTextOffinfTextOnsecondLine);
    }
}

//Event Map Start
public OnMapStart()
{
    if (
plpAnnounce >= 1)
    {
        
CreateTimer(15.0AnnounceCommand_TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
    }
}

//Is Valid Player
public IsValidPlayer(client)
{
    if (!
IsValidClient(client))
        return 
false;
    
    if (
IsFakeClient(client))
        return 
false;
    
    return 
true;
}

bool IsValidClient(int client)
{
    return (
<= client <= MaxClients && IsClientInGame(client));
}

//Count all Players
public CountAllHumanPlayers()
{
    new 
Count 0;
    for (new 
i=1;i<=MaxClients;i++)
    {
        if (
IsClientConnected(i) && IsClientInGame(i) && !IsFakeClient(i))
        {
            
Count++;
        }
    }
    return 
Count;
}

//Count Players Team
public CountPlayersTeam(team)
{
    new 
Count 0;
    for (new 
i=1;i<=MaxClients;i++)
    {
        if (
IsClientConnected(i) && IsClientInGame(i) && !IsFakeClient(i) && GetClientTeam(i) == team)
        {
            
Count++;
        }
    }
    return 
Count;
}

//End of Plugin 

Last edited by Darkwob; 09-26-2020 at 13:41.
Darkwob 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 03:41.


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