AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   CS TeamSwap / FSB_ALLOWOVERFLOW (https://forums.alliedmods.net/showthread.php?t=271525)

Phant 09-14-2015 05:50

CS TeamSwap / FSB_ALLOWOVERFLOW
 
Hi. I use this test-code for Swap Players teams:
PHP Code:

#include <amxmodx>
#include <cstrike>
#include <fun>
#include <fakemeta>

public plugin_init()
{
    
register_plugin("Test""0.1""Phantomas")
    
register_clcmd("say t""clcmdT");
}

team_swap(idCsTeams:team)
{
    if(
team == CS_TEAM_T)
    {
        
//cs_set_user_team(id, CS_TEAM_CT, CS_DONTCHANGE)
        
set_pdata_int(id1142)
    } else {
        
//cs_set_user_team(id, CS_TEAM_T, CS_DONTCHANGE)
        
set_pdata_int(id1141)
    }
}

public 
clcmdT(id)
{
    new 
players[32], pnumplr
    get_players
(playerspnum"h")
    for (new 
ii<pnumi++)
    {
        
plr players[i]
        new 
CsTeams:team
        team 
cs_get_user_team(plr)
        if(
team == CS_TEAM_T || CS_TEAM_CT) {
            
team_swap(plrteam)
        }
    }


And when I test it on server with ~10 players (5x5), it's okay, all works fine.
But when server have more players (I test 16x16 with PODBots), then server crashed at new round start moment (after swapping):
http://6.firepic.org/6/images/2015-0...r3vrlset12.png
Quote:

SZ_GetSpace: overflow without FSB_ALLOWOVERFLOW set on Server Reliable Datagram
Any ideas how to bypass it? cs_set_user_team() got crash too.

Arkshine 09-14-2015 06:47

Re: CS TeamSwap / FSB_ALLOWOVERFLOW
 
This code exactly can't crash the server but you do that before all players are spawning for example, yes, it's the cause.

Long short story, this error is an engine bug which doesn't check for buffer overflow. It happens when too much players need to update the model.

Native has been fixed in dev build, fix is essentially that any update is always postponed at the next frame, so the engine buffer doesn't overflow.

Phant 09-14-2015 06:51

Re: CS TeamSwap / FSB_ALLOWOVERFLOW
 
Found this:
https://forums.alliedmods.net/showthread.php?t=90898

So, bypass: Change team with some delay, for example:
PHP Code:

#include <amxmodx>
#include <cstrike>
#include <fun>
#include <fakemeta>

public plugin_init()
{
    
register_plugin("Test""0.1""Phantomas")
    
register_clcmd("say t""clcmdT");
}

public 
swap_teams(id)
{
    switch(
cs_get_user_team(id))
    {
        case 
CS_TEAM_CT:cs_set_user_team(idCS_TEAM_T);
        case 
CS_TEAM_T:cs_set_user_team(idCS_TEAM_CT);
    }
}

team_swap(id)
{
    switch(
id)
    {
        case 
1..7set_task0.2"swap_teams"id );
        case 
8..15set_task0.4"swap_teams"id );
        case 
16..23set_task0.6"swap_teams"id );
        case 
24..32set_task0.8"swap_teams"id );
    }
}

public 
clcmdT(id)
{
    new 
players[32], pnumplr
    get_players
(playerspnum"h")
    for (new 
ii<pnumi++)
    {
        
plr players[i]
        
team_swap(plr)
    }



wickedd 09-14-2015 07:04

Re: CS TeamSwap / FSB_ALLOWOVERFLOW
 
Check this out


All times are GMT -4. The time now is 23:45.

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