Schlammy Posted May 22, 2013 Posted May 22, 2013 Hey guys. I Made a skydive script and i want to open the Parachute of the Player who type the command. I tried to use setControlState with the control "fire" but it won`t work in the air. Someone who know what to do? Example (not tested) -- SERVER function skyD(player) local px,py,pz = getElementModel(player) setElementPosition(player, px,py,(pz + 300)) giveWeapon ( player,46 ,1, true ) -- Here i trigger client event triggerClientEvent("clientStartFiring", player, true) setTimer(function() triggerClientEvent("clientStartFiring", player, false) end, 500, 1) end addCommandHandler("letMeFly", skyD) -- CLIENT function clientStartFiring(state) setControlState("fire", state) end addEvent("clientStartFiring", true) addEventHandler("clientStartFiring", getRootElement(), clientStartFiring) Known Languages: [LUA][VB.NET][ASP.NET][C#][JAVA][C++] [sqlite][MSSQL][salesForce][bATCH][/center]
Moderators IIYAMA Posted May 22, 2013 Moderators Posted May 22, 2013 I have never made a script like this before, but this may help you. --client setElementFrozen (localPlayer) addEventHandler("onClientPreRender",root, function () local x,y,z = getElementPositon(localPlayer) setElementPosition (localPlayer,x,y,z+.0001,false) -- false is not interrupt animations. end) 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
Schlammy Posted May 22, 2013 Author Posted May 22, 2013 ???? Why should this help me to warp permanent up? Known Languages: [LUA][VB.NET][ASP.NET][C#][JAVA][C++] [sqlite][MSSQL][salesForce][bATCH][/center]
Moderators IIYAMA Posted May 22, 2013 Moderators Posted May 22, 2013 (edited) Because you wanted to shoot while skydiving? "setControlState("fire", state)" = shooting..... or was it for opening the parachute? -- SERVER function skyD(player) local px,py,pz = getElementModel(player) setElementPosition(player, px,py,(pz + 300),false) giveWeapon ( player,46 ,1, true ) setControlState(player,"fire", true) setTimer(function() if isElement(player) then setControlState(player,"fire", false) end end, 500, 1) end addCommandHandler("letMeFly", skyD) --[[CLIENT function clientStartFiring(state) setControlState("fire", state) end addEvent("clientStartFiring", true) addEventHandler("clientStartFiring", getRootElement(), clientStartFiring) ]] Edited May 22, 2013 by Guest 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
Schlammy Posted May 22, 2013 Author Posted May 22, 2013 yes its for opening Known Languages: [LUA][VB.NET][ASP.NET][C#][JAVA][C++] [sqlite][MSSQL][salesForce][bATCH][/center]
Moderators IIYAMA Posted May 22, 2013 Moderators Posted May 22, 2013 try that. 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
Schlammy Posted May 22, 2013 Author Posted May 22, 2013 iam at work.. Ill test it later during night when i come home Known Languages: [LUA][VB.NET][ASP.NET][C#][JAVA][C++] [sqlite][MSSQL][salesForce][bATCH][/center]
Moderators IIYAMA Posted May 22, 2013 Moderators Posted May 22, 2013 Btw there wasn't much wrong with your code. Maybe the triggerClientEvent did had a root argument, but that should not make it not working. triggerClientEvent("clientStartFiring", player, false) -- to triggerClientEvent(player,"clientStartFiring", player, false) sendTo: The event will be sent to all players that are children of the specified element. By default this is the root element, and hence the event is sent to all players. If you specify a single player it will just be sent to that player. 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
Schlammy Posted May 22, 2013 Author Posted May 22, 2013 the script is correct i tested it. Hes shooting on ground but not flying. Thats the problem to trigger the parachute Known Languages: [LUA][VB.NET][ASP.NET][C#][JAVA][C++] [sqlite][MSSQL][salesForce][bATCH][/center]
Moderators IIYAMA Posted May 22, 2013 Moderators Posted May 22, 2013 When I am home, I will try to help you as far as I can. 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
Schlammy Posted May 22, 2013 Author Posted May 22, 2013 thank you Known Languages: [LUA][VB.NET][ASP.NET][C#][JAVA][C++] [sqlite][MSSQL][salesForce][bATCH][/center]
Schlammy Posted May 23, 2013 Author Posted May 23, 2013 /push Known Languages: [LUA][VB.NET][ASP.NET][C#][JAVA][C++] [sqlite][MSSQL][salesForce][bATCH][/center]
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