Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.65 KB | None | 0 0
  1. local playerCount = 0
  2. local list = {}
  3.  
  4. RegisterServerEvent('hardcap:playerActivated')
  5.  
  6. AddEventHandler('hardcap:playerActivated', function()
  7.   if not list[source] then
  8.     playerCount = playerCount + 1
  9.     list[source] = true
  10.   end
  11. end)
  12.  
  13. AddEventHandler('playerDropped', function()
  14.   if list[source] then
  15.     playerCount = playerCount - 1
  16.     list[source] = nil
  17.   end
  18. end)
  19.  
  20. AddEventHandler('playerConnecting', function(name, setReason)
  21.   print('Connecting: ' .. name)
  22.  
  23.   if playerCount >= 32 and name ~= "Havanna ElLama" then
  24.     print('Full. :(')
  25.  
  26.     setReason('This server is full (past 32 players).')
  27.     CancelEvent()
  28.   end
  29. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement