Jump to content

Camera fade in after map stops in race gamemode


ALw7sH

Recommended Posts

Hi,

In the race gamemode after map stop the camera fade in (screen goes black)

my question is, is it script or its from mta itself? the weird thing is if you stop a running map in play gamemode for example the camera doesn't fade in but if you do it in race gamemode it does

And yes I have looked into the race gamemode codes and it is not the race gamemode

Link to comment
Have you edited anything on race gamemode ever? Edited anything? If you haven't, then there is most likely something of your scripts that messed up the race gamemode

I did edit it but it has nothing to do with what I'm saying because it is not something that shouldn't be there, the fade in is there by default

Link to comment
Maybe race_client > 'notifyLoadingMap' ?

Its nothing in the race gamemode itself because I have tried to turn off all the fadeCamera functions and still

The thing is when changing from map to another the race gamemode calls mapmanager, the mapmanager stop the map resource that was running, the screen goes black (camera fade in) right after stopping the map resource.

Even if I stop the map resource manually the screen goes black too.

The thing is I don't want the screen to fade in for players who are not logged in

Link to comment

Most probably happens due to this line of code in race_server.lua:

addEventHandler('onGamemodeMapStop', g_Root, 
    function(mapres) 
        --Clear the scoreboard 
        for i,player in ipairs(getElementsByType"player") do 
            setElementData ( player, "race rank", "" ) 
            setElementData ( player, "checkpoint", "" ) 
        end 
        fadeCamera ( g_RootPlayers, false, 0.0, 0,0, 0 ) 
        gotoState('NoMap') 
        unloadAll() 
    end 
) 

Link to comment
Most probably happens due to this line of code in race_server.lua:
addEventHandler('onGamemodeMapStop', g_Root, 
    function(mapres) 
        --Clear the scoreboard 
        for i,player in ipairs(getElementsByType"player") do 
            setElementData ( player, "race rank", "" ) 
            setElementData ( player, "checkpoint", "" ) 
        end 
        fadeCamera ( g_RootPlayers, false, 0.0, 0,0, 0 ) 
        gotoState('NoMap') 
        unloadAll() 
    end 
) 

It's not, I've already edited it to what I want but still same thing happens

Link to comment
  • Moderators

Add another two lua files clientside and serverside, load those files as last.

Add in both a wrapper function called fadeCamera and the traceback function from the site bellow.

  
local fadeCamera2 = fadeCamera 
function fadeCamera (...) 
    fadeCamera2(unpack({...})) 
   traceback () 
end  

function traceback () local level = 1 while true do local info = debug.getinfo(level, "Sl") if not info then break end if info.what == "C" then -- is a C function?  
outputChatBox("C function")  
else -- a Lua function  
outputChatBox(string.format("[%s]:%d", info.short_src, info.currentline)) end level = level + 1 end end 

https://www.lua.org/pil/23.1.html

Link to comment
Maybe it is map-manager.

I can assure you that the camera never fades to black, after the camera has been faded to visible. Unless a resource is doing it.

It's not the map manager too, I had a look at it, yes the race does calls the map manager to stop current map and starts the next map, when the map manager stop the current map the screen fades in immediately, but it has nothing to do with the map manager because even if you stop the current map from f8 or the admin panel the screen will fades in too

Link to comment

It might be when there is nothing to play the screen fades in and mostly not by a script but mta itself, I have done a fix it's not the greatest but it works I've put "fadeCamera(true)" onResourcePreStart, the camera fades in for like one second only do you guys know a better fix? I've tried to put it right after stopResource in map manager but it didn't worked

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