Jump to content

what am i doing wrong here?


Recommended Posts

so i am having problem with this code


marker = createMarker(137.39999, 1850.4, 16.6, "cylinder", 1.5, 230, 251, 3, 153) 
  
function camera(player) 
    if (source == marker and getElementType(player) == "player") then 
	     fadeCamera(player, true, 0.5)
	     setCameraMatrix(player, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316)
   end
end 
addEventHandler("onMarkerHit", root, camera) 

it does work and show the camera but it doesnt give any fading effects 

i wanna fade in  so screen becomes black for like 2 second then fade out so it show where set camera matrix is pointing

Link to comment
marker = createMarker(137.39999, 1850.4, 16.6, "cylinder", 1.5, 230, 251, 3, 153) 
  
function camera(player) 
    if (getElementType(player) == "player") then 
	     fadeCamera(player, true, 0.5)
	     setCameraMatrix(player, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316)
   end
end 
addEventHandler("onMarkerHit", marker, camera) 

 

Link to comment
  • Moderators
marker = createMarker(137.39999, 1850.4, 16.6, "cylinder", 1.5, 230, 251, 3, 153) 
  
function camera(hitElement) 
    if getElementType(hitElement) == "player" then 
        fadeCamera(hitElement, false, 0.5)
        setTimer(function()
            setCameraMatrix(hitElement, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316)
            fadeCamera(hitElement, true, 0.5)
        end, 500, 1)
    end
end 
addEventHandler("onMarkerHit", marker, camera) 

 

Edited by stPatrick
Link to comment
11 minutes ago, Dimos7 said:

marker = createMarker(137.39999, 1850.4, 16.6, "cylinder", 1.5, 230, 251, 3, 153) 
  
function camera(player) 
    if (getElementType(player) == "player") then 
	     fadeCamera(player, true, 0.5)
	     setCameraMatrix(player, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316)
   end
end 
addEventHandler("onMarkerHit", marker, camera) 

 

didnt work still same thing even if you increase  0.5

6 minutes ago, stPatrick said:

marker = createMarker(137.39999, 1850.4, 16.6, "cylinder", 1.5, 230, 251, 3, 153) 
  
function camera(hitElement) 
    if getElementType(hitElement) == "player" then 
        fadeCamera(hitElement, false, 0.5)
        setTimer(setCameraMatrix, 500, 1, hitElement, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316)
    end
end 
addEventHandler("onMarkerHit", marker, camera) 

 

also error

https://imgur.com/D76s3Rm

Link to comment
  • Moderators
5 minutes ago, Machine said:

didnt work still same thing even if you increase  0.5

also error

https://imgur.com/D76s3Rm

 

marker = createMarker(137.39999, 1850.4, 16.6, "cylinder", 1.5, 230, 251, 3, 153)

function camera(hitElement)
    if getElementType(hitElement) == "player" then
        fadeCamera(hitElement, false, 0.5)
        setTimer(function()
            setCameraMatrix(hitElement, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316)
            fadeCamera(hitElement, true, 0.5)
        end, 500, 1)
    end
end
addEventHandler("onMarkerHit", marker, camera)

 

Link to comment
34 minutes ago, SaNoR said:

It's sometimes happens when u copy code from forum, just write this line by yourself.

first of all i was using the wiki guide to learn not the forum 

second of all if your not gonna help in this section dont give a stupid opinion this section was made for programming help 

 

Link to comment
  1. marker = createMarker(137.39999, 1850.4, 16.6, "cylinder", 1.5, 230, 251, 3, 153)
  2.  
  3. function camera(hitElement)
  4. if getElementType(hitElement) == "player" then
  5. setCameraMatrix(hitElement, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316)
  6. setTimer(function()
  7. fadeCamera(hitElement, true, 0.5)
  8. end, 500, 1)
  9. end
  10. end
  11. addEventHandler("onMarkerHit", marker, camera)
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...