AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   [REQ] cs:go only admin spectator (https://forums.alliedmods.net/showthread.php?t=264927)

vase070 06-23-2015 09:06

[REQ] cs:go only admin spectator
 
can anyone make a plugin to allow only admins to go spec

Puppetmaster 06-24-2015 01:05

Re: [REQ] cs:go only admin spectator
 
This code will move any players in spectator into T or CT at the start of each round
Ive uploaded it here: https://forums.alliedmods.net/showthread.php?t=264987

Code:

#include <dbi>
#include <sourcemod> 
#include <cstrike>
#include <clientprefs>
#include <sdktools>
 
#define PLUGIN_VERSION "0.0.0"
 
 
//begin
public Plugin:myinfo =
{
    name = "SimpleCSGOAntiSpectator",
    author = "Puppetmaster",
    description = "SimpleCSGOAntiSpectator Addon",
    version = PLUGIN_VERSION,
    url = "http://gamingzone.ddns.net/"
};
 
//called at start of plugin, sets everything up.
public OnPluginStart()
{
    HookEvent("round_poststart", Event_RoundStart) //new round
    HookEvent("round_prestart", Event_RoundStart) //new round
}
 
 
public Action:Event_RoundStart (Handle:event, const String:name[], bool:dontBroadcast){
    move();
    return Plugin_Continue;
}
 
 
public move(){
    PrintToServer("New Round, Moving players out of spectator");
    new maxclients = GetMaxClients()
    for(new i=1; i <= maxclients; i++)
    {
        if(IsClientInGame(i)) 
        {
            if(GetClientTeam(i) < 2)
            {
                if(GetUserAdmin(i) == INVALID_ADMIN_ID) ChangeClientTeam(i, GetRandomInt(2, 3)); //move non-admins randomly to t or ct
            }
        }
    }
}



All times are GMT -4. The time now is 05:15.

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