Jump to content

Givemoney by Nigative


ZeyadGTX

Recommended Posts

Hello this is my script but i have small problem any one can send money to any player by Negative ( - )

like /givemoney Name -5555 how do i disable this

function giveSomeoneMoney(player, cmd, target, amount) 
    if target then 
        if amount then 
            local money = getPlayerMoney(player) 
            local targetplayer = getPlayerFromParticalName(target) 
            local r,g,b = getPlayerNametagColor(player) 
            amount = tonumber(amount) 
            if targetplayer then 
                if money >= amount then 
                    givePlayerMoney(targetplayer, amount) 
                    takePlayerMoney(player, amount) 
                    outputChatBox("You Were Given #00FF00$"..tostring(amount).." #006400 From #FF0000"..getPlayerName(player) , targetplayer, 0, 100, 0, true) 
                    outputChatBox("You Gave #00FF00$"..tostring(amount).."#006400 To #FF0000"..getPlayerName(targetplayer), player, 0, 100, 0, true) 
                else 
                    outputChatBox("You don't have enought money!", player, 255, 0, 0) 
                end 
            else 
                outputChatBox("Error: Player not found", player, 255, 0, 0) 
            end 
        else 
            outputChatBox("Error: /givemoney [player name] [amount]", player, 255, 0, 0) 
        end 
    else 
        outputChatBox("Error: /givemoney [player name] [amount]", player, 255, 0, 0) 
    end 
end 
addCommandHandler("givemoney", giveSomeoneMoney) 
  
function getPlayerFromParticalName(thePlayerName) 
    local thePlayer = getPlayerFromName(thePlayerName) 
    if thePlayer then 
        return thePlayer 
    end 
    for _,thePlayer in ipairs(getElementsByType("player")) do 
        if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x", ""), thePlayerName:lower(), 1, true) then 
            return thePlayer 
        end 
    end 
return false 
end 

Link to comment
Hello this is my script but i have small problem any one can send money to any player by Negative ( - )

like /givemoney Name -5555 how do i disable this

function giveSomeoneMoney(player, cmd, target, amount) 
    if target then 
        if amount then 
            local money = getPlayerMoney(player) 
            local targetplayer = getPlayerFromParticalName(target) 
            local r,g,b = getPlayerNametagColor(player) 
            amount = tonumber(amount) 
            if targetplayer then 
                if money >= amount then 
                    givePlayerMoney(targetplayer, amount) 
                    takePlayerMoney(player, amount) 
                    outputChatBox("You Were Given #00FF00$"..tostring(amount).." #006400 From #FF0000"..getPlayerName(player) , targetplayer, 0, 100, 0, true) 
                    outputChatBox("You Gave #00FF00$"..tostring(amount).."#006400 To #FF0000"..getPlayerName(targetplayer), player, 0, 100, 0, true) 
                else 
                    outputChatBox("You don't have enought money!", player, 255, 0, 0) 
                end 
            else 
                outputChatBox("Error: Player not found", player, 255, 0, 0) 
            end 
        else 
            outputChatBox("Error: /givemoney [player name] [amount]", player, 255, 0, 0) 
        end 
    else 
        outputChatBox("Error: /givemoney [player name] [amount]", player, 255, 0, 0) 
    end 
end 
addCommandHandler("givemoney", giveSomeoneMoney) 
  
function getPlayerFromParticalName(thePlayerName) 
    local thePlayer = getPlayerFromName(thePlayerName) 
    if thePlayer then 
        return thePlayer 
    end 
    for _,thePlayer in ipairs(getElementsByType("player")) do 
        if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x", ""), thePlayerName:lower(), 1, true) then 
            return thePlayer 
        end 
    end 
return false 
end 

Hello this is my script but i have small problem...
Link to comment
when i said this is my script i meant this is the script which i use -_-

You're not the owner of a script just because you are using it, and why do you expect it to work when you doesn't even care about reading it, even a noob would see the problem if they just read the code line by line.

Link to comment

Just stop downloading/taking script and ram them into a new topic here on the MTA Forums and go read the script by yourself because you are doing this by litterly every script where you have 'problems' with. You are totally not taking the time to even learn the simplest LUA basic/code/or whatever. Trust me, when you learn to script, you have the best scripts working how you want to with an orginal server.

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