ZeyadGTX Posted July 19, 2014 Share Posted July 19, 2014 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
-.Paradox.- Posted July 19, 2014 Share Posted July 19, 2014 Ask the owner of the script, and stop stealing people's codes. viewtopic.php?f=91&t=77318 Link to comment
ZeyadGTX Posted July 19, 2014 Author Share Posted July 19, 2014 Did i say i make it ? Link to comment
-.Paradox.- Posted July 19, 2014 Share Posted July 19, 2014 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
ZeyadGTX Posted July 19, 2014 Author Share Posted July 19, 2014 when i said this is my script i meant this is the script which i use Link to comment
ZeyadGTX Posted July 19, 2014 Author Share Posted July 19, 2014 You will help me or no Link to comment
50p Posted July 19, 2014 Share Posted July 19, 2014 Line 9: if money >= amount and amount > 0 then Don't say the code is yours if it's not. Link to comment
Mr_Moose Posted July 19, 2014 Share Posted July 19, 2014 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
Et-win Posted July 19, 2014 Share Posted July 19, 2014 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
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