AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need to know which factors blocks team joining (https://forums.alliedmods.net/showthread.php?t=188813)

meTaLiCroSS 06-30-2012 16:27

Need to know which factors blocks team joining
 
Well, with orpheu (editing Arkshine's Infinite Round plugin) I've done a way for blocking round ends, and made my own round end conditions, for Zombie Plague.

With this I was thinking on: filling the CT team on round starting, and move one CT to T (first zombie infection) without "triggering the Game Commencing event".

I'm using a custom joining menu, overriding the default's team choosing menues. For forcing a player to join to the team (by default it chooses a random team because on ZP we don't care about the joining team on round starting) which uses Jailbreak's joining method

PHP Code:

public team_join(idCsTeams:team)
{
    static 
restorevguimsgblock

    restore 
get_pdata_int(idm_iVGUI)
    
vgui restore & (1<<0)
    if(
vgui)
        
set_pdata_int(idm_iVGUIrestore & ~(1<<0))

    switch(
team)
    {
        case 
CS_TEAM_SPECTATOR:
        {
            
msgblock get_msg_block(g_MsgShowMenu)
            
set_msg_block(g_MsgShowMenuBLOCK_ONCE)
            
dllfunc(DLLFunc_ClientPutInServerid)
            
set_msg_block(g_MsgShowMenumsgblock)
            
set_pdata_int(idm_fGameHUDInitialized1)
            
engclient_cmd(id"jointeam""6")
        }
        case 
CS_TEAM_TCS_TEAM_CT:
        {
            
msgblock get_msg_block(g_MsgShowMenu)
            
set_msg_block(g_MsgShowMenuBLOCK_ONCE)
            
engclient_cmd(id"jointeam", (team == CS_TEAM_CT) ? "2" "1")
            
engclient_cmd(id"joinclass""1")
            
set_msg_block(g_MsgShowMenumsgblock)
            
g_PlayerSpect[id] = 0
        
}
    }
    
    if(
vgui)
        
set_pdata_int(idm_iVGUIrestore)


(my code it's not exactly as the previous code, it's a little bit edited, with many things, forget it)

That works fine, and it worked better with this fix: http://forums.alliedmods.net/showpos...00&postcount=4

There is another thing that maybe can disallow a player from joining to the CT team? It's a 32 slots server, and I don't know if everyone can join to the same team on every map, and I don't have the probided people for testing this... I was thinking on info_player_start entities if they are less of 32, or something, would be nice if someone provides some information, or better, decode the joining team function from the engine, anyway would be a good contribution :D

joropito 06-30-2012 17:46

Re: Need to know which factors blocks team joining
 
For team balance there's 2 offsets of CHalfLifeMultiplay object with total spawn points for each team.
That's calculated once at map load. Even if you change info_player_* classnames, you should modify this values.

There's no specific function for team join. There's a "think" call for CHalfLifeMultiplay and for the player then some checks are done regarding current m_iJoiningState (an offset of the player entity) and it last menu opened. Then the program put the player in the team selected.

Best way is to put players as spectators in the correct moment, avoiding them to select team (blocking some commands). Then at spectator make a control to check if it has selected (or joined) a team or not for first time.

You can check offsets at wiki for CBasePlayer. For CHalfLifeMultiplay you can check my CS/CZ Ida Suite at http://forums.alliedmods.net/showthread.php?t=185936


EDIT:

Maybe there's a simple way, not tested.

- At precache + KeyValue, rename classnames for CT spawnpoints to TT spawnpoints, then you will get that only TT can join.
- After precache, create CT spawnpoints
- During the game, move players from TT to CT as needed
- You have to check what happends with team balance. Maybe everyone will go to TT, not tested of course.

meTaLiCroSS 07-01-2012 01:41

Re: Need to know which factors blocks team joining
 
Thanks for the info! Connor showed me a code in which alterates that offset with a custom value, then declaring to true another var, these 2 are >m_bSpawnsCounted and m_iCtSpawnsNum, I only need to get these 2 values for editing it by using Orpheu on my plugin, but I cant get them because I don't have the IDA Pro software x_x (also the m_iTSpawnsNum offset would be useful to know)

Anybody can provide these offsets? It would be apreciated :(

hornet 07-01-2012 02:20

Re: Need to know which factors blocks team joining
 
The offsets are:
Code:

int              m_iTeSpawnsNum;                          // 23
int              m_iCtSpawnsNum;                          // 24
bool            m_bSpawnsCounted;                        // 40


meTaLiCroSS 07-01-2012 03:10

Re: Need to know which factors blocks team joining
 
Quote:

Originally Posted by hornet (Post 1740202)
The offsets are:
Code:

int              m_iTeSpawnsNum;                          // 23
int              m_iCtSpawnsNum;                          // 24
bool            m_bSpawnsCounted;                        // 40


Linux/Windows? (for knowing which one should +/- 8)

hornet 07-01-2012 03:41

Re: Need to know which factors blocks team joining
 
Well, however, if I understand correctly, you shouldn't actually need the offsets. You insert the offset name into Orpheu memory, and don't require a linux difference.

meTaLiCroSS 07-01-2012 03:44

Re: Need to know which factors blocks team joining
 
Quote:

Originally Posted by hornet (Post 1740232)
Well, however, if I understand correctly, you shouldn't actually need the offsets. You insert the offset name into Orpheu memory, and don't require a linux difference.

Code:

    {
        "name"        : "m_iCtSpawnsNum",
        "type"        : "int",
        "memoryType"  : "data",
        "identifiers" :
        [
            {
                "os"    : "windows",
                "mod"  : "cstrike",
                "value" : hello i'm missed
            },
            {
                "os"    : "linux",
                "mod"  : "cstrike",
                "value" : hello i'm missed too
            }
        ]
    }

That's why i've asked that :/

ConnorMcLeod 07-01-2012 03:53

Re: Need to know which factors blocks team joining
 
Actually m_bSpawnsCounted is a real bool si it's linux 160 and windows 168
For the other ones, it's windows + 2 ( i don't remember, but you may have to use the char based offset so you would to do *4 as well for integers).
See arkshine's orpheu plugin, he is using similar offsets.

hornet 07-01-2012 03:56

Re: Need to know which factors blocks team joining
 
Quote:

Originally Posted by ConnorMcLeod (Post 1740236)
Actually m_bSpawnsCounted is a real bool si it's linux 160 and windows 168
For the other ones, it's windows + 2 ( i don't remember, but you may have to use the char based offset so you would to do *4 as well for integers).
See arkshine's orpheu plugin, he is using similar offsets.

Yeah that's where I've learned from - Arkshine's plugins. I never saw anything OS related in there. I was under the impression that Orpheu sorted that part out itself.

ConnorMcLeod 07-01-2012 04:02

Re: Need to know which factors blocks team joining
 
OS part is in files that are parsed at map start, not in plugin sources.


All times are GMT -4. The time now is 15:24.

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