Jump to content

[Help]Create vehicle at player


dagid4

Recommended Posts

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.

Link to comment

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 

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