• Print

Author Topic: Need help with this code (Whitelist Kicker)  (Read 4178 times)

0 Members and 1 Guest are viewing this topic.

Offline DarkMaper

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
Need help with this code (Whitelist Kicker)
« on: September 02, 2014, 06:34:34 pm »
I don't know if this goes here.

Good guys, I need help with this code I modified myself. The original code is this:

Code: Lua
  1. local whitelist = { "SteamID1", "SteamID2" } -- add your steam id's here
  2.  
  3. function CheckWhiteList( ply )
  4.         if not ULib.findInTable( whitelist, ply ) then
  5.                 ULib.kick( ply )
  6.         end
  7. end
  8. hook.Add( "PlayerInitialSpawn", "WhitelistCheck", CheckWhiteList )

I modified the code so that only leaked to those in certain group:

Code: Lua
  1. function CheckWhiteList( ply )
  2.         if
  3.         not ply:CheckGroup("vip") or
  4.         not ply:CheckGroup("guia") or
  5.         not ply:IsAdmin()
  6.         then
  7.                 ULib.kick ( ply )
  8.         end
  9. end
  10. hook.Add( "PlayerInitialSpawn", "WhitelistCheck", CheckWhiteList )

And my problem is... The code down the server when kick someone.
If you can help me with this. And sorry for my bad english.

P.D: My server show this error:

Code: [Select]
[ERROR] gamemodes/base/gamemode/player.lua:213: Tried to use a NULL entity!
1. SetTeam - [C]:-1
2. PlayerInitialSpawn - gamemodes/base/gamemode/player.lua:213
3 unkown - gamemodes/sandbox/gamemode/init.lua:121

I found a simpler way, and adding my groups to "ULX reservedslots". Close post pls.
« Last Edit: September 02, 2014, 08:41:07 pm by DarkMaper »

  • Print