View Single Post
CliptonHeist
Senior Member
Join Date: Feb 2016
Old 02-14-2019 , 16:52   Re: Plugin to move all VIPs/Admins with flag "a" to T and everyone else to CT
Reply With Quote #3

Fixed version
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <cstrike>

#define PREFIX "[SM]"

public Plugin myinfo 
{
    
name "Admins T Clients CT",
    
author "Pilo",
    
description "Move all the normal players to CT and Admins/Vip's to T'",
    
version "1.0",
    
url "https://forums.gamers-israel.co.il/member.php?u=33"
};

public 
void OnPluginStart()
{    
    
RegAdminCmd("sm_event"Command_EventADMFLAG_GENERIC"");
}

public 
Action Command_Event (int clientint args)
{
    for (
int i 1<= MaxClientsi++)
    {
        if(!
IsValidClient(i)) continue;

        if (
CheckCommandAccess(i"sm_null_command"ADMFLAG_RESERVATIONtrue))
            
CS_SwitchTeam(iCS_TEAM_T)
        else
            
CS_SwitchTeam(iCS_TEAM_CT);
    }

    if(
IsValidClient(client))
        
PrintToChatAll("%s \x02%N \x01 moved all players to CT and Admins to T! \x05Have Fun! \x01"PREFIXclient);
    else
        
PrintToChatAll("%s Moved all players to CT and Admins to T! \x05Have Fun! \x01"PREFIX);

    return 
Plugin_Handled;
}

stock bool IsValidClient(int client)
{
    return 
IsClientInGame(client) &&
    !
IsFakeClient(client);

CliptonHeist is offline