View Single Post
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 02-09-2012 , 00:28   Re: Module: CS Team Changer [avoids crashes in aggressive changes]
Reply With Quote #19

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.

Last edited by yokomo; 02-09-2012 at 00:30.
yokomo is offline