AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Host_Error problem (https://forums.alliedmods.net/showthread.php?t=188891)

Diegorkable 07-01-2012 12:11

Host_Error problem
 
Hey guys,

do any of you know what that is?

Code:

Host_Error: UserMsg: Not Present on Client 255

ConnorMcLeod 07-01-2012 12:44

Re: Host_Error problem
 
Nosteam ?

Diegorkable 07-01-2012 12:55

Re: Host_Error problem
 
Quote:

Originally Posted by ConnorMcLeod (Post 1740467)
Nosteam ?

Nope, it happens since the last auto-mix update. I tried to test my auto-mix new version on my server and it happens at these 3 functions:

PHP Code:

public RandomCpt() {
    
set_pcvar_num(cvar_mp_freezetime9999)
    new 
players[32], pnumtempid;
    
get_players(playerspnum"ch");
    new 
specialCount

    
for( new ii<pnumi++ ) {
        
tempid players[i];
        
client_cmd(tempid"kill")
        
        if ( 
cs_get_user_team(tempid) != CS_TEAM_UNASSIGNED )
        {
            
specialCount++
            
cs_set_user_team(tempidCS_TEAM_SPECTATOR)
        } 
            
    }
    
log_amx("RandomCpt stage 1")
    
    if (
specialCount 2) {
        if (
g_CustomGame) {
            
client_print(0print_chat"%s %L"PREFIXLANG_PLAYER"LESS_PLAYERS_CUSTOM")
            new 
taskId scanForTaskID()
            
set_task(3.0"RandomTeams"taskId)
        }
        
        else {
            
client_print(0print_chat"%s %L"PREFIXLANG_PLAYER"LESS_PLAYERS")
            new 
taskId scanForTaskID()
            
set_task(5.0"EndMatch"taskId)
        }
        return;
    }
    
log_amx("RandomCpt stage 2")
        
    new 
random(pnum)
    while (
cs_get_user_team(players[z]) == CS_TEAM_UNASSIGNED)
        
random(pnum)
    
cs_set_user_team(players[z], CS_TEAM_T)
    
gCptT players[z]
    
    new 
random(pnum)
    while ( (
== z) || cs_get_user_team(players[q]) == CS_TEAM_UNASSIGNED )
        
random(pnum)
        
    
log_amx("RandomCpt stage 3")
    
cs_set_user_team(players[q], CS_TEAM_CT
    
gCptCT players[q]
    
client_print(0print_chat"%s %L"PREFIXLANG_PLAYER"RANDOM_CAPTAINS_CHOSEN")
    
client_print(0print_chat"%s %L"PREFIXLANG_PLAYER"TERROR_CAPTAIN_FIRST")
    
g_bCpt true
    log_amx
("RandomCpt stage 4")
    
moveT()
    return;
}

public 
moveT() {
    
log_amx("moveT stage 1")
    
TeamsInfo()
    
log_amx("moveT stage 2")
    new 
title[64]
    
formatex(titlecharsmax(title), "%L"LANG_PLAYER"CHOOSE_PLAYER")
    
g_PlayersMenu menu_create(title"moveT_menu"); 
    new 
players[32], pnumtempid;
    new 
Tplayers[32], Tpnum;
    new 
szName[32], szTempid[10]; 
    new 
pickisdonecheck
    get_players
(playerspnum"ch"); 
    
get_players(TplayersTpnum"che""TERRORIST");
    
log_amx("moveT stage 3")
        
    for( new 
ii<pnumi++ ) 
    { 
        
tempid players[i];
        
        if ((
tempid == gCptT) || (tempid == gCptCT))
            
check++
        
        if (
cs_get_user_team(tempid) == CS_TEAM_UNASSIGNED)
            continue;
        
        else if (
cs_get_user_team(tempid) == CS_TEAM_SPECTATOR) {
            
get_user_name(tempidszName31); 
            
num_to_str(tempidszTempid9); 
            
menu_additem(g_PlayersMenuszNameszTempid);
            
pickisdone++
        }
    } 
    
    
log_amx("moveT stage 4")
    if (
check != 2) {
        
client_print(0print_chat"%s %L"PREFIXLANG_PLAYER"CAPTAINS_DISCONNECTED")
        
g_bCpt false
        removeAllTasks
()
        new 
taskId scanForTaskID()
        
set_task(3.0"RandomTeams"taskId)
        return 
PLUGIN_HANDLED
    
}
    
    if (
pickisdone == 0) {
        
client_print(0print_chat"%s %L"PREFIXLANG_PLAYER"TEAMS_ARE_SET")
        
g_bCpt false
        removeAllTasks
()
        new 
taskId scanForTaskID()
        
set_task(10.0"StartMatch"taskId)
        return 
PLUGIN_HANDLED
    
}
    
    if (
Tpnum >= get_pcvar_num(cvar_pLeft)/) {
        
client_print(0print_chat"%s %L"PREFIXLANG_PLAYER"TERROR_TEAM_FULL")
        
moveCT()
        return 
PLUGIN_HANDLED
    
}
    
    
log_amx("moveT stage 5")
 
    
menu_display(gCptTg_PlayersMenu)
    
set_task(25.0"kickhimout"gCptT)
    
log_amx("moveT stage 6")
    return 
PLUGIN_HANDLED
}

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", ( 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


Maybe its the ML here? I dont know, here are the translations: http://forums.alliedmods.net/showthread.php?t=188880

When the function 'RandomCpt' gets triggered everyone gets that and are being kicked.

dFF 07-01-2012 13:06

Re: Host_Error problem
 
After
PHP Code:

get_players(playerspnum"ch"); 

add
PHP Code:

if(!pnum) return; 

after
PHP Code:

tempid players[i]; 

add:
PHP Code:

if( !is_user_connected(tempid) ) continue; 

and this
PHP Code:

set_task(3.0"RandomTeams"taskId
...
set_task(5.0"EndMatch"taskId

can be changed with:
PHP Code:

if(taskIdset_task(3.0"RandomTeams"taskId
...
if(
taskIdset_task(5.0"EndMatch"taskId

Also when cs_get_user_team called you should check if player (id->new z = random(pnum)) is connected.

Diegorkable 07-01-2012 13:12

Re: Host_Error problem
 
The reason I dont check if is_user_connected is because get_players brings to you the connected players already.
and why should I do 'if ( taskId)', what do I check here...? if taskId differents then 0.. scanForTaskID() brings a taskID in a range that is most likely not used by other plugins, such a big range that no way it wouldnt find one.

Anyway, im sure that its not the cause of the crash.

fysiks 07-01-2012 21:29

Re: Host_Error problem
 
edit button . . .

YamiKaitou 07-01-2012 23:28

Re: Host_Error problem
 
Format the string correctly, then test.


Also, as fysiks stated, use the Edit button, it is there for a reason

Diegorkable 07-02-2012 03:35

Re: Host_Error problem
 
Quote:

Originally Posted by YamiKaitou (Post 1740895)
Format the string correctly, then test.


Also, as fysiks stated, use the Edit button, it is there for a reason

No, there is no reason for the edit button to be there, but for the fysiks to be there, it's just a button to let fysiks have something to post in threads from time to time :)

And it's k no need for instructions, I said I fixed it. I forgot to add LANG_PLAYER.

ConnorMcLeod 07-02-2012 03:55

Re: Host_Error problem
 
Rules apply to everyone, even for you Mr. Diegorkable.
Locked for 15 days, don't try to open a similar thread, thanks.


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

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