AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   32 slots Team swap (https://forums.alliedmods.net/showthread.php?t=128270)

joropito 05-30-2010 14:14

32 slots Team swap
 
I'm having problems with 32 slots team swap.

Actually I'm getting overflow error (with server crash) when I try to swap teams in a full 32 slot server.

I found that with 20 slots works fine but if I increase the number of players, I get crashes.

I know it's related with too many reliable messages.
I've tried to hook messages to change MSG_ONE to MSG_BROADCAST with the following hook but still getting same error.

PHP Code:

public fwd_messagebegin(msg_destmsg_typeorigin[3], ent)
{
      if(
msg_type != gmsgTeamInfo)
            return 
FMRES_IGNORED

      
if(msg_dest == MSG_ALL)
      {
            
message_begin(MSG_BROADCASTmsg_typeoriginent)
            return 
FMRES_SUPERCEDE
      
}
      return 
FMRES_IGNORED


I've tested to change team using only m_iTeam (offset 114) and let CS change team at round start but still the same. Only with no more than 20 players works fine.

Someone have any clue to solve this?

infek 05-30-2010 14:20

Re: 32 slots Team swap
 
Dont you need message_end

joropito 05-30-2010 15:07

Re: 32 slots Team swap
 
Quote:

Originally Posted by infek (Post 1195460)
Dont you need message_end

No, because I'm hooking online message_begin.

Btw, that is one of the ways I've tried to avoid this problem.

I can remove this hook and the problem will still exists.

DruGzOG 05-30-2010 15:49

Re: 32 slots Team swap
 
PHP Code:

#include <amxmodx>
#include <fakemeta>

new const VERSION[] = "0.0.1"

const MAX_PLAYERS 32

const XTRA_OFS_PLAYERS 5
const OFFSET_TEAM 114

const TEAM_T 1
const TEAM_CT 2

public plugin_init()
{
    
register_plugin("ZBB Swap Teams"VERSION"Swap Team (LULZ)")

    
register_logevent("Logevent_Round_End"2"1=Round_End")
}

public 
Logevent_Round_End()
{
    new 
iPlayers[MAX_PLAYERS], iNumid
    get_players
(iPlayersiNum"h")
    for(new 
ii<iNumi++)
    {
        
id iPlayers[i]
        switch( 
get_pdata_int(idOFFSET_TEAMXTRA_OFS_PLAYERS) )
        {
            case 
TEAM_T:
            {
                
set_pdata_int(idOFFSET_TEAMTEAM_CTXTRA_OFS_PLAYERS)
            }
            case 
TEAM_CT:
            {
                
set_pdata_int(idOFFSET_TEAMTEAM_TXTRA_OFS_PLAYERS)
            }
        }
    }


That's what I've been using for the past 3 years for a certain mod.

joropito 05-30-2010 20:25

Re: 32 slots Team swap
 
I'm doing the same way DruGzOG

Now I guess the problem is I'm doing a lot of things at spawnpost (set score, deaths, health, gravity, render and more) and it's like a flood...


All times are GMT -4. The time now is 05:22.

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