Jump to content

SetCameraMatrix Problem


Recommended Posts

Posted

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 ) 

  • MTA Team
Posted

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
Posted

the Problem is ,it will still trigger even tho the player has all the files done because the function is

onPlayerJoin 

it triggers everytime when a player joins your server even tho they have the download done.

  • MTA Team
Posted

He can make a clientside script, which will fade the camera in and change the camera matrix on resource start. I never implied he is forced to use onPlayerJoin.

Posted

Client Side ::

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

Then use the download group thing at 1

That's all you need.

Posted

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  
) 

  • Moderators
Posted

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) 

Posted

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.

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