AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Module Coding (https://forums.alliedmods.net/forumdisplay.php?f=9)
-   -   Module: CS Team Changer Ultimate [avoids crashes in aggressive changes] (https://forums.alliedmods.net/showthread.php?t=163555)

Arkshine 08-02-2011 12:58

Re: Module: CS Team Changer [avoid crashes in aggressive changes]
 
Quote:

Mister fysiks, I just said that Arkshine opened the source, wrote something in it and closed. Why did you think he made all the code? Am I supposed to say what exactly he wrote in the source? And am I supposed to hide that he helped me with some code?
It's true the word may not the best, because rewritten would mean here I have redone the whole module myself, and that's not the case. Just fast optimization, cleaning up. :P

Quote:

How to fix the problem with 'get_user_team' while the big plugins are using set_pdata_int?
See the issue about get_players on the bug tracker. I've attached a patch which updates the AMXX team's id in TeamInfo message.

Quote:

can you explain what does "FYI" mean
For Your Information, it means. :)
FYI, the answer can be found fastly on google. :mrgreen:

Destro- 08-12-2011 21:06

Re: Module: CS Team Changer [avoid crashes in aggressive changes]
 
Hello.

I do not know a lot of modules, you should not check if the player is valid?.

pd:the delay is to use emessage.

pd2:Sorry for my English.

claudiuhks 08-13-2011 08:20

Re: Module: CS Team Changer [avoid crashes in aggressive changes]
 
PHP Code:

/* These are the same as above, except that the messages sent
 *  are also sent to all other plugins and Metamod plugins.
 * This means that if you send one of these messages, other plugins will
 *  be notified, which was previously impossible.  
 * BE CAREFUL! Using these incorrectly, or not for their intended purpose,
 *  could cause infinite recursion or something just as bad. 
 * NOTE! These natives are experimental.
 */
native emessage_begin(destmsg_type, const origin[3] = {0,0,0}, player 0);
native emessage_end();
native ewrite_byte(x);
native ewrite_char(x);
native ewrite_short(x);
native ewrite_long(x);
native ewrite_entity(x);
native ewrite_angle(x);
native ewrite_coord(x);
native ewrite_string(const x[]); 

The player validity check is optional. The AmxModX scripters would like to check the validity in their AmxModX plugins!

The emessage_begin and message_begin are doing approximately the same thing...

Destro- 08-13-2011 11:33

Re: Module: CS Team Changer [avoid crashes in aggressive changes]
 
I know.
The zp use emessage + delay for to work register_message,but not necessary.

Sorry for my English use a translator.

Owyn 08-17-2011 07:48

Re: Module: CS Team Changer [avoid crashes in aggressive changes]
 
Quote:

This works perfectly with 32 players (tested)
could you do the same but on the ES_ map? :)

i mean would this fix fix agressive team changing crash on counter-strike es_* maps?

claudiuhks 11-27-2011 12:41

Re: Module: CS Team Changer [avoid crashes in aggressive changes]
 
I can't say that it fix something for avoid the crashing, but, if you are thinking to change the player's team by using the CStrike extension, it will be trying to change the player's model, that is the reason why the server get crashed.

This extension, CS Team Changer, won't change any player physical information or any value, it will just update the tablescore, the API's team index and the team offset.

I make sure it won't crash the server by changing the team at 32 players in same time.

yokomo 02-06-2012 07:33

Re: Module: CS Team Changer [avoids crashes in aggressive changes]
 
Tested with 31 players (30bots 1human) in Zombie Plague Mod server, it give wrong team set in scoreboard when i set into Survivor round (change 31 player's team in a second).

To solve this we must add delay in team update (just like Mercylezz do in his ZP).

claudiuhks 02-08-2012 14:58

Re: Module: CS Team Changer [avoids crashes in aggressive changes]
 
PHP Code:

static iSurvivoriPlayers32 ], iNumi;
iSurvivor GetRandomAlive( );
get_playersiPlayersiNum"a" );

for( 
0iNumi++ )
  if( 
iPlayers] != iSurvivor MakeZombieiPlayers] );

MakeSurvivoriSurvivor );



GetRandomAlive( )
{
  static 
iPlayers32 ], iNum;
  
get_playersiPlayersiNum"a" );

  return 
iPlayersrandom_num0iNum ) ];


It's impossible to give a bad result...

yokomo 02-09-2012 00:28

Re: Module: CS Team Changer [avoids crashes in aggressive changes]
 
That was your own code, not from ZP4.3. Please take a look at this.
On function humanme:
PHP Code:

// Function Human Me (player id, turn into a survivor, silent mode)
humanme(idsurvivorsilentmode

Look at:
PHP Code:

    // Switch to CT
    
if (fm_cs_get_user_team(id) != FM_CS_TEAM_CT// need to change team?
    
{
        
remove_task(id+TASK_TEAM)
        
fm_cs_set_user_team(idFM_CS_TEAM_CT)
        
//fm_user_team_update(id)
    


It only give wrong result when i comment on "fm_user_team_update(id)"

My fm_cs_set_user_team stock:
PHP Code:

// Set a Player's Team
fm_cs_set_user_team(idteam)
{    
    
//set_pdata_int(id, OFFSET_CSTEAMS, team, OFFSET_LINUX)
    
cs_set_team(idteam)


My fm_user_team_update stock:
PHP Code:

// Update Player's Team on all clients (adding needed delays)
fm_user_team_update(id)
{
    static 
Float:current_time
    current_time 
get_gametime()
    
    if (
current_time g_teams_targettime >= 0.1)
    {
        
set_task(0.1"fm_cs_set_user_team_msg"id+TASK_TEAM)
        
g_teams_targettime current_time 0.1
    
}
    else
    {
        
set_task((g_teams_targettime 0.1) - current_time"fm_cs_set_user_team_msg"id+TASK_TEAM)
        
g_teams_targettime g_teams_targettime 0.1
    
}
}

// Send User Team Message
public fm_cs_set_user_team_msg(taskid)
{
    
// Note to self: this next message can now be received by other plugins
    
    // Set the switching team flag
    
g_switchingteam true
    
    
// Tell everyone my new team
    
cs_set_team_tablescore(ID_TEAMfm_cs_get_user_team(ID_TEAM))
    
    
// Done switching team
    
g_switchingteam false


Thats mean we still need to add delay at least 0.1 for team update on scoreboard.

claudiuhks 02-09-2012 12:08

Re: Module: CS Team Changer [avoids crashes in aggressive changes]
 
The Zombie Plague modification by me was wrong, so, it not needs any delay for this extension.

To edit Zombie Plague without delay takes so long.

Sorry for inconvenience :cry:.


All times are GMT -4. The time now is 10:29.

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