Raised This Month: $ Target: $400
 0% 

Autojoin blocks the buy menu


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
szogun
Senior Member
Join Date: Apr 2016
Old 04-05-2018 , 12:27   Autojoin blocks the buy menu
Reply With Quote #1

I have a problem with the plugin that blocks the change of teams and automatically adds players.
the problem is that the player can not buy a weapon

PHP Code:
#include <sourcemod>
#include <cstrike>
#include <sdktools>
#pragma newdecls required
#pragma semicolon 1

ConVar cvTeamchangelimit;
ConVar cvExcludespec;
Handle hTeam;
int iTeamchangecount[MAXPLAYERS+1];

public 
Plugin myinfo =
{
    
name "Team Change Regulator",
    
author "allienmods ",
    
description "Regulates team change.",
    
version "1.0",
    
url "https://forums.alliedmods.net/showthread.php?t=306013"
};

public 
void OnPluginStart()
{
    
hTeam CreateConVar("sm_join_team""1""Do not edit this");
    
cvTeamchangelimit CreateConVar("sm_teamchange_limit""1""Sets how many times a player may switch between teams. Default = 1");
    
cvExcludespec CreateConVar("sm_teamchange_excludespec""1""Should we exclude counting team changes to spectators? 0 = Disable");
    
AddCommandListener(cmdListener_Changeteam"jointeam");
    
HookEvent("player_connect_full"vEvent_OnFullConnectEventHookMode_Post);
}

public 
void vEvent_OnFullConnect(Event event, const char[] namebool dontBroadcast)

    
int client GetClientOfUserId(event.GetInt("userid"));
    if (
client != && IsClientInGame(client) && !IsFakeClient(client) && !bIsAdminRoot(client))
    {
        
CreateTimer(0.5tAssignTeamclient);
    }
}

public 
void OnClientPutInServer(int client)
{
    if (!
IsFakeClient(client) && IsClientInGame(client))
    {
        
iTeamchangecount[client] = 0;
    }
}

public 
Action tAssignTeam(Handle timerany client)

    if (
IsClientInGame(client))
    { 
        
int iCvar GetConVarInt(hTeam);
        switch (
iCvar)
        { 
            case 
0:
            {
                return 
Plugin_Handled;
            }

            case 
1:
            {
                
int iRed;
                
int iBlue;
                for (
int i 1<= MaxClientsi++)
                {
                    if (!
IsClientInGame(i))
                    {
                        continue;
                    }

                    
int iTeam GetClientTeam(i);
                    if (
iTeam == CS_TEAM_T)
                    {
                        
iRed++;
                    }

                    else if (
iTeam == CS_TEAM_CT)
                    {
                        
iBlue++;
                    }
                }

                if (
iRed iBlue)
                {
                    
ChangeClientTeam(client3);
                }

                else if (
iRed iBlue || iRed == iBlue
                {
                    
ChangeClientTeam(client2);
                }
            }

            case 
2:
            {
                
ChangeClientTeam(client2);
            }

            case 
3:
            {
                
ChangeClientTeam(client3);
            }
        }
    }

    return 
Plugin_Continue;
}

public 
Action cmdListener_Changeteam(int client, const char[] commandint args)
{
    if (
bIsAdminRoot(client))
    {
        return 
Plugin_Continue;
    }

    if (
iTeamchangecount[client] == cvTeamchangelimit.IntValue)
    {
        
PrintToChat(client"[TeamManager] Nie mozesz ponownie zmienic teamu!!!");
        
PrintCenterText(client"<font color='#FF0000'><b>[TeamManager]</font> <font color='#FFFFFF'>Nie mozesz ponownie zmienic teamu!!!</font>");
        return 
Plugin_Handled;
    }

    
char arg1[3];
    
GetCmdArg(1arg1sizeof(arg1));
    
int target_team StringToInt(arg1);
    
int current_team GetClientTeam(client);
    if (
target_team == current_team)
    {
        return 
Plugin_Handled;
    }

    else if ((
target_team && cvExcludespec.IntValue >= 1) || cvExcludespec.IntValue 1)
    {
        
iTeamchangecount[client]++;
    }

    return 
Plugin_Handled;
}

bool bIsAdminRoot(int client)
{
    return (
CheckCommandAccess(client"team_change_admin"ADMFLAG_ROOTfalse));


Last edited by szogun; 04-05-2018 at 12:32.
szogun is offline
 



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 04:40.


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