Jump to content

(Help) Camera matrix onplayerjoin


Leonard.DC

Recommended Posts

Hi, i don't know why this script doesn't work nice, the cameras doesn't change and the word doesn't appears, i looked the console server, and there are some bugs, but i have looked and the script have this problem fixed.

Bad argument "triggerClientEvent" expected string at argument 1, got nil (Line 37) (I have not detect any problem) 
Bad argument "destroyElement" expected element at argument 1, got function (Line 38) (I have not detect any problem) 
Bad argument "setCameraMatrix" (Line 39) (I have not detect any problem) 
Bad argument "setTimer" expected function at argument 1, got nil (Line 40) (I have not detect any problem) 
Bad argument "fadeCamera" (Line 41) (I have not detect any problem) 
Bad argument "fadeCamera" (Line 42) (I have not detect any problem) 

All the function get broken :/, Why?

Server

function grovestSlider() 
        triggerClientEvent (source, "mess1", source) 
        setCameraMatrix (source, 2463.8823242188, -1659.6778564453, 24.041973114014, 2547.9951171875, -1688.5211181641, -21.708633422852) 
        fadeCamera (source, true, 1.5) 
        setTimer(hosptSlider, 9500, 1, source) 
        setTimer(fadeCamera, 8000, 1, source, false, 1.5) 
        setTimer(fadeCamera, 9500, 1, source, true, 1.5) 
        if isElement (lspdSlider) then 
        destroyElement (lspdSlider) 
    end 
    end 
    addEventHandler ( "onPlayerJoin", getRootElement(), grovestSlider) 
     
    function onLoginEvent() 
    setCameraTarget (source, source) 
    fadeCamera (source, false, 1.0) 
    setTimer (fadeCamera, 1500, 1, source, true, 1.0) 
    if isElement (grovestSlider) then 
    destroyElement (grovestSlider) 
    end 
    if isElement (hosptSlider) then 
    destroyElement (hosptSlider) 
    end 
    if isElement (gleenpkSlider) then 
    destroyElement (gleenpkSlider) 
    end 
    if isElement (airportSlider) then 
    destroyElement (airporSlider) 
    end 
    if isElement (lspdSlider) then 
    destroyElement (lspdSlider) 
    end 
    end 
    addEventHandler ( "onPlayerLogin", getRootElement(), grovestSlider) 
  
function hosptSlider() 
        triggerClientEvent (source, "mess2", source) 
        destroyElement (grovestSlider) 
        setCameraMatrix(source, 2014.4888916016, -1435.1318359375, 30.302476882935, 2066.4152832031, -1361.5522460938, -13.168096542358) 
        setTimer(gleepkSlider, 9500, 1, source) 
        setTimer(fadeCamera, 8000, 1, source, false, 1.5) 
        setTimer(fadeCamera, 9500, 1, source, true, 1.5) 
    end 
     
    function gleenpkSlider() 
        triggerClientEvent (source, "mess3", source) 
        destroyElement (hosptSlider) 
        setCameraMatrix(source, 2021.8934326172, -1172.9503173828, 59.716133117676, 1961.3312988281, -1213.3442382813, -8.8444747924805) 
        setTimer(airportSliderSlider, 9500, 1, source) 
        setTimer(fadeCamera, 8000, 1, source, false, 1.5) 
        setTimer(fadeCamera, 9500, 1, source, true, 1.5) 
    end 
     
    function airportSlider() 
        destroyElement (gleenpkSlider) 
        triggerClientEvent (source, "mess4", source) 
        setCameraMatrix(source, 1818.1273193359, -2406.4016113281, 105.4114074707, 1812.4464111328, -2485.5925292969, 44.612342834473) 
        setTimer(lspdSlider, 9500, 1, source) 
        setTimer(fadeCamera, 8000, 1, source, false, 1.5) 
        setTimer(fadeCamera, 9500, 1, source, true, 1.5) 
    end 
     
        function lspdSlider() 
        destroyElement (airportSlider) 
        triggerClientEvent (source, "mess5", source) 
        setCameraMatrix(source, 1493.1473388672, -1675.30078125, 42.586067199707, 1590.6865234375, -1672.4597167969, 20.722238540649) 
        setTimer(grovestSlider, 9500, 1, source) 
        setTimer(fadeCamera, 8000, 1, source, false, 1.5) 
        setTimer(fadeCamera, 9500, 1, source, true, 1.5) 
    end 

