Jump to content

setCameraMatrix


Stevenn

Recommended Posts

Posted

Hello, i got a problem with setCameraMatrix.

function respawn ( totalammo, killer, killwerweapon, bodypart, stealth ) 
    setTimer ( setCameraMatrix, 1000, 1, source,  1187, -1324, 14 ) 
    fadeCamera ( source, false, 1, 0, 0, 0 ) 
    setTimer ( fadeCamera, 1500, 1, source, true ) 
    setTimer ( spawnPlayer, 5000, 1, source, 1179, -1325, 15, getElementModel ( source ) ) 
end 
addEventHandler ( "onPlayerWasted", root, respawn ) 

the camera view never changes, it should cancel the cameramatrix and let me play as usual after 5 seconds ( 5000 milliseconds )

Guest Guest4401
Posted

setCameraMatrix not something that can be cancelled.

Note: Calling this function takes the camera's focus away from the player and sets the camera in a fixed position and rotation. The camera's focus can be brought back to the player using the setCameraTarget function.

https://wiki.multitheftauto.com/wiki/setCameraTarget

Posted

thank you, but how can I do this:

addEvent ( "respawn:allsaints", true ) 
function allsaints () 
        dxDrawText("Hello",454.0,425.0,886.0,581.0,tocolor(255,255,255,255),2.0,"pricedown","left","top",false,false,false) 
end 
addEventHandler ( "respawn:allsaints", root, allsaints ) 

Guest Guest4401
Posted
thank you, but how can I do this:
addEvent ( "respawn:allsaints", true ) 
    function allsaints() 
        dxDrawText("Hello",454.0,425.0,886.0,581.0,tocolor(255,255,255,255),2.0,"pricedown","left","top",false,false,false) 
    end 
addEventHandler ( "respawn:allsaints", root, allsaints ) 

Draws a string of text on the screen for one frame. In order for the text to stay visible continuously, you need to call this function with the same parameters on each frame update (see onClientRender)

You must use onClientRender event to show dxText in every frame.

addEvent("respawn:allsaints",true) 
addEventHandler("respawn:allsaints",root, 
    function() 
        addEventHandler("onClientRender",root,drawTheText) 
    end 
) 
  
function drawTheText() 
    dxDrawText("Hello",454.0,425.0,886.0,581.0,tocolor(255,255,255,255),2.0,"pricedown","left","top",false,false,false) 
end 

Posted

thanks it works, but how can I destroy it after 5 seconds?

setTimer ( destroyElement, 5000, 1, localPlayer, drawTheText ) 

does not work

Posted
addEvent("respawn:allsaints",true) 
addEventHandler("respawn:allsaints",root, 
    function() 
        addEventHandler("onClientRender",root,drawTheText) 
    end 
) 
  
function drawTheText() 
    text = dxDrawText("Hello",454.0,425.0,886.0,581.0,tocolor(255,255,255,255),2.0,"pricedown","left","top",false,false,false) 
end 

setTimer ( destroyElement, 5000, 1, text ) 

Guest Guest4401
Posted

Try this

addEvent("respawn:allsaints",true) 
addEventHandler("respawn:allsaints",root, 
function() 
    addEventHandler("onClientRender",root,drawTheText); 
    setTimer( 
        function() 
            removeEventHandler("onClientRender",root,drawTheText) 
        end 
    ,5000,1 
    ) 
end 
); 
  
function drawTheText() 
    dxDrawText("Hello",454.0,425.0,886.0,581.0,tocolor(255,255,255,255),2.0,"pricedown"); 
end; 

Posted

Because you are not putting it correctly by yourself.

addEvent("respawn:allsaints",true) 
addEventHandler("respawn:allsaints",root, 
    function() 
        addEventHandler("onClientRender",root,drawTheText) 
    end 
) 
  
function drawTheText() 
    text = dxDrawText("Hello",454.0,425.0,886.0,581.0,tocolor(255,255,255,255),2.0,"pricedown","left","top",false,false,false) 
    setTimer ( destroyElement, 5000, 1, text ) 
end 
  

I suggest you to start learning lua first, you could have fixed this yourself. There are errors, so try to fix it yourself now.

Posted
Because you are not putting it correctly by yourself.
addEvent("respawn:allsaints",true) 
addEventHandler("respawn:allsaints",root, 
    function() 
        addEventHandler("onClientRender",root,drawTheText) 
    end 
) 
  
function drawTheText() 
    text = dxDrawText("Hello",454.0,425.0,886.0,581.0,tocolor(255,255,255,255),2.0,"pricedown","left","top",false,false,false) 
    setTimer ( destroyElement, 5000, 1, text ) 
end 
  

I suggest you to start learning lua first, you could have fixed this yourself. There are errors, so try to fix it yourself now.

oh my god

setTimer into onClientRender event? :o

also dxDrawText return bool NOT element.

I suggest you to start learning lua first << lol

Posted
Because you are not putting it correctly by yourself.
addEvent("respawn:allsaints",true) 
addEventHandler("respawn:allsaints",root, 
    function() 
        addEventHandler("onClientRender",root,drawTheText) 
    end 
) 
  
function drawTheText() 
    text = dxDrawText("Hello",454.0,425.0,886.0,581.0,tocolor(255,255,255,255),2.0,"pricedown","left","top",false,false,false) 
    setTimer ( destroyElement, 5000, 1, text ) 
end 
  

I suggest you to start learning lua first, you could have fixed this yourself. There are errors, so try to fix it yourself now.

oh my god

setTimer into onClientRender event? :o

also dxDrawText return bool NOT element.

I suggest you to start learning lua first << lol

I am not helping those who cannot have no effort to take a look into what is in the script, even.

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...