Jump to content

Matrix Camera Countdown. Help please.


novo

Recommended Posts

Posted

Hi all.

I found a script for matrix camera on countdown.

I don't know why it's not working, please help me:

Client-side: (countC.lua)

------------------------------------------------------------------------ 
--Copyright ©, Jesseunit 
--Please, do not Re-distribute 
------------------------------------------------------------------------- 
  
local start = getTickCount(); 
local duration = 5000; 
local screenWidth, screenHeight = guiGetScreenSize(); 
local font = "bankgothic"; 
local scale = 2; 
local jij = getLocalPlayer() 
  
countMsg = { 
"Get ready for the countdown..." 
} 
  
local text = countMsg[#countMsg]; 
  
function addText(text) 
    table.insert(countMsg, text) 
end 
  
addEvent("addTextdoor", true) 
addEventHandler("addTextdoor", root, 
    function(text) 
        addText(text) 
    end 
) 
  
function countRender() 
    if stoprender == false then 
        if not tickcount then tickcount = getTickCount () end 
        if not alpha then alpha = 255 end 
        local seconds = getTickCount() - tickcount 
        alpha = alpha - (seconds / 200) 
        alpha2 = alpha - 105 
        if alpha2 <= 0 then alpha2 = 0 end 
        if alpha <= 0 then 
            removeEventHandler("onClientRender", getRootElement(), countRender) 
            alpha = 0 
        end 
    else 
        alpha2 = 150 
        alpha = 255 
    end 
        local now = getTickCount() 
        local time = now - start 
        local width = dxGetTextWidth(text, scale, font) 
  
        dxDrawRectangle(0, screenHeight-400.0, screenWidth, 50, tocolor(0, 0, 0, alpha2 or 150)) 
  
        if (time > duration) then 
            start = now 
  
            text = countMsg[math.random(1, #countMsg)] 
            return 
        end 
    local modi = duration - time 
    dxDrawText(text, math.mod(modi, duration) / duration * (screenWidth + width) - width, screenHeight-408.0, 0, 0, tocolor(0, 161, 255, alpha or 255), scale, font) 
end 
  
function onClientRaceStateChanging ( newStateName, oldStateName) 
    if oldStateName == "PreGridCountdown" then 
        stoprender = true 
        addEventHandler("onClientRender", getRootElement(), countRender) 
    end 
    if newStateName == "GridCountdown" then 
        setTimer(function() stoprender = false end, 3500, 1) 
        local x,y,z = getElementPosition(getPedOccupiedVehicle(jij)) 
        timer1 = setTimer(setCameraMatrix, 6000, 1, x + 1, y + 4, z + 2, x, y, z, 10, 0) 
        timer2 = setTimer(setCameraMatrix, 7000, 1, x + 5, y - 4, z + 4, x, y, z, 55, 0) 
        timer3 = setTimer(setCameraMatrix, 8000, 1, x - 3, y + 5, z + 3, x, y, z, 21, 0) 
    end 
    if newStateName == "Running" then 
        setCameraTarget(jij) 
    end 
end 
addEvent( "onPlayersReady", true ) 
addEventHandler( "onPlayersReady", getRootElement(), onClientRaceStateChanging ) 
  
function restartMap() 
    killTimer(timer1) 
    killTimer(timer2) 
    killTimer(timer3) 
end 
addCommandHandler("redo",restartMap) 

Server-side: (countS.lua)

addEvent("onRaceStateChanging", true) 
addEventHandler("onRaceStateChanging", getRootElement(), 
function(newStateName, oldStateName) 
    triggerClientEvent ( "onPlayersReady", getRootElement(), newStateName, oldStateName) 
end) 
  

Meta.xml:

  
<meta> 
    <info author="Jesseunit" version="1" type="script" /> 
    <script src="countC.lua" type="client" /> 
    <script src="counts.lua" type="server" /> 
</meta> 
  

Please help.

Thanks <3

Posted
------------------------------------------------------------------------ 
--Copyright ©, Jesseunit 
--Please, do not Re-distribute 
------------------------------------------------------------------------- 
  
local start = getTickCount(); 
local duration = 5000; 
local screenWidth, screenHeight = guiGetScreenSize(); 
local font = "bankgothic"; 
local scale = 2; 
local jij = getLocalPlayer() 
  
countMsg = { 
"Get ready for the countdown..." 
} 
  
local text = countMsg[#countMsg]; 
  
function addText(text) 
    table.insert(countMsg, text) 
end 
  
addEvent("addTextdoor", true) 
addEventHandler("addTextdoor", root, 
    function(text) 
        addText(text) 
    end 
) 
  
function countRender() 
    if stoprender == false then 
        if not tickcount then tickcount = getTickCount () end 
        if not alpha then alpha = 255 end 
        local seconds = getTickCount() - tickcount 
        alpha = alpha - (seconds / 200) 
        alpha2 = alpha - 105 
        if alpha2 <= 0 then alpha2 = 0 end 
        if alpha <= 0 then 
            removeEventHandler("onClientRender", getRootElement(), countRender) 
            alpha = 0 
        end 
    else 
        alpha2 = 150 
        alpha = 255 
    end 
        local now = getTickCount() 
        local time = now - start 
        local width = dxGetTextWidth(text, scale, font) 
  
        dxDrawRectangle(0, screenHeight-400.0, screenWidth, 50, tocolor(0, 0, 0, alpha2 or 150)) 
  
        if (time > duration) then 
            start = now 
  
            text = countMsg[math.random(1, #countMsg)] 
            return 
        end 
    local modi = duration - time 
    dxDrawText(text, math.mod(modi, duration) / duration * (screenWidth + width) - width, screenHeight-408.0, 0, 0, tocolor(0, 161, 255, alpha or 255), scale, font) 
end 
  
function onClientRaceStateChanging ( newStateName, oldStateName) 
    if oldStateName == "PreGridCountdown" then 
        stoprender = true 
        addEventHandler("onClientRender", getRootElement(), countRender) 
    end 
    if newStateName == "GridCountdown" then 
        setTimer(function() stoprender = false end, 3500, 1) 
        local x,y,z = getElementPosition(getPedOccupiedVehicle(jij)) 
        timer1 = setTimer(setCameraMatrix, 6000, 1, x + 1, y + 4, z + 2, x, y, z, 10, 0) 
        timer2 = setTimer(setCameraMatrix, 7000, 1, x + 5, y - 4, z + 4, x, y, z, 55, 0) 
        timer3 = setTimer(setCameraMatrix, 8000, 1, x - 3, y + 5, z + 3, x, y, z, 21, 0) 
        timer4 = setTimer(setCameraTarget, 9000, 1, jij) 
    end 
    if newStateName == "Running" then 
        setCameraTarget(jij) 
    end 
end 
addEvent( "onPlayersReady", true ) 
addEventHandler( "onPlayersReady", getRootElement(), onClientRaceStateChanging ) 
  
function restartMap() 
    killTimer(timer1) 
    killTimer(timer2) 
    killTimer(timer3) 
end 
addCommandHandler("redo",restartMap) 

Posted
You know, we don't help to stealers novo.

Novo has already been helped. Your post is irrelevant..

I guess it's a +1 for your total count..

I most of the times never read the full topic.

Posted
I don't see why people help script stealers... But yeah, NVM.

Look at me. I could have helped but I didn't. Castillo did.

Posted
I don't see why people help script stealers... But yeah, NVM.

When I see that is a stolen script, I don't help them, but I couldn't know, maybe it was a resource from the MTA community and he was just editing it, I can't download every resource and compare them ;).

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