Jump to content

[Help]Warning Script


spoty

Recommended Posts

Hi there

i have a warn script to warn players

but is it possible to make it count the warns like

if player has 3 warns he get kicked out of game and by 6 it give 1 day bann or something?

here is the script

function getPlayerFromNamePart(name) 
  
    local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil 
  
    if name then 
  
        for _, player in ipairs(getElementsByType("player")) do 
  
            local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() 
  
            if name_:find(name, 1, true) then 
  
                return player 
  
            end 
  
        end 
  
    end 
  
end 
  
  
  
function warnPlayer_CMD(thePlayer, theCMD, theTarget, ...) 
 local accN = getAccountName ( getPlayerAccount (thePlayer) ) 
local groupName = "Admin" or "Moderator" or "SuperModerator" or "Console" 
if groupName then 
    if theTarget ~= nil and isObjectInACLGroup ("user."..accN,aclGetGroup (groupName) ) -- missing bracket  
         
        then 
  
        local theTargetElement = getPlayerFromNamePart(theTarget) 
  
        if(getElementType(theTargetElement) == "player") then 
  
            local allArgs = {...} 
  
            local theReason = table.concat(allArgs, " ") 
  
            outputChatBox("#ff0000[WARN]: "..getPlayerName(thePlayer).."#FFFFFF has warned "..getPlayerName(theTargetElement).."", getRootElement(), 255, 0, 0, true) 
  
            outputChatBox("#ff0000[WARN]: #ffffffReason: #FFFFFF("..tostring(theReason)..")", getRootElement(), 255, 0, 0, true) 
  
        else 
  
            outputChatBox("#ff0000[WARN]: #ffffffInvalid target! Syntax: /warn [player] [reason]", thePlayer, 255, 0, 0, true) 
              end 
        end 
  
    end 
  
end 
  
addCommandHandler("warn", warnPlayer_CMD, false) 

Please help me :)

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...