ViRuZGamiing Posted June 15, 2014 Posted June 15, 2014 Hi guys, I have 2 problems, 1. Bad 'ped' pointer @warpPedIntoVehicle 2. The setElementPosition doesn't do what it has too do. boatMarker = createMarker ( -1734.4, 221.3, 2.5, "cylinder", 3.5, 255, 0, 0, 255 ) dft = createVehicle( 578, -1745.1, 212.10001, 4.3, 0, 0, 270 ) dftBoat = createVehicle ( 473, -1747.4, 212.10001, 5 ) attachElements ( dftBoat, dft ) function spawnTheBoat ( thePlayer ) if getElementModel ( thePlayer ) == 578 then detachElements ( dftBoat ) setElementPosition (dftBoat, -1723.6, 229.39999, 0, 0, 0, 270) warpPedIntoVehicle ( thePlayer, dftBoat ) setElementFrozen ( dft, true ) function unfreezeDft ( thePlayer ) setElementFrozen ( dft, false ) attachElements ( dftBoat, dft ) warpPedIntoVehicle ( thePlayer, dft ) end addCommandHandler ("ready", unfreezeDft) end end addEventHandler ("onMarkerHit", boatMarker, spawnTheBoat) Yes this is the full code "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
MIKI785 Posted June 15, 2014 Posted June 15, 2014 Function inside a function, really? It doesn't work because thePlayer is the string "ready" (the command) in unfreezeDft. Lua Scripter Owner of mshost.cz MTA portal.
ViRuZGamiing Posted June 15, 2014 Author Posted June 15, 2014 how do you mean is the string "ready"? changed the function in function; boatMarker = createMarker ( -1734.4, 221.3, 2.5, "cylinder", 3.5, 255, 0, 0, 255 ) dft = createVehicle( 578, -1745.1, 212.10001, 4.3, 0, 0, 270 ) dftBoat = createVehicle ( 473, -1747.4, 212.10001, 5 ) attachElements ( dftBoat, dft ) function spawnTheBoat ( thePlayer ) if getElementModel ( thePlayer ) == 578 then detachElements ( dftBoat ) setElementPosition (dftBoat, -1723.6, 229.39999, 0, 0, 0, 270) warpPedIntoVehicle ( thePlayer, dftBoat ) setElementFrozen ( dft, true ) end end addEventHandler ("onMarkerHit", boatMarker, spawnTheBoat) function unfreezeDft ( thePlayer ) setElementFrozen ( dft, false ) attachElements ( dftBoat, dft ) warpPedIntoVehicle ( thePlayer, dft ) end addCommandHandler ("ready", unfreezeDft) "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
MIKI785 Posted June 15, 2014 Posted June 15, 2014 thePlayer is equal to "ready"... addCommandHandler Lua Scripter Owner of mshost.cz MTA portal.
ViRuZGamiing Posted June 15, 2014 Author Posted June 15, 2014 so what do I need to too? remove thePlayer and write "ready" everywhere? The first function doesn't work either with the warpPedIntoVehicle and there's no command triggering it. "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
Moderators IIYAMA Posted June 15, 2014 Moderators Posted June 15, 2014 Your code is serverside right? MIKI785 is talking about this. For addCommandHandler: Server player playerSource, string commandName, [string arg1, string arg2, ...] Client string commandName, [string arg1, string arg2, ...] Make sure your code is serverside in the meta. 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