Jump to content

Help about camera on top of player


Flameeagle

Recommended Posts

Posted

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

Posted

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

Posted

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

Posted

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

Posted

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...