Jump to content

Error.


Recommended Posts

In this script when i try to restart any resource...the camera Starts.. :/

    local sm = {} 
    sm.moov = 0 
    sm.object1, sm.object2 = nil, nil 
      
    function removeCamHandler ( ) 
        if ( sm.moov == 1 ) then 
            sm.moov = 0 
            removeEventHandler ( "onClientPreRender", getRootElement(), camRender ) 
        end 
    end 
      
    function camRender () 
        local x1, y1, z1 = getElementPosition ( sm.object1 ) 
        local x2, y2, z2 = getElementPosition ( sm.object2 ) 
        setCameraMatrix ( x1, y1, z1, x2, y2, z2 ) 
    end 
      
    function smoothMoveCamera ( x1, y1, z1, x1t, y1t, z1t, x2, y2, z2, x2t, y2t, z2t, time ) 
        if(sm.moov == 1) then return false end 
        sm.object1 = createObject ( 1337, x1, y1, z1 ) 
        sm.object2 = createObject ( 1337, x1t, y1t, z1t ) 
        setElementAlpha ( sm.object1, 0 ) 
        setElementAlpha ( sm.object2, 0 ) 
        setObjectScale(sm.object1, 0.01) 
        setObjectScale(sm.object2, 0.01) 
        moveObject ( sm.object1, time, x2, y2, z2, 0, 0, 0, "InOutQuad" ) 
        moveObject ( sm.object2, time, x2t, y2t, z2t, 0, 0, 0, "InOutQuad" ) 
      
        addEventHandler ( "onClientPreRender", getRootElement(), camRender ) 
        sm.moov = 1 
        sm.timer1 = setTimer ( removeCamHandler, time, 1 ) 
        sm.timer2 = setTimer ( destroyElement, time, 1, sm.object1 ) 
        sm.timer3 = setTimer ( destroyElement, time, 1, sm.object2 ) 
      
        return true 
    end 
      
    addEventHandler ( "onClientResourceStart", root, 
        function ( ) 
            smoothMoveCamera ( 2317.369140625, 687.4677734375, 59.040821075439, 2407.83984375, 569.1337890625, 40.787521362305, 2227.458984375, 598.650390625, 29.868627548218, 2298.16015625, 572.3984375, 28.285842895508, 5000 ) 
        end 
    ) 
      
    addEvent ( "stopCamera", true ) 
    addEventHandler ( "stopCamera", root, 
        function ( ) 
            removeCamHandler ( ) 
            if isElement ( sm.object1 ) then 
                destroyElement ( sm.object1 ) 
            end 
            if isElement ( sm.object2 ) then 
                destroyElement ( sm.object2 ) 
            end 
            if isTimer ( sm.timer1 ) then 
                killTimer ( sm.timer1 ) 
            end 
            if isTimer ( sm.timer2 ) then 
                killTimer ( sm.timer2 ) 
            end 
            if isTimer ( sm.timer3 ) then 
                killTimer ( sm.timer3 ) 
            end 
            sm = { } 
        end 
    ) 

how to fix it?

Link to comment
  • Moderators
Better yet..
addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), 

You don't want any other resource restarting to effect it, right?

resourceRoot gives the same result as this shit..... getResourceRootElement(getThisResource()).........

resourceRoot is the output of those 2 functions.

Link to comment

resourceRoot gives the same result as this :~..... getResourceRootElement(getThisResource()).........

resourceRoot is the output of those 2 functions.

Oh really? Apologies then, I thought it only gave the output for the first function. Nevermind :P

Edited by Guest
Link to comment
Better yet..
addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), 

You don't want any other resource restarting to effect it, right?

Works Fine :)..Thanks a lot.

But when the player login the camera don't stop.....still works... :/ i can't control my ped..need help

    local sm = {} 
    sm.moov = 0 
    sm.object1, sm.object2 = nil, nil 
      
    function removeCamHandler ( ) 
        if ( sm.moov == 1 ) then 
            sm.moov = 0 
            removeEventHandler ( "onClientPreRender", getRootElement(), camRender ) 
        end 
    end 
      
    function camRender () 
        local x1, y1, z1 = getElementPosition ( sm.object1 ) 
        local x2, y2, z2 = getElementPosition ( sm.object2 ) 
        setCameraMatrix ( x1, y1, z1, x2, y2, z2 ) 
    end 
      
    function smoothMoveCamera ( x1, y1, z1, x1t, y1t, z1t, x2, y2, z2, x2t, y2t, z2t, time ) 
        if(sm.moov == 1) then return false end 
        sm.object1 = createObject ( 1337, x1, y1, z1 ) 
        sm.object2 = createObject ( 1337, x1t, y1t, z1t ) 
        setElementAlpha ( sm.object1, 0 ) 
        setElementAlpha ( sm.object2, 0 ) 
        setObjectScale(sm.object1, 0.01) 
        setObjectScale(sm.object2, 0.01) 
        moveObject ( sm.object1, time, x2, y2, z2, 0, 0, 0, "InOutQuad" ) 
        moveObject ( sm.object2, time, x2t, y2t, z2t, 0, 0, 0, "InOutQuad" ) 
      
        addEventHandler ( "onClientPreRender", getRootElement(), camRender ) 
        sm.moov = 1 
        sm.timer1 = setTimer ( removeCamHandler, time, 1 ) 
        sm.timer2 = setTimer ( destroyElement, time, 1, sm.object1 ) 
        sm.timer3 = setTimer ( destroyElement, time, 1, sm.object2 ) 
      
        return true 
    end 
      
    addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), 
        function ( ) 
            smoothMoveCamera ( 2317.369140625, 687.4677734375, 59.040821075439, 2407.83984375, 569.1337890625, 40.787521362305, 2227.458984375, 598.650390625, 29.868627548218, 2298.16015625, 572.3984375, 28.285842895508, 5000 ) 
        end 
   ) 
      
    addEvent ( "stopCamera", true ) 
    addEventHandler ( "stopCamera", root, 
        function ( ) 
            removeCamHandler ( ) 
            if isElement ( sm.object1 ) then 
                destroyElement ( sm.object1 ) 
            end 
            if isElement ( sm.object2 ) then 
                destroyElement ( sm.object2 ) 
            end 
            if isTimer ( sm.timer1 ) then 
                killTimer ( sm.timer1 ) 
            end 
            if isTimer ( sm.timer2 ) then 
                killTimer ( sm.timer2 ) 
            end 
            if isTimer ( sm.timer3 ) then 
                killTimer ( sm.timer3 ) 
            end 
            sm = { } 
        end 
    ) 

