Jump to content

KILL CAMERA


Malak

Recommended Posts

Hello guys,

Today i am asking you about a problem of optimisation of the recording a video in mta.

I want to record a sentance of 15 secondes and then replay it after sent it to the guy who get killed by the killer.

There is my code for testing the recording :

local Replay = {} 
Replay.state = 0 
Replay.count = 0 
Replay.decount = 0 
local screenWidth,screenHeight = guiGetScreenSize() 
function onRecordReplay() 
    Replay.screensource = dxCreateScreenSource ( screenWidth/2, screenHeight/2 )   
    Replay.state = 1 
    Replay.record = {} 
    addEventHandler("onClientRender",root,ReplayFunction) 
end 
function onStopReplay() 
    removeEventHandler("onClientRender",root,ReplayFunction) 
    Replay.screensource = nil 
    Replay.state = 0 
    Replay.record = {} 
end 
function checkPlayerDeath() 
    if getElementData(source,"replay") == true then 
        outputDebugString("Replay Launch") 
        Replay.state = 2 
    end 
end 
addEventHandler("onClientPlayerWasted", root, checkPlayerDeath) 
  
addCommandHandler("replay", function() 
    if getElementData(localPlayer,"replay") == true then 
        setElementData(localPlayer,"replay",false) 
        onStopReplay() 
    else 
        setElementData(localPlayer,"replay",true) 
        onRecordReplay() 
    end 
end) 
  
function ReplayFunction() 
    if Replay.state == 1 then 
        if  Replay.count < 151 then 
            outputDebugString("Record ".. Replay.count) 
             dxUpdateScreenSource( Replay.screensource )   
             Replay.record[Replay.count] =  dxCreateTexture(dxGetTexturePixels (Replay.screensource)) 
             Replay.count = Replay.count+1 
        end 
    elseif Replay.state == 2 then 
        if Replay.decount < Replay.count then 
            outputDebugString("Show "..Replay.decount) 
            dxDrawImage( screenWidth - screenWidth,  screenHeight - screenHeight,  screenWidth, screenHeight, Replay.record[Replay.decount], 0, 0, 0, tocolor (255, 255, 255, 255), true)       
            Replay.decount = Replay.decount+1 
        end 
    end 
end 

Actually this little code work but when i am recording i am lagging so hard and fps drop to 5. due to dxCreateTexture and dxGetTexturePixels so i ask you if you have another idea to stock my image for record it after.

Link to comment
  • 2 weeks later...
  • 1 month later...

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