iNetz Posted November 14, 2013 Share Posted November 14, 2013 Hello - I'm currently working on a simple gamemode, and i've encountered a problem. I want the local player's camera to drop when he dies - meaning it should remain static by the player's last coordinates, but it somehow bugs when the player dies and is in a vehicle. Somehow setCameraMatrix( getCameraMatrix() ) turns ineffective. I've tried destroying the vehicle and setting the camera matrix when the event "onClientPlayerWasted" is triggered.. but nothing.. it still follows either the player or the vehicle, and after some time the "wasted" animation starts. I'd really appreciate any help. Thanks. Link to comment
xXMADEXx Posted November 14, 2013 Share Posted November 14, 2013 So, you are trying to make a kill-cam type of script to watch the killer? Link to comment
TrapLord Studios™ Posted November 14, 2013 Share Posted November 14, 2013 Try creating your own Function for the Camera to Drop: "function freecamFrame" Link to comment
iNetz Posted November 14, 2013 Author Share Posted November 14, 2013 So, you are trying to make a kill-cam type of script to watch the killer? Yes, but first I want to give it some time until the camera target is set. Try creating your own Function for the Camera to Drop:"function freecamFrame" That's what I've tried to do with setCameraMatrix ( getCameraMatrix () ), what are you suggesting? Link to comment
TrapLord Studios™ Posted November 14, 2013 Share Posted November 14, 2013 Mind if I see the code? Link to comment
iNetz Posted November 14, 2013 Author Share Posted November 14, 2013 It's actually a quite big piece of code, but related to the camera would only be: function onClientWasted () dropCamera () end addEventHandler ( "onClientPlayerWasted", localPlayer, onClientWasted ) function dropCamera () setCameraMatrix (getCameraMatrix()) -- I've also tried using -- setTimer ( setCameraMatrix, 50, 10, getCameraMatrix() ) end Link to comment
tosfera Posted November 14, 2013 Share Posted November 14, 2013 why don't you just check if the ped is in a vehicle, if so. Remove the ped from the vehicle, then get its coords and after that, you'll set the matrix. Link to comment
iNetz Posted November 14, 2013 Author Share Posted November 14, 2013 Ye I've also tried that but it still focus the player.. it's just weird. Link to comment
tosfera Posted November 14, 2013 Share Posted November 14, 2013 One little script, that makes your day ( I hope ); addEventHandler ( "onClientPlayerWasted", root, function ( thePlayer ) if ( isPedInVehicle ( thePlayer ) ) then removePedFromVehicle ( thePlayer ); end local x, y, z, lookx, looky, lookz = getCameraMatrix(); setCameraMatrix ( x, y, z, lookx, looky, lookz ); end ); Link to comment
iNetz Posted November 14, 2013 Author Share Posted November 14, 2013 One little script, that makes your day ( I hope ); addEventHandler ( "onClientPlayerWasted", root, function ( thePlayer ) if ( isPedInVehicle ( thePlayer ) ) then removePedFromVehicle ( thePlayer ); end local x, y, z, lookx, looky, lookz = getCameraMatrix(); setCameraMatrix ( x, y, z, lookx, looky, lookz ); end ); I've change it to: addEventHandler ( "onClientPlayerWasted", localPlayer, -- changed to localPlayer as I only want it to take effect on the local client function ( thePlayer ) if ( isPedInVehicle ( source) ) then -- source because the first argument is the player's killer -- removePedFromVehicle ( source); -- moved to server side since the vehicle was created server side end local x, y, z, lookx, looky, lookz = getCameraMatrix(); setCameraMatrix ( x, y, z, lookx, looky, lookz ); end ); Still didn't work. Link to comment
iNetz Posted November 14, 2013 Author Share Posted November 14, 2013 Sorry for the double post but I've just fixed the problem (pretty stupid of me lol) I was still destroying the player's vehicle and that was causing it to focus the player. I really appreciate all the help from you guys! Thank you Link to comment
tosfera Posted November 14, 2013 Share Posted November 14, 2013 ahh I see, I failed my script die-hard. The source of the event is the player that died so my 'thePlayer' is messed up. Let me try and run it in my server. edit; works for me. Link to comment
iNetz Posted November 14, 2013 Author Share Posted November 14, 2013 Sorry for the double post but I've just fixed the problem (pretty stupid of me lol)I was still destroying the player's vehicle and that was causing it to focus the player. I really appreciate all the help from you guys! Thank you Ye it was my bad, sorry for the trouble. And thank you for being so helpful : ) 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