ZeyadGTX Posted September 16, 2014 Posted September 16, 2014 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 My nick in MTA is Spider
Anubhav Posted September 16, 2014 Posted September 16, 2014 (edited) Code removed by Anubhav as this problem is solved. Edited September 16, 2014 by Guest See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
ZeyadGTX Posted September 16, 2014 Author Posted September 16, 2014 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% My nick in MTA is Spider
Anubhav Posted September 16, 2014 Posted September 16, 2014 No problem. See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
ZeyadGTX Posted September 16, 2014 Author Posted September 16, 2014 I got problem Givemoney\script.lua:19: unfinished string near '"You Don't Have Enough Money ! , player, 255, 0, 0)' [2014-09-16 05:56:15] ERROR: Loading script failed: (Sroam)Givemoney\script.lua:19: unfinished string near '"You Don't Have Enough Money ! , player, 255, 0, 0)' My nick in MTA is Spider
ZeyadGTX Posted September 16, 2014 Author Posted September 16, 2014 Lot of errors (Sroam)Givemoney\script.lua:35: 'end' expected (to close 'if' at line 6) near '' [2014-09-16 06:20:04] ERROR: Loading script failed: (Sroam)Givemoney\script.lua:35: 'end' expected (to close 'if' at line 6) near '' My nick in MTA is Spider
Anubhav Posted September 16, 2014 Posted September 16, 2014 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 See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
ZeyadGTX Posted September 16, 2014 Author Posted September 16, 2014 ERROR: Loading script failed: (Sroam)Givemoney\script.lua:39: 'end' expected (to close 'if' at line 5) near '' My nick in MTA is Spider
Anubhav Posted September 16, 2014 Posted September 16, 2014 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 See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
ZeyadGTX Posted September 16, 2014 Author Posted September 16, 2014 SCRIPT ERROR: (Sroam)Givemoney\script.lua:39: 'end' expected (to close 'if' at line 5) near '' [2014-09-16 06:58:33] ERROR: Loading script failed: (Sroam)Givemoney\script.lua:39: 'end' expected (to close 'if' at line 5) near '' My nick in MTA is Spider
Anubhav Posted September 16, 2014 Posted September 16, 2014 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 See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
ZeyadGTX Posted September 16, 2014 Author Posted September 16, 2014 You Just Put Spaces My nick in MTA is Spider
gsqjfem10b Posted September 16, 2014 Posted September 16, 2014 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
Anubhav Posted September 16, 2014 Posted September 16, 2014 You Just Put Spaces I just put spaces? OH woah. You can't even fix a simple error. You don't even know how simple is it to fix the error. THE ERROR TELLS THAT ONE END IS MISSING SO I ADDED IT BY INDENTING THE CODE SO IT IS CLEAN. See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
-.Paradox.- Posted September 16, 2014 Posted September 16, 2014 You Just Put Spaces I just put spaces? OH woah. You can't even fix a simple error. You don't even know how simple is it to fix the error. THE ERROR TELLS THAT ONE END IS MISSING SO I ADDED IT BY INDENTING THE CODE SO IT IS CLEAN. +1 He also doesn't know how to finish a string, lol. If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
ZeyadGTX Posted September 16, 2014 Author Posted September 16, 2014 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 My nick in MTA is Spider
Et-win Posted September 16, 2014 Posted September 16, 2014 ...Srsly? You are back and you are just posting stuff to us and letting us fix it. You still didn't learn (anything) to script huh? ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
ZeyadGTX Posted September 16, 2014 Author Posted September 16, 2014 Problem Fixed ! My nick in MTA is Spider
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