server:

    addEventHandler ( "onPlayerLogin", root, 
        function ( ) 
            triggerClientEvent ( source, "stopCamera", source ) 
        end 
    ) 
    addEventHandler ("onPlayerJoin", root, 
    function ( ) 
                fadeCamera(source, true, 2.0)  
        end 
    ) 

Link to comment
Better yet..
addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), 

You don't want any other resource restarting to effect it, right?

Works Fine ..Thanks a lot.

But when the player login the camera don't stop.....still works... :/ i can't control my ped..need help

    local sm = {} 
    sm.moov = 0 
    sm.object1, sm.object2 = nil, nil 
      
    function removeCamHandler ( ) 
        if ( sm.moov == 1 ) then 
            sm.moov = 0 
            removeEventHandler ( "onClientPreRender", getRootElement(), camRender ) 
        end 
    end 
      
    function camRender () 
        local x1, y1, z1 = getElementPosition ( sm.object1 ) 
        local x2, y2, z2 = getElementPosition ( sm.object2 ) 
        setCameraMatrix ( x1, y1, z1, x2, y2, z2 ) 
    end 
      
    function smoothMoveCamera ( x1, y1, z1, x1t, y1t, z1t, x2, y2, z2, x2t, y2t, z2t, time ) 
        if(sm.moov == 1) then return false end 
        sm.object1 = createObject ( 1337, x1, y1, z1 ) 
        sm.object2 = createObject ( 1337, x1t, y1t, z1t ) 
        setElementAlpha ( sm.object1, 0 ) 
        setElementAlpha ( sm.object2, 0 ) 
        setObjectScale(sm.object1, 0.01) 
        setObjectScale(sm.object2, 0.01) 
        moveObject ( sm.object1, time, x2, y2, z2, 0, 0, 0, "InOutQuad" ) 
        moveObject ( sm.object2, time, x2t, y2t, z2t, 0, 0, 0, "InOutQuad" ) 
      
        addEventHandler ( "onClientPreRender", getRootElement(), camRender ) 
        sm.moov = 1 
        sm.timer1 = setTimer ( removeCamHandler, time, 1 ) 
        sm.timer2 = setTimer ( destroyElement, time, 1, sm.object1 ) 
        sm.timer3 = setTimer ( destroyElement, time, 1, sm.object2 ) 
      
        return true 
    end 
      
    addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), 
        function ( ) 
            smoothMoveCamera ( 2317.369140625, 687.4677734375, 59.040821075439, 2407.83984375, 569.1337890625, 40.787521362305, 2227.458984375, 598.650390625, 29.868627548218, 2298.16015625, 572.3984375, 28.285842895508, 5000 ) 
        end 
   ) 
      
    addEvent ( "stopCamera", true ) 
    addEventHandler ( "stopCamera", root, 
        function ( ) 
            removeCamHandler ( ) 
            if isElement ( sm.object1 ) then 
                destroyElement ( sm.object1 ) 
            end 
            if isElement ( sm.object2 ) then 
                destroyElement ( sm.object2 ) 
            end 
            if isTimer ( sm.timer1 ) then 
                killTimer ( sm.timer1 ) 
            end 
            if isTimer ( sm.timer2 ) then 
                killTimer ( sm.timer2 ) 
            end 
            if isTimer ( sm.timer3 ) then 
                killTimer ( sm.timer3 ) 
            end 
            sm = { } 
        end 
    ) 

server:

    addEventHandler ( "onPlayerLogin", root, 
        function ( ) 
            triggerClientEvent ( source, "stopCamera", source ) 
        end 
    ) 
    addEventHandler ("onPlayerJoin", root, 
    function ( ) 
                fadeCamera(source, true, 2.0)  
        end 
    ) 

Please still need help...the camera don't stop when the player login..it just get Freezed.

Link to comment
addEventHandler ( "onPlayerLogin", root, 
    function ( ) 
        triggerClientEvent ( source, "stopCamera", source ) 
        setCameraTarget ( source ) 
    end 
) 
  
addEventHandler ("onPlayerJoin", root, 
function ( ) 
        fadeCamera(source, true, 2.0) 
    end 
) 

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