1LoL1 Posted September 27, 2015 Posted September 27, 2015 Hello, i created this code but not work can anyone help me? function cash () local bot = getElementType("bot") local cash = (getElementData(bot, "cash") or 0) outputChatBox("BOT have "..cash.."$ !", getRootElement(), 255, 0, 0, true) end addCommandHandler("xxx", cash) function cash2 () local bot2 = getElementType("bot") setElementData(bot2, "cash", (getElementData(bot2, "cash") or 0) + 5000) outputChatBox("BOT +5000$ !", getRootElement(), 255, 0, 0, true) end addCommandHandler("xx", cash2)
1LoL1 Posted September 27, 2015 Author Posted September 27, 2015 What's wrong with it not work. 11: Bad argument @ "setElementData" [Expected element at argument 1, got boolean] 11: Bad argument @ "getElementData" [Expected element at argument 1, got boolean] 10: Bad argument @ "getElementType" [Expected element at argument 1, got string "bot"]
KariiiM Posted September 27, 2015 Posted September 27, 2015 (edited) bot isn't an element so it will returns false Edited September 27, 2015 by Guest
1LoL1 Posted September 27, 2015 Author Posted September 27, 2015 bot isn't an element and when i want to create "bot" and give him $$$ and take from him $$$? what i must use?
KariiiM Posted September 27, 2015 Posted September 27, 2015 I think there's a resource for bot system
1LoL1 Posted September 27, 2015 Author Posted September 27, 2015 I think there's a resource for bot system But i don't mean bot system. and now i fixed what i want thx for help
KariiiM Posted September 27, 2015 Posted September 27, 2015 But i don't mean bot system. and now i fixed what i want thx for help Anytime
1LoL1 Posted October 1, 2015 Author Posted October 1, 2015 But i don't mean bot system. and now i fixed what i want thx for help Anytime And why this not work? please can anyone help me? function xxx () local bot = createElement("bot") local cash = (getElementData(bot, "cash") or 0) outputChatBox("BOT have "..cash.."$ !", getRootElement(), 255, 0, 0, true) end addCommandHandler("xxx", xxx) function xx () local bot2 = createElement("bot") setElementData(bot2, "cash", (getElementData(bot2, "cash") or 0) + 5000) outputChatBox("BOT +5000$ !", getRootElement(), 255, 0, 0, true) end addCommandHandler("xx", xx)
CobbTheWarriorsRPG Posted October 2, 2015 Posted October 2, 2015 Well, bot its not an element, but you can create a ped like this https://wiki.multitheftauto.com/wiki/CreatePed function cash () local bot = createPed ( 0, 0, 0, 0)--Create a Cj in the 0,0,0 coord local cash = getElementData(bot, "cash") --This return false, because the bot doesnt have "cash" outputChatBox("BOT have "..cash.."$ !", getRootElement(), 255, 0, 0, true) end addCommandHandler("xxx", cash) function cash2 () --You cant operate booleans whit numbers so cash = getElementData(bot,"cash") if (cash == false) then --You cant operate booleans whit numbers so setElementData(bot,"cash", 0 ) setElementData(bot, "cash", (getElementData(bot, "cash") + 5000) --Now you can use the comand xxx outputChatBox("BOT +5000$ !", getRootElement(), 255, 0, 0, true) end end addCommandHandler("xx", cash2)
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