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

Solved Lock and unlock teamchange


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PinHeaDi
Senior Member
Join Date: Jul 2013
Location: Bulgaria
Old 10-15-2017 , 08:49   Lock and unlock teamchange
Reply With Quote #1

The idea:

When a new round stars - block team changing, e.g. "You can only change team one the round is over"
When the round ends - unlock teamchanging.
Repeat.

Code:

PHP Code:
#pragma semicolon 1

#include <sourcemod>
#include <csgocolors>

bool IsChangeAllowed true;

public 
OnPluginStart()
{
    
AddCommandListener(Command_JoinTeam"jointeam");
    
    
HookEvent("round_start"RoundStart);
    
HookEvent("round_end"RoundEnd);
}

public 
Action RoundStart(Event eventchar[] namebool dontBroadcast)
{
    
IsChangeAllowed false;
}

public 
Action RoundEnd(Event eventchar[] namebool dontBroadcast)
{
    
IsChangeAllowed true;
}  

public 
Action Command_JoinTeam(clientchar[] commandargs)
{    
    if (
client != 0)
    {
        if(
IsClientInGame(client) && !IsFakeClient(client))
        {
            if (
GetClientTeam(client) > && !IsChangeAllowed)
            {
                
CPrintToChat(client"[{red}!{default}] You can change your team only when the round is finished!");
                return 
Plugin_Stop;
            }
        }
    }

    return 
Plugin_Continue;

Maybe I mixed new and old sintax, don't know. And not sure if that code will work.
__________________

Last edited by PinHeaDi; 10-18-2017 at 09:54.
PinHeaDi is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 10-15-2017 , 08:56   Re: Lock and unlock teamchange
Reply With Quote #2

so are you asking for help?
or ???
8guawong is offline
PinHeaDi
Senior Member
Join Date: Jul 2013
Location: Bulgaria
Old 10-15-2017 , 08:58   Re: Lock and unlock teamchange
Reply With Quote #3

Quote:
Originally Posted by 8guawong View Post
so are you asking for help?
or ???
I'm asking if the code is ready to go and will work as intended.
__________________
PinHeaDi is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 10-15-2017 , 10:31   Re: Lock and unlock teamchange
Reply With Quote #4

why don't you test it yourself...
8guawong 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 05:36.


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