Discord Moderators Pirulax Posted July 9, 2017 Discord Moderators Share Posted July 9, 2017 So, i want to create a dead system, and i need 1 thing, and that is: cancelling the camera shake effect when the player dies.. And i want to reanimate the player when i use SetElementHealth(...) I already tried setCameraTarget() but not worked.. Thanks in advance. Link to comment
kieran Posted July 9, 2017 Share Posted July 9, 2017 (edited) You tried setCameraMatrix? Only way I can think of... Try it adding a handler for onPlayerWasted Edited July 9, 2017 by kieran Link to comment
Discord Moderators Pirulax Posted July 9, 2017 Author Discord Moderators Share Posted July 9, 2017 1 minute ago, kieran said: You tried setCameraMatrix? Only way I can think of... Try it adding a handler for onPlayerWasted I dont think so, because setCameraTarget already does that. But, i'll give it a try.Tomorrow Link to comment
kieran Posted July 9, 2017 Share Posted July 9, 2017 No, SetCameraTarget only sets a target for the camera, SetCameraMatrix will set the position of the camera, this giving the possibility to stop swaying when you die, have a look at this tutorial I found on YouTube, it is for a login panel, but much the same idea, instead just get the players x, y and z when he dies Link to comment
Discord Moderators Pirulax Posted July 9, 2017 Author Discord Moderators Share Posted July 9, 2017 20 minutes ago, kieran said: No, SetCameraTarget only sets a target for the camera, SetCameraMatrix will set the position of the camera, this giving the possibility to stop swaying when you die, have a look at this tutorial I found on YouTube, it is for a login panel, but much the same idea, instead just get the players x, y and z when he dies are you talking about canceling the shake effect, or the dead thing? 1 Link to comment
kieran Posted July 10, 2017 Share Posted July 10, 2017 shake effect, so you'll be able to set your own camera, make it zoom out, or make it zoom in :3 also if you want no screen at all you can just fadeCamera Link to comment
Discord Moderators Pirulax Posted July 10, 2017 Author Discord Moderators Share Posted July 10, 2017 Will not work, bcuz camera is on event.. onClientPreRender. Link to comment
kieran Posted July 10, 2017 Share Posted July 10, 2017 7 minutes ago, Pirulax said: Will not work, bcuz camera is on event.. onClientPreRender. Have you made your own script? Link to comment
Discord Moderators Pirulax Posted July 10, 2017 Author Discord Moderators Share Posted July 10, 2017 Just now, kieran said: Have you made your own script? Will made it tomorrow.. Link to comment
kieran Posted July 10, 2017 Share Posted July 10, 2017 so how can it already be on a event? The way I understand it is that if you set the camera matrix of a player and put the onPlayerWasted handler on the function your camera will be set to that exact position as it would (in theory) over ride the original respawnPlayer.... Just try it and see what happens, kinda hard with no script or explanation to how you made the script. Link to comment
Discord Moderators Pirulax Posted July 10, 2017 Author Discord Moderators Share Posted July 10, 2017 7 hours ago, kieran said: so how can it already be on a event? The way I understand it is that if you set the camera matrix of a player and put the onPlayerWasted handler on the function your camera will be set to that exact position as it would (in theory) over ride the original respawnPlayer.... Just try it and see what happens, kinda hard with no script or explanation to how you made the script. I said that the original respawnPlayer camera shake is on onClientPreRender..and setCameraMatrix will work only for 1 frame. Link to comment
koragg Posted July 10, 2017 Share Posted July 10, 2017 (edited) 2 hours ago, Pirulax said: I said that the original respawnPlayer camera shake is on onClientPreRender..and setCameraMatrix will work only for 1 frame. What are you talking about? Nowhere on the wiki does it say that it lasts for only one frame. Even the example is done with onPlayerJoin and not onClientRender And you can try to make a different function which sets the camera matrix how you want it and then just do 'addEventHandler("onPlayerWasted", root, cameraFunc)' in the preRender function. Worth a try, give code it's hard like this... Edited July 10, 2017 by koragg Link to comment
Discord Moderators Pirulax Posted July 10, 2017 Author Discord Moderators Share Posted July 10, 2017 (edited) Did u read what i said?The original camera shaking is handled with onClientPreRender, and if i use setCameraMatrix than the camera will look at the position for only 1 frame...And then the original camera shaking will overwrite the position. Edited July 10, 2017 by Pirulax Link to comment
koragg Posted July 10, 2017 Share Posted July 10, 2017 (edited) https://wiki.multitheftauto.com/wiki/OnClientPreRender The example says it follows the player in a GTA2 way, so doesn't that mean that it's called every frame? Anyway here's an idea: function setNewCameraTarget() setCameraMatrix(1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316) -- obviosly change the numbers to the position you want^ end function onPlayerWasted() -- default shake camera function --blablabla addEventHandler("onClientRender", root, setNewCameraTarget) -- you force it to use your camera spot on every frame end addEventHandler("onClientPreRender", root, onPlayerWasted) Edited July 10, 2017 by koragg Link to comment
Simple0x47 Posted July 10, 2017 Share Posted July 10, 2017 What about using fadeCamera so the player cannot see anything? Link to comment
Discord Moderators Pirulax Posted July 10, 2017 Author Discord Moderators Share Posted July 10, 2017 1 minute ago, Uknown. said: What about using fadeCamera so the player cannot see anything? Off topic.. i want to cancel the camera shake, and not to fade the players camera. Link to comment
Simple0x47 Posted July 10, 2017 Share Posted July 10, 2017 There's no way to do it with 0 health. Just make a client render and check if health goes under 1 make it 1 and when it's one put the wasted animation and done. 2 Link to comment
pa3ck Posted July 10, 2017 Share Posted July 10, 2017 (edited) local deathX, deathY, deathZ function onPWasted() if source == localPlayer then deathX, deathY, deatZ = getElementPosition(localPlayer) addEventHandler("onClientPreRender", root, renderPedWasted) end end addEventHandler("onClientPedWasted", root, onPWasted) function renderPedWasted() setCameraMatrix(deathX + 2, deathY + 2, deathZ + 15, deathX, deathY, deathZ) end function onPSpawned() if source == localPlayer and deathX then removeEventHandler("onClientPreRender", root, renderPedWasted) deathX, deathY, deathZ = nil, nil, nil end end addEventHandler("onClientPlayerSpawn", root, onPSpawned) Try this, not tested.. use debugscript to fix any problems that might occur, if you can't fix it, come back with the results / errors. Never use setElementHealth to spawn a player after death. Edited July 10, 2017 by pa3ck Link to comment
Discord Moderators Pirulax Posted July 10, 2017 Author Discord Moderators Share Posted July 10, 2017 Figured anything out, the topic can be closed.Need to create a script.Btw i want to use it for RP server Link to comment
pa3ck Posted July 11, 2017 Share Posted July 11, 2017 You just realized that you'll need to create a script? Wow, you thought if you concentrate really hard MTA will be able to do it for you without any code? 1 Link to comment
Discord Moderators Pirulax Posted July 11, 2017 Author Discord Moderators Share Posted July 11, 2017 11 hours ago, pa3ck said: You just realized that you'll need to create a script? Wow, you thought if you concentrate really hard MTA will be able to do it for you without any code? Yey, off topic... you are so funny.... Link to comment
koragg Posted July 11, 2017 Share Posted July 11, 2017 12 minutes ago, Pirulax said: Yey, off topic... you are so funny.... You're one of those guys who want everything done by somebody else. Read the rules of the section, take a course in good manners and maybe try to make something yourself. Good luck. 1 Link to comment
Discord Moderators Pirulax Posted July 11, 2017 Author Discord Moderators Share Posted July 11, 2017 4 minutes ago, koragg said: You're one of those guys who want everything done by somebody else. Read the rules of the section, take a course in good manners and maybe try to make something yourself. Good luck. Did i mention somehwere that i want done scripts?I dont think so, i just wanted a function, a freaking in-built MTA function for it.. if theres no in-built function, than okey, i will write a lua one, and thats it... i didnt mention that i want a full script... omg 21 hours ago, Uknown. said: There's no way to do it with 0 health. Just make a client render and check if health goes under 1 make it 1 and when it's one put the wasted animation and done. Lol, good idea And freeze the player + anim, and thats it. Link to comment
Simple0x47 Posted July 11, 2017 Share Posted July 11, 2017 1 hour ago, Pirulax said: Did i mention somehwere that i want done scripts?I dont think so, i just wanted a function, a freaking in-built MTA function for it.. if theres no in-built function, than okey, i will write a lua one, and thats it... i didnt mention that i want a full script... omg Lol, good idea And freeze the player + anim, and thats it. No like to my reply then :v? 1 Link to comment
Discord Moderators Pirulax Posted July 11, 2017 Author Discord Moderators Share Posted July 11, 2017 I never like replies, but, i will like ur reply 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