Jump to content

SetCameraMatrix Problem


Recommended Posts

Hi, i have a problem the "setCameraPosition" appears only after downloading, I want to happen in the download

addEventHandler("onPlayerJoin", root,                           
function() 
    outputChatBox("**Please wait, download in progress**", source, 255, 0, 0) 
    fadeCamera(source, true) 
     setCameraMatrix(source, 2003, -881, 130, 1832, -1249, 64) 
end ) 

Link to comment
  • MTA Team

You can add this option to your meta.xml if you want to start a script earlier than the others:

<download_priority_group>1</download_priority_group> 

Here is the explanation from the wiki:

If not set, the download priority group for a resource defaults to 0. If this is set higher than 0, then the resource will be downloaded and started on the client earlier than other resources. If set to less than 0, the resource will be downloaded and started on the client later than other resources.

In the early starting script you can change the environment prior to the download of the other resources.

  • Thanks 1
Link to comment

Just do what, Necktrox said, then put the code client sided and replace the onPlayerJoin event name to onClientResourceStart.

ADD this line on your meta.xml

<download_priority_group>99</download_priority_group> 

Then add this code:

client side:

addEventHandler ( "onClientResourceStart", resourceRoot,                           
    function ( ) 
         outputChatBox ( "**Please wait, download in progress**", 255, 0, 0 ) 
         fadeCamera ( true ) 
         setCameraMatrix ( 2003, -881, 130, 1832, -1249, 64 ) 
    end  
) 

Link to comment
  • Moderators

Keep it serverside, because (most of) the client scripts are starting after the download.

You could try to use a delay:

addEventHandler("onPlayerJoin", root, function() 
    setTimer(function (player) 
        if isElement(player)  then 
            outputChatBox("**Please wait, download in progress**", player, 255, 0, 0) 
            fadeCamera(player, true) 
            setCameraMatrix(player, 2003, -881, 130, 1832, -1249, 64) 
        end 
    end, 3000, 1, source) 
end) 

Link to comment

In my case, I run a race DM Server, When someone joins he has 2 downloads. Might this could sound weard but I will expalin it.

The first one create the folders ...etc, I suposse that it loads server side scripts. When this is downloaded, the camera matrix should be started. Then the 2nd download started. Well, now are downloading the client files. I dont know if u get me, but it could help u.

Regards.

Link to comment

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