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

[CSGO] Team Swap


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hadesownage
AlliedModders Donor
Join Date: Jun 2013
Location: Romania, Iași
Old 11-15-2015 , 12:36   [CSGO] Team Swap
Reply With Quote #1

Hello I'm using CSGO Base Builder by boomix (https://forums.alliedmods.net/showthread.php?t=271363)
But there is a big problem, sometimes when the server is full, when the round is over the server is crashing. I think the problem is in Team Swap, so here is the code ->

PHP Code:
// EditPlus

#include <sourcemod>

#define VERSION "1.0"

#define LoopAllPlayersInGame(%1) for(int %1=1;%1<=MaxClients;++%1)\
if(IsClientInGame(%1) && !IsFakeClient(%1))

public 
Plugin:myinfo =
{
    
name "Name",
    
author "boomix",
    
description "Description",
    
version VERSION,
    
url "http://forums.alliedmods.net"
};

public 
OnPluginStart()
{
    
CreateConVar("sm_name_version"VERSION"Name Version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);

    
HookEvent("round_end"BB_RoundEnd);
}

public 
Action BB_RoundEnd(Handle event, const char[] namebool dontBroadcast
{
    
    
CreateTimer(6.7SwapTeams);

}


public 
Action SwapTeams(Handle tmr
{
    
LoopAllPlayersInGame(i
    {
    
        if (
g_WasBuilderThisRound[i] )
            
ChangeClientTeamBetter(iZombies);
        
        else if (!
g_WasBuilderThisRound[i])
            
ChangeClientTeamBetter(iBuilders);
        
        else
            
ChangeClientTeamBetter(iZombies);
    
    }
}


void ChangeClientTeamBetter(int clientint team
{
    if (
IsClientInGame(client) && !IsFakeClient(client) && team == Builders
    {
        
EditScore(client);
        
ChangeClientTeam(clientCS_TEAM_CT);
    }
    
    else if (
IsClientInGame(client) && !IsFakeClient(client) && team == Zombies
    {
        
EditScore(client);
        
ChangeClientTeam(clientCS_TEAM_T);
    }
}

void EditScore(int client
{
    
int frags GetClientFrags(client);
    
int deaths GetClientDeaths(client);
    
    
int newfrags frags 1;
    
int newdeaths deaths 1;
    
    
SetEntProp(clientProp_Data"m_iFrags"newfrags);
    
SetEntProp(clientProp_Data"m_iDeaths"newdeaths);

I already tired with CS_TeamSwitch, but server is the same, server go crash again.
Any suggestions ? Thank you!

Last edited by hadesownage; 11-15-2015 at 12:37.
hadesownage is offline
Send a message via Yahoo to hadesownage Send a message via Skype™ to hadesownage
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 02:02.


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