Jump to content

Script Error.


Recommended Posts

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 ( 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 ) 
        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 
        setTimer ( removeCamHandler, time, 1 ) 
        setTimer ( destroyElement, time, 1, sm.object1 ) 
        setTimer ( destroyElement, time, 1, sm.object2 ) 
        return true 
    end 

Error:

:18: <name> or '...' expected near '2317.369140625' 

Link to comment
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 
    setTimer ( removeCamHandler, time, 1 ) 
    setTimer ( destroyElement, time, 1, sm.object1 ) 
    setTimer ( destroyElement, time, 1, sm.object2 ) 
    return true 
end 

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 ) 

Link to comment
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 
    setTimer ( removeCamHandler, time, 1 ) 
    setTimer ( destroyElement, time, 1, sm.object1 ) 
    setTimer ( destroyElement, time, 1, sm.object2 ) 
    return true 
end 

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 ) 

added this..but the same error

Link to comment
Post the script.

It's the script

    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 ( 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 ) 
            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 
            setTimer ( removeCamHandler, time, 1 ) 
            setTimer ( destroyElement, time, 1, sm.object1 ) 
            setTimer ( destroyElement, time, 1, sm.object2 ) 
            return true 
        end 

the full

Link to comment
You're kidding me? you didn't copy the script I posted.

It's the one which you posted..then i putted the smothCamera on the right place

You Putted this:

    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 
        setTimer ( removeCamHandler, time, 1 ) 
        setTimer ( destroyElement, time, 1, sm.object1 ) 
        setTimer ( destroyElement, time, 1, sm.object2 ) 
        return true 
    end 

Then This:

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 ) 

So i putted them in one script ...i guess it's right:

        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 ( 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 ) 
                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 
                setTimer ( removeCamHandler, time, 1 ) 
                setTimer ( destroyElement, time, 1, sm.object1 ) 
                setTimer ( destroyElement, time, 1, sm.object2 ) 
                return true 
            end 

Link to comment
That's where you're wrong, you must use the first script I posted, then you execute the function like I did on the second one.

Actullly not work

        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 )  
        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 
        setTimer ( removeCamHandler, time, 1 ) 
        setTimer ( destroyElement, time, 1, sm.object1 ) 
        setTimer ( destroyElement, time, 1, sm.object2 ) 
        return true 

Link to comment

CODE 1: DON'T TOUCH ANYTHING ON IT.

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 
    setTimer ( removeCamHandler, time, 1 ) 
    setTimer ( destroyElement, time, 1, sm.object1 ) 
    setTimer ( destroyElement, time, 1, sm.object2 ) 
    return true 
end 

CODE 2: GOES ALONG WITH THE OTHER CODE, BUT NOT MIXED.

addCommandHandler ( "camera", 
    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 
) 

Link to comment
CODE 1: DON'T TOUCH ANYTHING ON IT.
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 
    setTimer ( removeCamHandler, time, 1 ) 
    setTimer ( destroyElement, time, 1, sm.object1 ) 
    setTimer ( destroyElement, time, 1, sm.object2 ) 
    return true 
end 

CODE 2: GOES ALONG WITH THE OTHER CODE, BUT NOT MIXED.

addCommandHandler ( "camera", 
    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 
) 

ِAlright.. tried it.. but still not works... man i tried to do /camera...but still...whatever i want this only shows when player join..and stops when player login ..

Link to comment
Post the code you used.

what you mean with the code i use ?? i think all scripts which i use posted? and if you mean the last one...it's :-

    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 
        setTimer ( removeCamHandler, time, 1 ) 
        setTimer ( destroyElement, time, 1, sm.object1 ) 
        setTimer ( destroyElement, time, 1, sm.object2 ) 
        return true 
    end 
    addCommandHandler ("camera", 
        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 
    ) 

Link to comment
Make sure it's client-side.

ah...yes work when i do /camera....but i tried to add event handler ...not works ..":/

    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 
        setTimer ( removeCamHandler, time, 1 ) 
        setTimer ( destroyElement, time, 1, sm.object1 ) 
        setTimer ( destroyElement, time, 1, sm.object2 ) 
        return true 
    end 
    addEventHandler ("onPlayerJoin", 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 
    ) 

Link to comment
Because "onPlayerJoin" is server-side only, use "onClientResourceStart".

My MIstake..sorry :D ..and Thanks

and i've made this to stop the cams when player logins..but not works:

client:

        function ( ) 
           cams = 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 
    ) 
    function intro () 
        if (cams) and (isElement(cams)) then 
            destroyElement (cams) 
    end 
end 
    addEvent ("stopCams", true) 
    addEventHandler ("stopCams", getRootElement(), intro) 

server:

function intro () 
    triggerClientEvent (source, "stopCams", source) 
end 
addEventHandler ("onPlayerLogin", getRootElement(), intro) 

Link to comment

Replace the client-side function "removeCamHandler" with this one:

function removeCamHandler ( ) 
    if ( sm.moov == 1 ) then 
        sm.moov = 0 
        removeEventHandler ( "onClientPreRender", getRootElement(), camRender ) 
    end 
end 
addEvent ( "stopCamera", true ) 
addEventHandler ( "stopCamera", root, removeCamHandler ) 

And add this server-side:

addEventHandler ( "onPlayerLogin", root, 
    function ( ) 
        triggerClientEvent ( source, "stopCamera", source ) 
    end 
) 

Link to comment
Replace the client-side function "removeCamHandler" with this one:
function removeCamHandler ( ) 
    if ( sm.moov == 1 ) then 
        sm.moov = 0 
        removeEventHandler ( "onClientPreRender", getRootElement(), camRender ) 
    end 
end 
addEvent ( "stopCamera", true ) 
addEventHandler ( "stopCamera", root, removeCamHandler ) 

And add this server-side:

addEventHandler ( "onPlayerLogin", root, 
    function ( ) 
        triggerClientEvent ( source, "stopCamera", source ) 
    end 
) 

Actaully still see black when i join :/

the full script:

client:

    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 
    addEvent ( "stopCamera", true ) 
    addEventHandler ( "stopCamera", root, removeCamHandler ) 
      
    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 
        setTimer ( removeCamHandler, time, 1 ) 
        setTimer ( destroyElement, time, 1, sm.object1 ) 
        setTimer ( destroyElement, time, 1, sm.object2 ) 
        return true 
    end 
    addEventHandler ("onClientResourceStart", root,  
        function ( ) 
           cams = 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 
    ) 

server:

    addEventHandler ( "onPlayerLogin", root, 
        function ( ) 
            triggerClientEvent ( source, "stopCamera", source ) 
        end 
    ) 

ah...and when i start another script...the camera works o.O!

Link to comment
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 
) 

Link to comment
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 
) 

The screen Still BLACK when i join

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