-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkick.lua
33 lines (32 loc) · 2.24 KB
/
kick.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
function checkKick(msg)
if chatFuncCheck("!kick",msg) then
local gid = getElementData(source,"gid")
if ifPlayerHaveFlag(gid,"kick") then
local id = string.gsub(msg, "!kick ","")
local without = strw_to_table(id)
if without[1] ~= nil and tonumber(without[1])~=nil then
local player = getOnlinePlayerByGID(without[1])
local reason = string.gsub(id,without[1].." ","")
if reason==id then reason='No reason' end
if player then
if not ifPlayerHaveImmunity(id,"a") and compareAccLevels(getElementData(source,'character'),getElementData(player,'character')) then
local charData = getPlayerCharacterData(getElementData(player,"character"))
local kickingData = getPlayerCharacterData(getElementData(source,"character"))
outputChatBox("#ff0000Вы кикнули игрока "..charData['name'].." "..charData['surname'].."("..getElementData(player,"nickname")..")",source,255,255,255,true)
outputDebugString(charData['name'].." "..charData['surname'].."("..getElementData(player,"nickname")..") kicked by "..kickingData['name'].." "..kickingData['surname'].."("..getElementData(source,"nickname").."). Reason: "..reason)
kickPlayer(player,"Kicked by "..kickingData['name'].." "..kickingData['surname'].."("..getElementData(source,"nickname").."): "..reason)
else
outputChatBox("#ff0000Вы не можете кикнуть этого игрока.",source,255,255,255,true)
end
else
outputChatBox("#ff0000Этого игрока не существует или его нет на сервере.",source,255,255,255,true)
end
else
outputChatBox("#ff0000Неверный формат команды: !kick [gID] [reason]",source,255,255,255,true)
end
else
outputChatBox("#ff0000У вас нет прав на использование этой команды.",source,255,255,255,true)
end
end
end
addEventHandler("onPlayerChat",getRootElement(),checkKick)