Client:

    function message1Dx () 
        dxDrawText("***********", 195, 489, 1090, 531, tocolor(0, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, true, false) 
        dxDrawText("***********", 195, 487, 1090, 529, tocolor(0, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, true, false) 
        dxDrawText("***********", 193, 489, 1088, 531, tocolor(0, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, true, false) 
        dxDrawText("***********", 193, 487, 1088, 529, tocolor(0, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, true, false) 
        dxDrawText("***********", 194, 488, 1089, 530, tocolor(0, 0, 255, 255), 1.00, "pricedown", "left", "top", false, false, true, true, false) 
    end 
     
        function message2Dx () 
        dxDrawText("***********", 195, 489, 1090, 531, tocolor(0, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, true, false) 
        dxDrawText("***********", 195, 487, 1090, 529, tocolor(0, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, true, false) 
        dxDrawText("***********", 193, 489, 1088, 531, tocolor(0, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, true, false) 
        dxDrawText("***********", 193, 487, 1088, 529, tocolor(0, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, true, false) 
        dxDrawText("***********", 194, 488, 1089, 530, tocolor(255, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, true, false) 
    end 
     
        function message3Dx () 
        dxDrawText("***********", 195, 489, 1090, 531, tocolor(0, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, true, false) 
        dxDrawText("***********", 195, 487, 1090, 529, tocolor(0, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, true, false) 
        dxDrawText("***********", 193, 489, 1088, 531, tocolor(0, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, true, false) 
        dxDrawText("***********", 193, 487, 1088, 529, tocolor(0, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, true, false) 
        dxDrawText("***********", 194, 488, 1089, 530, tocolor(0, 0, 255, 255), 1.00, "pricedown", "left", "top", false, false, true, true, false) 
    end 
     
        function message4Dx () 
        dxDrawText("***********", 195, 489, 1090, 531, tocolor(0, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, true, false) 
        dxDrawText("***********", 195, 487, 1090, 529, tocolor(0, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, true, false) 
        dxDrawText("***********", 193, 489, 1088, 531, tocolor(0, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, true, false) 
        dxDrawText("***********", 193, 487, 1088, 529, tocolor(0, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, true, false) 
        dxDrawText("***********", 194, 488, 1089, 530, tocolor(0, 255, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, true, false) 
    end 
     
        function message5Dx () 
        dxDrawText("***********", 195, 489, 1090, 531, tocolor(0, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, true, false) 
        dxDrawText("***********", 195, 487, 1090, 529, tocolor(0, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, true, false) 
        dxDrawText("***********", 193, 489, 1088, 531, tocolor(0, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, true, false) 
        dxDrawText("***********", 193, 487, 1088, 529, tocolor(0, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, true, false) 
        dxDrawText("***********", 194, 488, 1089, 530, tocolor(0, 0, 255, 255), 1.00, "pricedown", "left", "top", false, false, true, true, false) 
    end 
  
        function message1 () 
    addEventHandler("onClientRender",getRootElement(),message1Dx) 
    if isElement (message5) then 
    removeEventHandler("onClientRender",getRootElement(),message5Dx) 
    end 
    end 
    addEvent ("mess1", true) 
    addEventHandler ("mess1", root, message1) 
     
        function message2 () 
    addEventHandler("onClientRender",getRootElement(),message2Dx) 
    removeEventHandler("onClientRender",getRootElement(),message1Dx) 
    end 
    addEvent ("mess2", true) 
    addEventHandler ("mess2", root, message2) 
     
        function message3 () 
    addEventHandler("onClientRender",getRootElement(),message3Dx) 
    removeEventHandler("onClientRender",getRootElement(),message2Dx) 
    end 
    addEvent ("mess3", true) 
    addEventHandler ("mess3", root, message3) 
     
        function message4 () 
    addEventHandler("onClientRender",getRootElement(),message4Dx) 
    removeEventHandler("onClientRender",getRootElement(),message3Dx) 
    end 
    addEvent ("mess4", true) 
    addEventHandler ("mess4", root, message4) 
     
        function message5 () 
    addEventHandler("onClientRender",getRootElement(),message5Dx) 
    removeEventHandler("onClientRender",getRootElement(),message4Dx) 
    end 
    addEvent ("mess5", true) 
    addEventHandler ("mess5", root, message5) 

Link to comment
That's because you forgot to define 'source' in the functions you execute with a timer.

SolidSnake, I have alredy executed source in the timers, here is a first timers example:

setTimer(hosptSlider, 9500, 1, ->source<-) 
setTimer(fadeCamera, 8000, 1, ->source<-, false, 1.5) 
setTimer(fadeCamera, 9500, 1, ->source<-, true, 1.5) 

Link to comment
function grovestSlider(source) 
        triggerClientEvent (source, "mess1", source) 
        setCameraMatrix (source, 2463.8823242188, -1659.6778564453, 24.041973114014, 2547.9951171875, -1688.5211181641, -21.708633422852) 
        fadeCamera (source, true, 1.5) 
        setTimer(hosptSlider, 9500, 1, source) 
        setTimer(fadeCamera, 8000, 1, source, false, 1.5) 
        setTimer(fadeCamera, 9500, 1, source, true, 1.5) 
        if isElement (lspdSlider) then 
        destroyElement (lspdSlider) 
    end 
    end 
    addEventHandler ( "onPlayerJoin", getRootElement(), grovestSlider) 
     
    function onLoginEvent(source) 
    setCameraTarget (source, source) 
    fadeCamera (source, false, 1.0) 
    setTimer (fadeCamera, 1500, 1, source, true, 1.0) 
    if isElement (grovestSlider) then 
    destroyElement (grovestSlider) 
    end 
    if isElement (hosptSlider) then 
    destroyElement (hosptSlider) 
    end 
    if isElement (gleenpkSlider) then 
    destroyElement (gleenpkSlider) 
    end 
    if isElement (airportSlider) then 
    destroyElement (airporSlider) 
    end 
    if isElement (lspdSlider) then 
    destroyElement (lspdSlider) 
    end 
    end 
    addEventHandler ( "onPlayerLogin", getRootElement(), grovestSlider) 
  
function hosptSlider(source) 
        triggerClientEvent (source, "mess2", source) 
        destroyElement (grovestSlider) 
        setCameraMatrix(source, 2014.4888916016, -1435.1318359375, 30.302476882935, 2066.4152832031, -1361.5522460938, -13.168096542358) 
        setTimer(gleepkSlider, 9500, 1, source) 
        setTimer(fadeCamera, 8000, 1, source, false, 1.5) 
        setTimer(fadeCamera, 9500, 1, source, true, 1.5) 
    end 
     
    function gleenpkSlider(source) 
        triggerClientEvent (source, "mess3", source) 
        destroyElement (hosptSlider) 
        setCameraMatrix(source, 2021.8934326172, -1172.9503173828, 59.716133117676, 1961.3312988281, -1213.3442382813, -8.8444747924805) 
        setTimer(airportSliderSlider, 9500, 1, source) 
        setTimer(fadeCamera, 8000, 1, source, false, 1.5) 
        setTimer(fadeCamera, 9500, 1, source, true, 1.5) 
    end 
     
    function airportSlider(source) 
        destroyElement (gleenpkSlider) 
        triggerClientEvent (source, "mess4", source) 
        setCameraMatrix(source, 1818.1273193359, -2406.4016113281, 105.4114074707, 1812.4464111328, -2485.5925292969, 44.612342834473) 
        setTimer(lspdSlider, 9500, 1, source) 
        setTimer(fadeCamera, 8000, 1, source, false, 1.5) 
        setTimer(fadeCamera, 9500, 1, source, true, 1.5) 
    end 
     
        function lspdSlider(source) 
        destroyElement (airportSlider) 
        triggerClientEvent (source, "mess5", source) 
        setCameraMatrix(source, 1493.1473388672, -1675.30078125, 42.586067199707, 1590.6865234375, -1672.4597167969, 20.722238540649) 
        setTimer(grovestSlider, 9500, 1, source) 
        setTimer(fadeCamera, 8000, 1, source, false, 1.5) 
        setTimer(fadeCamera, 9500, 1, source, true, 1.5) 
    end 

I think the client side its not necesary if the server side is bugged, peace :) , Regards

Link to comment

fadeCamera is wrong,

Required Arguments thePlayer: The player whose camera you wish to fade. fadeIn: Should the camera be faded in our out? Pass true to fade the camera in, false to fade it out

to a color.

after the required fill in the optional.

You have 2 values infront of the source,

(fadeCamera, source, true, --optionals...) 

Link to comment
fadeCamera is wrong,

Required Arguments thePlayer: The player whose camera you wish to fade. fadeIn: Should the camera be faded in our out? Pass true to fade the camera in, false to fade it out

to a color.

after the required fill in the optional.

You have 2 values infront of the source,

(fadeCamera, source, true, --optionals...) 

Are you see the code? there are alredy added

setTimer(fadeCamera, 8000, 1, source, """false, 1.5""") 
setTimer(fadeCamera, 9500, 1, source, """true, 1.5""") 

:roll::roll::roll:

Link to comment
tTimer = {} 
  
function grovestSlider(player) 
    source = source or player 
    triggerClientEvent(source, "mess1", source) 
    setCameraMatrix(source, 2463.8823242188, -1659.6778564453, 24.041973114014, 2547.9951171875, -1688.5211181641, -21.708633422852) 
    fadeCamera(source, true, 1.5) 
    tTimer[source] = setTimer(hosptSlider, 9500, 1, source) 
    setTimer(fadeCamera, 8000, 1, source, false, 1.5) 
    setTimer(fadeCamera, 9500, 1, source, true, 1.5) 
end 
addEventHandler("onPlayerJoin", root, grovestSlider) 
    
function onLoginEvent() 
    if isTimer(tTimer[source]) then killTimer(tTimer[source]) end 
    tTimer[source] = nil 
    setCameraTarget(source) 
    fadeCamera(source, false, 1.0) 
    setTimer(fadeCamera, 1500, 1, source, true, 1.0) 
end 
addEventHandler("onPlayerLogin", root, onLoginEvent) 
  
function hosptSlider(player) 
    triggerClientEvent(player, "mess2", player) 
    setCameraMatrix(player, 2014.4888916016, -1435.1318359375, 30.302476882935, 2066.4152832031, -1361.5522460938, -13.168096542358) 
    tTimer[player] = nil 
    tTimer[player] = setTimer(gleenpkSlider, 9500, 1, player) 
    setTimer(fadeCamera, 8000, 1, player, false, 1.5) 
    setTimer(fadeCamera, 9500, 1, player, true, 1.5) 
end 
    
function gleenpkSlider(player) 
    triggerClientEvent(player, "mess3", player) 
    setCameraMatrix(player, 2021.8934326172, -1172.9503173828, 59.716133117676, 1961.3312988281, -1213.3442382813, -8.8444747924805) 
    tTimer[player] = nil 
    tTimer[player] = setTimer(airportSlider, 9500, 1, player) 
    setTimer(fadeCamera, 8000, 1, player, false, 1.5) 
    setTimer(fadeCamera, 9500, 1, player, true, 1.5) 
end 
    
function airportSlider(player) 
    triggerClientEvent(player, "mess4", player) 
    setCameraMatrix(player, 1818.1273193359, -2406.4016113281, 105.4114074707, 1812.4464111328, -2485.5925292969, 44.612342834473) 
    tTimer[player] = nil 
    tTimer[player] = setTimer(lspdSlider, 9500, 1, player) 
    setTimer(fadeCamera, 8000, 1, player, false, 1.5) 
    setTimer(fadeCamera, 9500, 1, player, true, 1.5) 
end 
    
function lspdSlider(player) 
    triggerClientEvent(player, "mess5", player) 
    setCameraMatrix(player, 1493.1473388672, -1675.30078125, 42.586067199707, 1590.6865234375, -1672.4597167969, 20.722238540649) 
    tTimer[player] = nil 
    tTimer[player] = setTimer(grovestSlider, 9500, 1, player) 
    setTimer(fadeCamera, 8000, 1, player, false, 1.5) 
    setTimer(fadeCamera, 9500, 1, player, true, 1.5) 
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...