Flameeagle Posted January 25, 2016 Posted January 25, 2016 Hello all! i am making a script and i have made a checkbox named "topview". I want to make the camera look at the player from the top like in GTA2 when this checkbox is checked.. how can i do that? have tried with Timer.. its working but does not work with onClientRender.. btw i am using it in a Client Side script. I also want that when that checkbox is unchecked, the camera will return to the default using setCameraTarget().. i got the last part but cant make it attached to the top of the player and rotate it as the player rotates.. any help will be appreciated. Thanks. Paid Scripter/Developer worked behind a lot of RPG gamemode scripts, and scripts of varied functionality. Also working actively with Non-MTA related scripts especially in Python, websites, backend coding, as well as Server management and stuffs like those. PS: I'm better with Python than LUA-MTA. my discord: FlaMe#0704
tosfera Posted January 25, 2016 Posted January 25, 2016 use setCameraMatrix in a onClientRender from the position from the player by increasing the Z with a few, looking at the position of the player. ( really ugly way of doing this.. ) If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]
Flameeagle Posted January 25, 2016 Author Posted January 25, 2016 I have tried doing that but it does not work Paid Scripter/Developer worked behind a lot of RPG gamemode scripts, and scripts of varied functionality. Also working actively with Non-MTA related scripts especially in Python, websites, backend coding, as well as Server management and stuffs like those. PS: I'm better with Python than LUA-MTA. my discord: FlaMe#0704
Flameeagle Posted January 25, 2016 Author Posted January 25, 2016 The onGuiClick part: addEventHandler("onClientGUIClick",topview,function() setTimer(function() if guiCheckBoxGetSelected(topview)then local up = guiCreateButton(0.32, 0.05, 0.14, 0.03, "+", true, constructionsWindow) guiSetProperty(up, "NormalTextColour", "FFAAAAAA") local down = guiCreateButton(0.49, 0.05, 0.14, 0.03, "-", true, constructionsWindow) guiSetProperty(down, "NormalTextColour", "FFAAAAAA") isLookingUp = true lp=getLocalPlayer() --timer=setTimer(topviewer,51,0) addEventHandler("onClientRender",lp,topviewer) outputChatBox("DEBUG: callling...done") else isLookingUp = false --killTimer(timer) setCameraTarget(localPlayer) removeEventHandler("onClientRender",getLocalPlayer(),topviewer) end end,100,1) end,false) The functions: function topviewer() outputChatBox("DEBUG: Cam changed!") local x, y, z = getElementPosition ( localPlayer ) setCameraMatrix(x,y,z+25,x,y,z) end Paid Scripter/Developer worked behind a lot of RPG gamemode scripts, and scripts of varied functionality. Also working actively with Non-MTA related scripts especially in Python, websites, backend coding, as well as Server management and stuffs like those. PS: I'm better with Python than LUA-MTA. my discord: FlaMe#0704
Flameeagle Posted January 25, 2016 Author Posted January 25, 2016 if i make it with the timer, it works.. but not with the "onClientRender" Paid Scripter/Developer worked behind a lot of RPG gamemode scripts, and scripts of varied functionality. Also working actively with Non-MTA related scripts especially in Python, websites, backend coding, as well as Server management and stuffs like those. PS: I'm better with Python than LUA-MTA. my discord: FlaMe#0704
Flameeagle Posted January 25, 2016 Author Posted January 25, 2016 status Update: I have finally made it to work, but the controls are kinda f**ked up, what do i do? the camera is sticked to the player but the controls are like.. W for north, S for south, A for west and D for east, how do i fix it? Also i would like to allow the player to move Paid Scripter/Developer worked behind a lot of RPG gamemode scripts, and scripts of varied functionality. Also working actively with Non-MTA related scripts especially in Python, websites, backend coding, as well as Server management and stuffs like those. PS: I'm better with Python than LUA-MTA. my discord: FlaMe#0704
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