-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.lua
43 lines (39 loc) · 1.46 KB
/
main.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
--=================================================================
-- Guest Control - Giving you the control over your guests.
-- By Titch
--=================================================================
-- Configuration
--=================================================================
-- Setting = Value (true/false)
--=================================================================
local AllowGuests = true
local AllowGuestChat = false
--=================================================================
-- DO NOT TOUCH BEYOND THIS POINT
--=================================================================
local function dump(o)
if type(o) == 'table' then
local s = '{ '
for k,v in pairs(o) do
if type(k) ~= 'number' then k = '"'..k..'"' end
s = s .. '['..k..'] = ' .. dump(v) .. ','
end
return s .. '} '
else
return tostring(o)
end
end
function onChatMessage(id, name, message)
local identifiers = GetPlayerIdentifiers(id)
if identifiers == nil and not AllowGuestChat then -- the nil means they are a guest
SendChatMessage(id, "Sorry chat is disabled for guest players on this server. Please register for a BeamMP Account to use the Chat functionality.")
return 1
end
end
function onPlayerAuth(name, role, isGuest)
if isGuest and not AllowGuests then
return "You must be signed in to join this server!"
end
end
RegisterEvent("onPlayerAuth","onPlayerAuth")
RegisterEvent("onChatMessage","onChatMessage")