AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Mysterious error messages (https://forums.alliedmods.net/showthread.php?t=117671)

Leon M. 02-03-2010 11:23

Mysterious error messages
 
Hi,

I have searched already but didn't found anything about my problem. I would like to check spectators and kick them after a defined time.

If I use cs_get_user_team then I get some errors like "invalid player". What's wrong with my code?

Code:

        // Alle Spieler überprüfen
        for (new id = 1; id <= g_iMaxPlayers; id++){

            new CsTeams:eTeam = cs_get_user_team(id)
            if (eTeam == CS_TEAM_SPECTATOR || eTeam == CS_TEAM_UNASSIGNED){

                g_iTime[id]++

                if (g_iTime[id] >= 10){
                    func_kick_player(id)
                }
            }

I have also tried to use only get_user_team and check for 0 but that won't work if a player transferred by cs_set_user_team. Is there a secured function to catch the team? Like an offset?

Thanks a lot for your help!

Exolent[jNr] 02-03-2010 11:25

Re: Mysterious error messages
 
You must check is_user_connected() or is_user_alive().

Leon M. 02-03-2010 13:13

Re: Mysterious error messages
 
Thanks for reply :)

is_user_connected doesn't work for some reasons, and is_user_alive should not work for specs.

minimiller 02-03-2010 13:18

Re: Mysterious error messages
 
check !is_user_alive =]

Exolent[jNr] 02-03-2010 13:27

Re: Mysterious error messages
 
Code:
new CsTeams:eTeam for (new id = 1; id <= g_iMaxPlayers; id++){     if (is_user_connected(id)){         eTeam = cs_get_user_team(id)         if (eTeam == CS_TEAM_SPECTATOR || eTeam == CS_TEAM_UNASSIGNED){             g_iTime[id]++                         if(g_iTime[id] >= 10){                 func_kick_player(id)             }         }     } }

Leon M. 02-03-2010 14:02

Re: Mysterious error messages
 
I know how to add this check but it is not working :( I think I check this better tomorrow. At the moment I overlooking something.

Thanks :)


All times are GMT -4. The time now is 07:24.

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