Vercetti1010 Posted January 14, 2009 Share Posted January 14, 2009 Hi, sorry to ask another question so soon, but I am having a lot of confusion with this script im working on. It is supposed to simulate the Single player parachute when you click your mouse and put the parachute away when you click again. I loaded it into my server and turned it on and tested it and got no errors but nothing happens. I even tied a command to it to see if it worked and still nothing happened. Can someone help me figure out why this won't do anything? parachuteclient.lua function workingChute(key,keyState) weapon = getPlayerWeapon(getLocalPlayer()) if (weapon == 46) then if (doesPlayerHaveJetpack(getLocalPlayer()) then outputChatBox("You can't open your parachute on a jetpack!",255,0,0) else if (isPlayerInVehicle(getLocalPlayer()) then outputChatBox("You can't open your parachute in a vehicle!",255,0,0) else if (parachute) then destroyElement(parachute) setGravity(0.008) else parachute = createObject(3131,0,0,0) attachElementToElement(parachute,getLocalPlayer()) setGravity(0.002) end end end end end function fixKeys(getLocalPlayer()) bindKey("mouse1","down",workingChute) end addEventHandler("onClientPlayerJoin",getRootElement(),fixKeys) meta.xml <meta> <info author="MasterOfPuppets" decription="Allows a working parachute" version="1.0" type="script"/> <script src="parachuteclient.lua" type="client"/> </meta> Link to comment
Gamesnert Posted January 14, 2009 Share Posted January 14, 2009 Oh, there is just 1 little mistake that ruins everything... addEventHandler("onClientPlayerJoin",getRootElement(),fixKeys) This event is triggered when a player joins a server. It is triggered for all players other than the local player. So I'd recommend using onClientResourceStart. Link to comment
Vercetti1010 Posted January 14, 2009 Author Share Posted January 14, 2009 (edited) Thanks for the info on that event, I'll definitely try that out when I get home. However, i believe that even if the key bind executed perfectly, nothing would happen when I clicked my mouse. While testing, I added a temporary command to test the individual function and still nothing happened. No errors or warnings came of it and there was no parachute and gravity was still normal. Edited January 14, 2009 by Guest Link to comment
Gamesnert Posted January 14, 2009 Share Posted January 14, 2009 Thanks for the info on that event. However, i know for a fact that even if the key bind executed perfectly, nothing would happen when I clicked my mouse. While testing, I added a temporary command to test the individual function and still nothing happened. No errors or warnings came of it and there was no parachute and gravity was still normal. Stupid question, but is the resource even started? And otherwise, try putting outputChatBox("workingChute activated") after function workingChute(key,keyState). Just to see if the function is executed. EDIT: Just to make it a bit easier to understand... function workingChute(key,keyState) outputChatBox("workingChute activated") weapon = getPlayerWeapon(getLocalPlayer()) if (weapon == 46) then ........ Link to comment
Vercetti1010 Posted January 14, 2009 Author Share Posted January 14, 2009 Yeah, the resource was started. Who knows it may work. I'll take your advice on the chat box thing. Can I PM you if later today the script still does not work? Link to comment
robhol Posted January 16, 2009 Share Posted January 16, 2009 If you're having trouble with a script, the best thing to do would be to ask here, especially when you already have a topic opened. On another note, I'd like to suggest that you use "fire" in bindKey, instead of mouse click. That way it won't fuck up if people have re-mapped their controls. Link to comment
Gamesnert Posted January 16, 2009 Share Posted January 16, 2009 On another note, I'd like to suggest that you use "fire" in bindKey, instead of mouse click. That way it won't fuck up if people have re-mapped their controls. I guess that's the entire point... I guess if someone would map "fire" button differently, you wouldn't want to force someone to fire by using the mouse? Imagine someone being forced to use LMB while he always uses CTRL. Anyway, any result from the message? Link to comment
Scarface Posted January 17, 2009 Share Posted January 17, 2009 can this really work? i mean dosent mta have to have support for it? Link to comment
Gamesnert Posted January 17, 2009 Share Posted January 17, 2009 can this really work? i mean dosent mta have to have support for it? It can work, but it'll be difficult to make it just like in SP. I just don't get why the function doesn't appear to get triggered... Link to comment
darkdreamingdan Posted January 17, 2009 Share Posted January 17, 2009 You may be interested in this resource worked on by me and Jax: http://dan.bastage.net/mta/parachute.zip Its unfinished, and doesnt work exactly like SP but its pretty cool. Note this was made before we got animations, but you could most likely easily add them. edit: It used to work a lot better. Let me try fixing it up edit2: If you're on 1.0, try this version: Link removed For some reason getElementRotation returns the inverse of set Link to comment
darkdreamingdan Posted January 17, 2009 Share Posted January 17, 2009 I've been working on it some more since last post since i god caught up with it. I added animations to the chute now, it looks a lot more polished. Its also partially synced. I might spend tomorrow trying to sync it fully. After that sky diving needs adding. Here's that version: http://dan.bastage.net/mta/parachute_1.0.zip Note since it uses animations and such it requires the use of 1.0. Link to comment
Vercetti1010 Posted January 20, 2009 Author Share Posted January 20, 2009 Thanks a bunch Talidan! I have given up on this because something always screwed up for me lol, but I truly appreciate your work. The first link you posted will work with DP2.x i suppose. Thanks again Link to comment
darkdreamingdan Posted January 20, 2009 Share Posted January 20, 2009 Just so you know, i've been working (with the help of some faithful testers on IRC) on a complete version which includes skydiving and is much improved, but for 1.0 only. Its almost complete and imo its looking pretty good. i'll release it as soon as im done. Link to comment
Scarface Posted January 20, 2009 Share Posted January 20, 2009 Just so you know, i've been working (with the help of some faithful testers on IRC) on a complete version which includes skydiving and is much improved, but for 1.0 only. Its almost complete and imo its looking pretty good.i'll release it as soon as im done. By the way i wanted to comment on your script after seeing it yesterday, i think that the skydiving is too fast, i mean so is the SP's skydiving exaggerated but yours just is too fast, i mean i know its not finished and im not trying to offend you or something like that, but in my opinion you should take much longer to touch the ground while skydiving. Link to comment
Vercetti1010 Posted January 21, 2009 Author Share Posted January 21, 2009 (edited) Hey Talidan, I tested that script, and It didn't exactly work right. I am using DP2.X if you are wondering, and I chose the correct script. The parachute will open, but every time a frame is rendered, it gives a warning for getElementRotation saying its a nil value. My fall speed isn't slowed. The parachute will go away when you hit water or land though so that works. How can I make it slow me down? Edited January 21, 2009 by Guest Link to comment
arc_ Posted January 21, 2009 Share Posted January 21, 2009 As Talidan said, the script is made for MTA 1.0 and will not work in DP2. MTA 1.0 is not yet officially released but you can download nightly beta builds. You will also need the "data files" and "net module" archives from the Google Code page. Link to comment
Vercetti1010 Posted January 21, 2009 Author Share Posted January 21, 2009 The first one Talidan posted should work, at least according to the wiki it should. All the functions it uses are compatible with DP2.x. It could just be one of those times where things just refuse to work though. I always seem to have functions not work for no reason. Is it possible to use setGravity instead of changing the velocity of the player? 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