Mateuswiesner Posted January 20, 2014 Posted January 20, 2014 (edited) How to when the player enter /sellcar. It exit of car automatically? function playerCarSell ( source, cmd) if(isPedInVehicle(source)) then local playercar = getPedOccupiedVehicle ( source ) if(getElementData ( playercar, "owner" ) == getPlayerName ( source )) then setElementData (playercar,"owner","Nobody") givePlayerMoney ( source, getElementData ( playercar, "price" )/100*50 ) outputChatBox ("You sold your car!",source, 243,149,72 ) saveCars() else outputChatBox ("Error: It's not your car!",source, 255,255,127 ) end else outputChatBox ("Error: You're not the car!",source, 255,255,127 ) end end addCommandHandler ("sellcar",playerCarSell) Edited January 20, 2014 by Guest
Karuzo Posted January 20, 2014 Posted January 20, 2014 We can't help you if you not speak in english... Spanish board: viewforum.php?f=122
Chopper Posted January 20, 2014 Posted January 20, 2014 function playerCarSell ( source, cmd) if(isPedInVehicle(source)) then removePedFromVehicle (source) local playercar = getPedOccupiedVehicle ( source ) if(getElementData ( playercar, "owner" ) == getPlayerName ( source )) then setElementData (playercar,"owner","Nobody") givePlayerMoney ( source, getElementData ( playercar, "price" )/100*50 ) outputChatBox ("You sold your car!",source, 243,149,72 ) saveCars() else outputChatBox ("Error: It's not your car!",source, 255,255,127 ) end else outputChatBox ("Error: You're not the car!",source, 255,255,127 ) end end addCommandHandler ("sellcar",playerCarSell)
Mateuswiesner Posted January 20, 2014 Author Posted January 20, 2014 It did not work. Now he just gets out and does not sell the car!
Moderators IIYAMA Posted January 20, 2014 Moderators Posted January 20, 2014 It did not work. Now he just gets out and does not sell the car! https://wiki.multitheftauto.com/wiki/OnVehicleEnter https://wiki.multitheftauto.com/wiki/OnVehicleExit https://wiki.multitheftauto.com/wiki/Re ... romVehicle To lazy to search on wiki mta? Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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