Raised This Month: $32 Target: $400
 8% 

CS TeamSwap / FSB_ALLOWOVERFLOW


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Phant
Veteran Member
Join Date: Sep 2009
Location: New Jersey
Old 09-14-2015 , 05:50   CS TeamSwap / FSB_ALLOWOVERFLOW
Reply With Quote #1

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):

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.
Phant is offline
Send a message via ICQ to Phant
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-14-2015 , 06:47   Re: CS TeamSwap / FSB_ALLOWOVERFLOW
Reply With Quote #2

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.
__________________

Last edited by Arkshine; 09-14-2015 at 06:48.
Arkshine is offline
Phant
Veteran Member
Join Date: Sep 2009
Location: New Jersey
Old 09-14-2015 , 06:51   Re: CS TeamSwap / FSB_ALLOWOVERFLOW
Reply With Quote #3

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)
    }

Phant is offline
Send a message via ICQ to Phant
wickedd
Veteran Member
Join Date: Nov 2009
Old 09-14-2015 , 07:04   Re: CS TeamSwap / FSB_ALLOWOVERFLOW
Reply With Quote #4

Check this out
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd 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 17:31.


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