Jump to content

Problem with CCTV script


Mathias Lui

Recommended Posts

Hello,

I've got another problem with my CCTV script. Everything works fine, but I want the player to be in a special vehicle (any police car) to get access to the cameras. Heres an extract of the script:

local cam1 = createObject ( 1886,1592.1999511719,-1370.0999755859,34.299999237061, 10, 0, 0 ) 
function gotoCam1(  ) 
    if getPedOccupiedVehicle ( localPlayer ) then 
    setCameraMatrix ( 1592.1999511719,-1370.0999755859,34.299999237061, 1593.0999755859, -1397.3000488281, 27.799999237061,0,100 ) 
    outputChatBox("Camera 01", 0, 255, 0) 
    else 
    outputChatBox ( 'You are not in a police car.', 255, 0, 0 ) 
    return 
    end 
end 
addCommandHandler ( 'cctv1', gotoCam1 ) 

hope somebody can help

Mathias Lui

Link to comment
  
local cam1 = createObject ( 1886,1592.1999511719,-1370.0999755859,34.299999237061, 10, 0, 0 ) 
function gotoCam1(  ) 
    local v = getPedOccupiedVehicle(localPlayer) 
    if v and getElementModel(v) == 596 then --596 is Police LS, 597 SF and 598 LV 
        setCameraMatrix ( 1592.1999511719,-1370.0999755859,34.299999237061, 1593.0999755859, -1397.3000488281, 27.799999237061,0,100 ) 
        outputChatBox("Camera 01", 0, 255, 0) 
    else 
        outputChatBox ( 'You are not in a police car.', 255, 0, 0 ) 
        return 
    end 
end 
addCommandHandler ( 'cctv1', gotoCam1 ) 
  

Here you go, it should work.

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