AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need Help in Function Clarification [Auto PUG] (https://forums.alliedmods.net/showthread.php?t=224956)

devilicioux 08-30-2013 07:16

Need Help in Function Clarification [Auto PUG]
 
The problem i am getting is

PHP Code:

ShowSyncHudMsg(0g_MsgSync2"%L"LANG_PLAYER"CAPTAINS_DISCONNECTED_HUD"

This call gets executed even when player chosen as Captain is connected.What i am not able to undertand is what variable toapprove stores ? and how this function is working.8/10 Times the function executes and shows captain disconnected and random teams are set.Can anyone help me out understanding or solving the issue ?

PHP Code:

public TeamsInfo() {
    
//log_amx("TeamsInfo stage 1")
    
if (g_bCpt) {
        
//log_amx("TeamsInfo stage 2")
        
new nameCT[70], nameT[70]
        new 
infoT[500]
        new 
infoCT[500]
        new 
players[32], pnumtempid;
        new 
toapprove
        
        get_players
(playerspnum"ch")
        
get_user_name(gCptTnameT69)
        
get_user_name(gCptCTnameCT69)
        
formatex(infoT499"%L^n-------------^n%L^n^n"LANG_PLAYER, ( get_pcvar_num(cvar_TeamTag) ? "TEAM_A" "TERRORISTS" ), LANG_PLAYER"TEAM_INFO_CAPTAINS"nameT)
        
formatex(infoCT499"%L^n-------------^n%L^n^n"LANG_PLAYER, ( get_pcvar_num(cvar_TeamTag) ? "TEAM_B" "COUNTER_TERRORISTS" ), LANG_PLAYER"TEAM_INFO_CAPTAINS"nameCT)
        
log_amx("TeamsInfo stage 3")
        
        for (new 
pnum i++)
        {
            
tempid players[i]
            
            if ((
cs_get_user_team(tempid) == CS_TEAM_T) && (tempid != gCptT))
            {
                new 
nameofp[70]
                
                
get_user_name(tempidnameofp69)
                
add(infoT499nameofp)
                
add(infoT499"^n")
            }
            
            else if ((
cs_get_user_team(tempid) == CS_TEAM_CT) && (tempid != gCptCT))
            {
                new 
nameofCTp[70]
                
                
get_user_name(tempidnameofCTp69)
                
add(infoCT499nameofCTp)
                
add(infoCT499"^n")
            }
            
            if ((
cs_get_user_team(tempid) == CS_TEAM_T) && (tempid == gCptT))
                
toapprove++
            
            else if ((
cs_get_user_team(tempid) == CS_TEAM_CT) && (tempid == gCptCT))
            {
                
toapprove++
            }
        }
        
        if (
toapprove != 2) {
            
set_hudmessage(255000.400.3206.012.0)
            
ShowSyncHudMsg(0g_MsgSync2"%L"LANG_PLAYER"CAPTAINS_DISCONNECTED_HUD")
            new 
taskId scanForTaskID()
            
set_task(5.0"RandomTeams"taskId)
            return 
PLUGIN_HANDLED
        
}
        
        
set_hudmessage(271622290.280.3206.01.0)
        
ShowSyncHudMsg(0g_MsgSync8infoT)
        
log_amx("TeamsInfo stage 4")
        
        
set_hudmessage(271622290.580.3206.01.0)
        
ShowSyncHudMsg(0g_MsgSync2infoCT)
        new 
taskId scanForTaskID()
        
set_task(1.0"TeamsInfo"taskId)
    }
    
    else
    {
        
set_hudmessage(025500.400.3206.012.0)
        
ShowSyncHudMsg(0g_MsgSync2"%L"LANG_PLAYER"TEAMS_ARE_SET_HUD")
        return 
PLUGIN_CONTINUE
    
}
    
    return 
PLUGIN_CONTINUE




All times are GMT -4. The time now is 19:11.

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