SAbJaN Posted April 18, 2012 Posted April 18, 2012 Hey Everytime I try to kick someone from my server, it comes up with the message saying they've been kicked, and then I hold tab to make sure, and there name is still there... function kickAPlayer(thePlayer, commandName, targetPlayer, ...) if (exports.global:isPlayerAdmin(thePlayer)) then if not (targetPlayer) or not (...) then outputChatBox("SYNTAX: /" .. commandName .. " [Partial Player Nick] [Reason]", thePlayer, 255, 194, 14) else local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick(thePlayer, targetPlayer) if targetPlayer then local thePlayerPower = exports.global:getPlayerAdminLevel(thePlayer) local targetPlayerPower = exports.global:getPlayerAdminLevel(targetPlayer) reason = table.concat({...}, " ") if (targetPlayerPower <= thePlayerPower) then local hiddenAdmin = getElementData(thePlayer, "hiddenadmin") local playerName = getPlayerName(thePlayer) mysql:query_free('INSERT INTO adminhistory (user_char, user, admin_char, admin, hiddenadmin, action, duration, reason) VALUES ("' .. mysql:escape_string(getPlayerName(targetPlayer)) .. '",' .. mysql:escape_string(tostring(getElementData(targetPlayer, "gameaccountid") or 0)) .. ',"' .. mysql:escape_string(getPlayerName(thePlayer)) .. '",' .. mysql:escape_string(tostring(getElementData(thePlayer, "gameaccountid") or 0)) .. ',' .. mysql:escape_string(hiddenAdmin) .. ',1,0,"' .. mysql:escape_string(reason) .. '")' ) if (hiddenAdmin==0) then local adminTitle = exports.global:getPlayerAdminTitle(thePlayer) outputChatBox("AdmKick: " .. adminTitle .. " " .. playerName .. " kicked " .. targetPlayerName .. ".", getRootElement(), 255, 0, 51) outputChatBox("AdmKick: Reason: " .. reason .. ".", getRootElement(), 255, 0, 51) kickPlayer(targetPlayer, thePlayer, reason) else outputChatBox("AdmKick: Hidden Admin kicked " .. targetPlayerName .. ".", getRootElement(), 255, 0, 51) outputChatBox("AdmKick: Reason: " .. reason, getRootElement(), 255, 0, 51) kickPlayer(targetPlayer, getRootElement(), reason) end exports.logs:logMessage("[/PKICK] " .. getElementData(thePlayer, "gameaccountusername") .. "/".. getPlayerName(thePlayer) .." kicked ".. targetPlayerName .." (".. reason ..")" , 4) else outputChatBox(" This player is a higher level admin than you.", thePlayer, 255, 0, 0) outputChatBox(playerName .. " attempted to execute the kick command on you.", targetPlayer, 255, 0 ,0) end end end end end addCommandHandler("pkick", kickAPlayer, false, false)
MIKI785 Posted April 18, 2012 Posted April 18, 2012 Does that resource have acces to the kickPlayer function?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now