View Single Post
Author Message
RaZ_HU
Senior Member
Join Date: May 2015
Location: Hungary
Old 12-30-2017 , 16:03   Team swap causes server crash
Reply With Quote #1

Hey guys!

I have a strange problem with a really simple team swapper plugin.
If I use the command !forceswap then the server crashes at the end of the round.
In console.log the following message appears only:
Quote:
Segmentation fault
I have disabled every other plugin (both AMXX and metamod) but is still crashes.
This happens only on linux dedicated servers, BUT only on 2 server from the 4.
On my PC it doesn't crashes on Windows server (set up for testing).

Servers are all:
ReHLDS build 1210
ReGameDLL 5.3.0.218-dev
Metamod-r version 1.3.0.104

AMXX versions:
Tried both 1.8.3-dev+5117 and latest 1.8.3-dev+5151.

The plugin itself:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>

new bool:g_forcetrans
new g_iMaxPlayers

public plugin_init()
{
    
register_plugin"Chat Teamswap","0.1","Genesis, RaZ_HU" )

    
register_clcmd"say !forceswap""massive_transfer",ADMIN_BAN )

    
register_event"SendAudio""endRound""a""2=%!MRAD_terwin""2=%!MRAD_ctwin""2=%!MRAD_rounddraw" )
    
g_iMaxPlayers get_maxplayers()
}

public 
plugin_cfg()
{
    
g_forcetrans false
}

public 
endRound()
{
    if(
g_forcetrans == true)
    {
        for( new 
1g_iMaxPlayersi++ )
        {
            if( 
is_user_connected(i) )
            {
                if( 
cs_get_user_team(i) == CS_TEAM_CT )
                {
                    
cs_set_user_team(iCS_TEAM_T )
                }
                else if( 
cs_get_user_team(i) == CS_TEAM_T )
                {
                    
cs_set_user_team(iCS_TEAM_CT)
                }
            }
        }
        
g_forcetrans false
    
}

    return 
PLUGIN_HANDLED
}

public 
massive_transferid,level,cid )
{
    if (!
cmd_access(id,level,cid,0))
        return 
PLUGIN_HANDLED

    g_forcetrans 
true

    client_print_color
0,0,"^4[Information] ^3Teams will be^1swapped ^3in the next round!" )

    return 
PLUGIN_HANDLED


Any help appreciated

Last edited by RaZ_HU; 12-31-2017 at 14:26.
RaZ_HU is offline