Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function CreateCK()
- if not fileExists(":RPGU_CK/CK.txt") then
- local newfile = fileCreate(":RPGU_CK/CK.txt")
- fileClose(newfile)
- end
- end
- addEventHandler("onResourceStart", getRootElement(), CreateCK)
- function checkPlayer(playerElementOrName)
- local userName = playerElementOrName
- if isElement(playerElementOrName) and getElementType(playerElementOrName) == "player" then
- userName = getPlayerName(playerElementOrName)
- elseif type(playerElementOrString) ~= "string" then
- return
- end
- local fd = fileOpen(":RPGU_CK/CK.txt", true)
- if fd then
- local content = split(fileRead(fd, fileGetSize(fd)), "\r\n")
- fileClose(fd)
- userName = userName:lower()
- for index, value in pairs(content) do
- if value == userName then
- return true
- end
- end
- return false
- end
- end
- function CKcmd (source,cmd,cked)
- if cked then
- local blah = getPlayerFromName(cked)
- outputChatBox("((" ..cked.. " just got Character killed by admin!))")
- local ckfile = fileOpen(":RPGU_CK/CK.txt")
- fileSetPos(ckfile, fileGetSize(ckfile))
- fileWrite(ckfile, cked:lower().."\r\n")
- fileClose(ckfile)
- kickPlayer(blah,"You just got Character Killed, please use another one")
- end
- end
- addCommandHandler("ck", CKcmd)
- function CKKick()
- if checkPlayer(source) then
- kickPlayer(source,"This character is dead. Use another one.")
- end
- end
- addEventHandler("onPlayerJoin", getRootElement(), CKKick)
Add Comment
Please, Sign In to add comment