AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   host_error: issues (https://forums.alliedmods.net/showthread.php?t=155213)

killergirl 04-18-2011 16:58

host_error: issues
 
Can someone tell me when or how this error occurs?

Host_Error: WriteDest_Parm: not a client

I already set in the top of the function:

PHP Code:

if(!is_user_bot(index) && is_user_connected(index)) 

but no luck, the server still crashes

Arkshine 04-18-2011 17:01

Re: host_error: issues
 
Show more code, but it's generally an invalid index ( 0 or > maxclients ) is passed into message_begin() with MSG_ONE/UNRELIABLE.

killergirl 04-18-2011 17:07

Re: host_error: issues
 
PHP Code:

public sendMessage (color[], alive)
{
    new 
teamName[10]
    
    for (new 
player 1player maxPlayersplayer++)
    {
        if(!
is_user_bot(player))
        {
            if(
is_user_connected(player))
            {
                
get_user_team (playerteamName9)    // Stores user's team name to change back after sending the message
                            
                
changeTeamInfo (playercolor)        // Changes user's team according to color choosen
                            
                
writeMessage (playermessage)        // Writes the message on player's chat
                            
                
changeTeamInfo (playerteamName)    // Changes user's team back to original
            
}
        }
    }


PHP Code:

public sendTeamMessage (color[], aliveplayerTeam)
{
    new 
teamName[10]
    
    for (new 
player 1player maxPlayersplayer++)
    {
        if(!
is_user_bot(player))
        {
            if (
get_user_team(player) == playerTeam)
            {
                if(
is_user_connected(player))
                {
                    
get_user_team (playerteamName9)    // Stores user's team name to change back after sending the message
                                
                    
changeTeamInfo (playercolor)        // Changes user's team according to color choosen
                                
                    
writeMessage (playermessage)        // Writes the message on player's chat
                                
                    
changeTeamInfo (playerteamName)    // Changes user's team back to original
                
}
            }
        }
    }


PHP Code:

public changeTeamInfo (playerteam[])
{
    if(
is_user_connected(player))
    {
        if(!
is_user_bot(player))
        {
            
message_begin (MSG_ONEteamInfo_player)    // Tells to to modify teamInfo (Which is responsable for which time player is)
            
write_byte (player)                // Write byte needed
            
write_string (team)                // Changes player's team
            
message_end()
        }
    }
}


public 
writeMessage (playermessage[])
{
    if(
is_user_connected(player))
    {
        if(!
is_user_bot(player))
        {
            
message_begin (MSG_ONEsayText, {000}, player)    // Tells to modify sayText (Which is responsable for writing colored messages)
            
write_byte (player)                    // Write byte needed
            
write_string (message)                    // Effectively write the message, finally, afterall
            
message_end ()                        // Needed as always
        
}
    }



JocAnis 04-19-2011 16:03

Re: host_error: issues
 
i think problem is:
PHP Code:

for (new player 1player maxPlayersplayer++) 

try with:
PHP Code:

for (new player 1player <= maxPlayersplayer++) 

or
PHP Code:

for (new player 0player maxPlayersplayer++) 


drekes 04-19-2011 17:10

Re: host_error: issues
 
Quote:

Originally Posted by JocAnis (Post 1453743)
PHP Code:

for (new player 1player <= maxPlayersplayer++) 


This one is the only right one.

For this one
PHP Code:

for(new player 0player maxPlayerplayer++) 

You should use get_players()

killergirl 04-19-2011 17:55

Re: host_error: issues
 
Thank you for helping me, I already tried to get all players than loop but the problem was something else. In another function I tried to hook death, check for killer weapon than do something.


All times are GMT -4. The time now is 20:09.

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