Schlammy Posted May 22, 2013 Share 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) Link to comment
Moderators IIYAMA Posted May 22, 2013 Moderators Share 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) Link to comment
Schlammy Posted May 22, 2013 Author Share Posted May 22, 2013 ???? Why should this help me to warp permanent up? Link to comment
Moderators IIYAMA Posted May 22, 2013 Moderators Share 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 Link to comment
Schlammy Posted May 22, 2013 Author Share Posted May 22, 2013 iam at work.. Ill test it later during night when i come home Link to comment
Moderators IIYAMA Posted May 22, 2013 Moderators Share 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. Link to comment
Schlammy Posted May 22, 2013 Author Share 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 Link to comment
Moderators IIYAMA Posted May 22, 2013 Moderators Share Posted May 22, 2013 When I am home, I will try to help you as far as I can. Link to comment
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