dagid4 Posted December 6, 2010 Posted December 6, 2010 Please help. I can't make this simple script. I have got GUI button, button is working, but handler on it (createVehicle) isn't. Client script handler: function BuyTractor (thePlayer) local money = getPlayerMoney(thePlayer) if (money >= 5000) then takePlayerMoney (5000) local vehicleModel = 572 local x,y,z = getElementPosition(thePlayer) y = y + 5 createVehicle(tonumber(vehicleModel),x,y,z) end end What is wrong? Sorry for my english, im not very good in it.
Aibo Posted December 6, 2010 Posted December 6, 2010 if this function is a handler for onClientGUIClick then thePlayer here is mouse button string, not player element. and also if you want to actually use this vehicle, create it server-side: https://wiki.multitheftauto.com/wiki/CreateVehicle
dagid4 Posted December 6, 2010 Author Posted December 6, 2010 Thank you, thank you, thank you. It is working! I solve this problem all the day. You very help me. Script: function BuyTractor (thePlayer) theGuy = getLocalPlayer() local money = getPlayerMoney(theGuy) if (money >= 5000) then takePlayerMoney (5000) local vehicleModel = 572 local x,y,z = getElementPosition(theGuy) y = y + 5 createVehicle(tonumber(vehicleModel),x,y,z) end end
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