Jump to content

Givemoney


ZeyadGTX

Recommended Posts

I use this givemoney resource which you use /givemoney playername amount

but the problem that you can send money by negative like /givemoney playername -9999

and your money get decreasing i want to disable that !

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 Enough Money ! , 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
  
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 string.find(tostring(amount), "-", true) then 
                    return outputChatBox("Sorry, you are not allowed to send negative money!", player ) 
                end  
                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 Enough Money ! , 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 
  
  
 

Thanks Works 100%

Link to comment
  
  
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 string.find(tostring(amount), "-", true) then 
                    return outputChatBox("Sorry, you are not allowed to send negative money!", player ) 
                end 
                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 Enough Money !" , 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
  
  
  
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 string.find(tostring(amount), "-", true) then 
                    return outputChatBox("Sorry, you are not allowed to send negative money!", player ) 
                end 
                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 Enough Money !" , player, 255, 0, 0) 
          end 
     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
  
  
  
  
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 string.find(tostring(amount), "-", true) then 
                    return outputChatBox("Sorry, you are not allowed to send negative money!", player ) 
                end 
                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 Enough Money !" , player, 255, 0, 0) 
               end  
         end 
     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
function giveSomeoneMoney(player, cmd, target, amount) 
    if target then 
        if tonumber(amount) and tonumber(amount) > 0 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 Enough Money !" , 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

My Code is :

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 Enough Money !", player, 255, 0, 0) 
                end 
            else 
                outputChatBox("", player, 255, 0, 0) 
            end 
        else 
            outputChatBox("", player, 255, 0, 0) 
        end 
    else 
        outputChatBox("", 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

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