AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   [REQ][CSGO] Normal Player => CT / Admin => TR (https://forums.alliedmods.net/showthread.php?t=287005)

ffriozi 08-29-2016 15:25

[REQ][CSGO] Normal Player => CT / Admin => TR
 
hey guys sup?

There is any plugin to only allow TR side to Admins?

i want normal players to CT and admins do TR.

is this possible?

Grey83 08-29-2016 16:56

Re: [REQ][CSGO] Normal Player => CT / Admin => TR
 
try this:
PHP Code:

#pragma semicolon 1
#pragma newdecls required

#include <sourcemod>
#include <sdktools>
#include <cstrike>

bool bIsAdmin[MAXPLAYERS+1];

public 
void OnPluginStart()
{
    
AddCommandListener(Cmd_JoinTeam"jointeam"); 
    
HookEvent("player_spawn"PlayerSpawn);
}

public 
void OnClientPostAdminCheck(int client)
{
    if(
client <= MaxClientsbIsAdmin[client] = CheckCommandAccess(client"sm_admin"ADMFLAG_GENERIC);
}

public 
Action PlayerSpawn(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(event.GetInt("userid"));
    if(!
IsFakeClient(client)) ChangeTeam(clientGetClientTeam(client), bIsAdmin[client]);
}

public 
Action Cmd_JoinTeam(int client, const char[] commandint argc)
{
    if(
argc == || client == || !IsClientConnected(client) || !IsClientInGame(client) || IsFakeClient(client)) return Plugin_Continue;

    
char team[4];
    
GetCmdArg(1teamsizeof(team));
    
ChangeTeam(clientStringToInt(team), bIsAdmin[client]);

    return 
Plugin_Continue;
}

void ChangeTeam(int clientint teambool admin)
{
    if((
admin && team == CS_TEAM_CT) || (!admin && team == CS_TEAM_T))
    {
        
ChangeClientTeam(clientbIsAdmin[client] ? CS_TEAM_T CS_TEAM_CT);
        
CS_RespawnPlayer(client);
    }


Need SM1.8 to compile

ffriozi 08-29-2016 18:33

Re: [REQ][CSGO] Normal Player => CT / Admin => TR
 
Yeah worked.

if i want only players with access to sm_vip i just change the sm_admin line?

Grey83 08-29-2016 22:26

Re: [REQ][CSGO] Normal Player => CT / Admin => TR
 
In this case You need change parametrs in the CheckCommandAccess():
eg. CheckCommandAccess(client, "sm_vip", ADMFLAG_CUSTOM1)
PHP Code:

/**
 * @section Bitwise values definitions for admin flags.
 */
#define ADMFLAG_RESERVATION            (1<<0)        /**< Convenience macro for Admin_Reservation as a FlagBit */
#define ADMFLAG_GENERIC                (1<<1)        /**< Convenience macro for Admin_Generic as a FlagBit */
#define ADMFLAG_KICK                (1<<2)        /**< Convenience macro for Admin_Kick as a FlagBit */
#define ADMFLAG_BAN                    (1<<3)        /**< Convenience macro for Admin_Ban as a FlagBit */
#define ADMFLAG_UNBAN                (1<<4)        /**< Convenience macro for Admin_Unban as a FlagBit */
#define ADMFLAG_SLAY                (1<<5)        /**< Convenience macro for Admin_Slay as a FlagBit */
#define ADMFLAG_CHANGEMAP            (1<<6)        /**< Convenience macro for Admin_Changemap as a FlagBit */
#define ADMFLAG_CONVARS                (1<<7)        /**< Convenience macro for Admin_Convars as a FlagBit */
#define ADMFLAG_CONFIG                (1<<8)        /**< Convenience macro for Admin_Config as a FlagBit */
#define ADMFLAG_CHAT                (1<<9)        /**< Convenience macro for Admin_Chat as a FlagBit */
#define ADMFLAG_VOTE                (1<<10)        /**< Convenience macro for Admin_Vote as a FlagBit */
#define ADMFLAG_PASSWORD            (1<<11)        /**< Convenience macro for Admin_Password as a FlagBit */
#define ADMFLAG_RCON                (1<<12)        /**< Convenience macro for Admin_RCON as a FlagBit */
#define ADMFLAG_CHEATS                (1<<13)        /**< Convenience macro for Admin_Cheats as a FlagBit */
#define ADMFLAG_ROOT                (1<<14)        /**< Convenience macro for Admin_Root as a FlagBit */
#define ADMFLAG_CUSTOM1                (1<<15)        /**< Convenience macro for Admin_Custom1 as a FlagBit */
#define ADMFLAG_CUSTOM2                (1<<16)        /**< Convenience macro for Admin_Custom2 as a FlagBit */
#define ADMFLAG_CUSTOM3                (1<<17)        /**< Convenience macro for Admin_Custom3 as a FlagBit */
#define ADMFLAG_CUSTOM4                (1<<18)        /**< Convenience macro for Admin_Custom4 as a FlagBit */
#define ADMFLAG_CUSTOM5                (1<<19)        /**< Convenience macro for Admin_Custom5 as a FlagBit */
#define ADMFLAG_CUSTOM6                (1<<20)        /**< Convenience macro for Admin_Custom6 as a FlagBit */ 



All times are GMT -4. The time now is 18:48.

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