Jump to content

Fines!


marty000123

Recommended Posts

Hello

I'm looking for a script which fines players.

Like, only the ACL group ''HQ'' can fine players.

It will be something like this.

In this example my name is Lil'Bitch.

Lil'Bitch: /fine NewbIE11 50000

So ''NewbIE11'' gets fined $50k.

Means, they will lose $50.000 of their money.

Output on EVERYONE'S SCREEN:

'AdmCmd: NewbIE11 has been fined $50000 by Lil'Bitch.

That output needs to be RGBA 255 0 0 255 or #FF0000.

So the output line will be this

AdmCmd: finedplayer has been fined $amount by guywhofined.

(I don't know if this resource already exist, didn't find it. If you need money to create this, I can give. If you can do it easily/for free, would be great. Please respond.)

Thanks in advance!

Greetings, Marty

Link to comment
  
function getPlayerFromPartialName(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 convertNumber ( number )   
    local formatted = number   
    while true do       
        formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')     
        if ( k==0 ) then       
            break    
        end   
    end   
    return formatted 
end 
  
function finePlayer(s, cmd, player, money) 
    local acc = getAccountName(getPlayerAccount(s)) 
    if not isObjectInACLGroup("user."..acc, aclGetGroup("Admin")) then return end 
    local p = getPlayerFromPartialName(player) 
    if player then 
        if tonumber(tostring(money)) then 
            takePlayerMoney(p, tonumber(tostring(money))) 
            outputChatBox("AdmCmd: "..getPlayerName(p).." has been fined "..tostring(convertNumber(tonumber(tostring(money)))).." by "..getPlayerName(s) , root, 255, 0, 0) 
        else 
            outputChatBox("SYNTAX: /fine ", p) 
        end 
    else 
        outputChatBox("No player found with the name!", s) 
    end 
end 
addCommandHandler("fine", finePlayer) 
  

Link to comment
  
function getPlayerFromPartialName(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 convertNumber ( number )   
    local formatted = number   
    while true do       
        formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')     
        if ( k==0 ) then       
            break    
        end   
    end   
    return formatted 
end 
  
function finePlayer(s, cmd, player, money) 
    local acc = getAccountName(getPlayerAccount(s)) 
    if not isObjectInACLGroup("user."..acc, aclGetGroup("Admin")) then return end 
    local p = getPlayerFromPartialName(player) 
    if player then 
        if tonumber(tostring(money)) then 
            takePlayerMoney(p, tonumber(tostring(money))) 
            outputChatBox("AdmCmd: "..getPlayerName(p).." has been fined "..tostring(convertNumber(tonumber(tostring(money)))).." by "..getPlayerName(s) , root, 255, 0, 0) 
        else 
            outputChatBox("SYNTAX: /fine ", p) 
        end 
    else 
        outputChatBox("No player found with the name!", s) 
    end 
end 
addCommandHandler("fine", finePlayer) 
  

My Hero! Thank you very much!

Link to comment

Is it possible to add a reason to it? Like,

/fine player amount reason

Example

/fine Marty 10000 Car parking

Output:

AdmCmd: Finedplayer has been fined $Amount by Finer (just like you had), Reason: Car parking

That would be awesome and it would totally finish it!

If it's impossible, I won't blame. Thanks anyway ;)

Link to comment
  
  
function getPlayerFromPartialName(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 convertNumber ( number )   
    local formatted = number   
    while true do       
        formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')     
        if ( k==0 ) then       
            break   
        end   
    end   
    return formatted 
end 
  
function finePlayer(s, cmd, player, money, ...) 
    local acc = getAccountName(getPlayerAccount(s)) 
    local r = table.concat({...}, " ") 
    if r == "" then return end 
    if not isObjectInACLGroup("user."..acc, aclGetGroup("Admin")) then return end 
    local p = getPlayerFromPartialName(player) 
    if player then 
        if tonumber(tostring(money)) then 
            takePlayerMoney(p, tonumber(tostring(money))) 
            outputChatBox("AdmCmd: "..getPlayerName(p).." has been fined $"..tostring(convertNumber(tonumber(tostring(money)))).." by "..getPlayerName(s).. " Reason: "..tostring(r), root, 255, 0, 0) 
        else 
            outputChatBox("SYNTAX: /fine ", p) 
        end 
    else 
        outputChatBox("No player found with the name!", s) 
    end 
end 
addCommandHandler("fine", finePlayer) 
  

Link to comment
  
  
function getPlayerFromPartialName(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 convertNumber ( number )   
    local formatted = number   
    while true do       
        formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')     
        if ( k==0 ) then       
            break   
        end   
    end   
    return formatted 
end 
  
function finePlayer(s, cmd, player, money, ...) 
    local acc = getAccountName(getPlayerAccount(s)) 
    local r = table.concat({...}, " ") 
    if r == "" then return end 
    if not isObjectInACLGroup("user."..acc, aclGetGroup("Admin")) then return end 
    local p = getPlayerFromPartialName(player) 
    if player then 
        if tonumber(tostring(money)) then 
            takePlayerMoney(p, tonumber(tostring(money))) 
            outputChatBox("AdmCmd: "..getPlayerName(p).." has been fined $"..tostring(convertNumber(tonumber(tostring(money)))).." by "..getPlayerName(s).. " Reason: "..tostring(r), root, 255, 0, 0) 
        else 
            outputChatBox("SYNTAX: /fine ", p) 
        end 
    else 
        outputChatBox("No player found with the name!", s) 
    end 
end 
addCommandHandler("fine", finePlayer) 
  

Hey, thanks for your respond.

When I use this, it's not working anymore. Nothing shows up, nothing happens.

Solution?

Marty

Link to comment
  
  
function getPlayerFromPartialName(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 convertNumber ( number )   
    local formatted = number   
    while true do       
        formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')     
        if ( k==0 ) then       
            break   
        end   
    end   
    return formatted 
end 
  
  
function finePlayer(s, cmd, player, money, ...) 
    local acc = getAccountName(getPlayerAccount(s)) 
    local r = table.concat({...}, " ") 
    if r == "" then return outputChatBox("No reason typed!", s) end 
    if not isObjectInACLGroup("user."..acc, aclGetGroup("Admin")) then return end 
    local p = getPlayerFromPartialName(player) 
    if p then 
        if tonumber(tostring(money)) then 
            takePlayerMoney(p, tonumber(tostring(money))) 
            outputChatBox("AdmCmd: "..getPlayerName(p).." has been fined $"..tostring(convertNumber(tonumber(tostring(money)))).." by "..getPlayerName(s).. " Reason: "..tostring(r), root, 255, 0, 0) 
        else 
            outputChatBox("SYNTAX: /fine ", p) 
        end 
    else 
        outputChatBox("No player found with the name!", s) 
    end 
end 
addCommandHandler("fine", finePlayer) 
  

SYNTAX: /fine plr money reason

Link to comment
  
  
function getPlayerFromPartialName(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 convertNumber ( number )   
    local formatted = number   
    while true do       
        formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')     
        if ( k==0 ) then       
            break   
        end   
    end   
    return formatted 
end 
  
  
function finePlayer(s, cmd, player, money, ...) 
    local acc = getAccountName(getPlayerAccount(s)) 
    local r = table.concat({...}, " ") 
    if r == "" then return outputChatBox("No reason typed!", s) end 
    if not isObjectInACLGroup("user."..acc, aclGetGroup("Admin")) then return end 
    local p = getPlayerFromPartialName(player) 
    if p then 
        if tonumber(tostring(money)) then 
            takePlayerMoney(p, tonumber(tostring(money))) 
            outputChatBox("AdmCmd: "..getPlayerName(p).." has been fined $"..tostring(convertNumber(tonumber(tostring(money)))).." by "..getPlayerName(s).. " Reason: "..tostring(r), root, 255, 0, 0) 
        else 
            outputChatBox("SYNTAX: /fine ", p) 
        end 
    else 
        outputChatBox("No player found with the name!", s) 
    end 
end 
addCommandHandler("fine", finePlayer) 
  

SYNTAX: /fine plr money reason

Thank you very much!

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...