Jump to content

need help


Blaawee

Recommended Posts

Can you tell me what's not working if you use THIS code?

Does it output something at the chat?

Remember to press F2 to make this work!

local player = getLocalPlayer ( ) 
    local fpsmode = false 
    bindKey ( "f2", "down", 
        function ( ) 
            fpsmode = not fpsmode 
            toggle ( ) 
        end ) 
      
    function toggle ( ) 
        if isPedInVehicle ( player ) and fpsmode then 
            outputChatBox ( "View Mode |on|", 0 , 255, 0 , true) 
            addEventHandler ( "onClientPreRender", setFPSCamera ) 
        else 
            outputChatBox ( "View Mode |OFF|", 255, 255, 255, true ) 
            setCameraTarget ( player ) 
            removeEventHandler ( "onClientPreRender", setFPSCamera ) 
        end 
    end  
    addEventHandler ( "onClientPlayerVehicleEnter", player, toggle ) 
    addEventHandler ( "onClientPlayerVehicleExit", player, toggle ) 

Link to comment

GOD. YOU HAVEN'T CHECKED MY DAMN CODE. That's why this doesn't work. You didn't copy any of the core functions!!!

Here you have new code...

local player = getLocalPlayer ( ) 
fpsmode = false 
addEventHandler ( "onClientCursorMove", getRootElement ( ), 
    function ( guiy1, guiy1, guix2, guiy2, x2, y2, z2 ) 
        if not isCursorShowing ( ) and not isChatBoxInputActive ( ) and not isMainMenuActive ( ) and fpsmode and isPedInVehicle ( player ) then 
            local x1, y1, z1 = getPedBonePosition ( player, 6 ) 
            setCameraMatrix ( x1, y1, z1, x2, y2, z2 ) 
        end 
    end ) 
  
function setFPSCamera ( ) 
    local x1, y1, z1 = getPedBonePosition ( player, 6 ) 
    setCameraMatrix ( x1, y1, z1 ) 
    if not getControlState ( "aim_weapon" ) then 
        setControlState ( "aim_weapon", true ) 
    end 
end 
  
bindKey ( "f2", "down", 
    function ( ) 
        fpsmode = not fpsmode 
        toggle ( ) 
    end ) 
      
function toggle ( ) 
    if isPedInVehicle ( player ) and fpsmode then 
        outputChatBox ( "View Mode |on|", 0 , 255, 0 , true) 
        addEventHandler ( "onClientPreRender", setFPSCamera ) 
    else 
        outputChatBox ( "View Mode |OFF|", 255, 255, 255, true ) 
        setCameraTarget ( player ) 
        removeEventHandler ( "onClientPreRender", setFPSCamera ) 
    end 
end  
addEventHandler ( "onClientPlayerVehicleEnter", player, toggle ) 
addEventHandler ( "onClientPlayerVehicleExit", player, toggle )[/lua] 

Link to comment
local player = getLocalPlayer ( ) 
fpsmode = false 
addEventHandler ( "onClientCursorMove", getRootElement ( ), 
    function ( guiy1, guiy1, guix2, guiy2, x2, y2, z2 ) 
        if not isCursorShowing ( ) and not isChatBoxInputActive ( ) and not isMainMenuActive ( ) and fpsmode and isPedInVehicle ( player ) then 
            local x1, y1, z1 = getPedBonePosition ( player, 6 ) 
            setCameraMatrix ( x1, y1, z1, x2, y2, z2 ) 
        end 
    end ) 
  
function setFPSCamera ( ) 
    local x1, y1, z1 = getPedBonePosition ( player, 6 ) 
    setCameraMatrix ( x1, y1, z1 ) 
    if not getControlState ( "aim_weapon" ) then 
        setControlState ( "aim_weapon", true ) 
    end 
end 
  
bindKey ( "f2", "down", 
    function ( ) 
        fpsmode = not fpsmode 
        toggle ( ) 
    end ) 
      
function toggle ( ) 
    if isPedInVehicle ( player ) and fpsmode then 
        outputChatBox ( "View Mode |on|", 0 , 255, 0 , true) 
        addEventHandler ( "onClientPreRender", root, setFPSCamera ) 
    elseif not fpsmode then 
        outputChatBox ( "View Mode |OFF|", 255, 255, 255, true ) 
        setCameraTarget ( player ) 
        removeEventHandler ( "onClientPreRender", root, setFPSCamera ) 
    end 
end  
addEventHandler ( "onClientPlayerVehicleEnter", player, toggle ) 
addEventHandler ( "onClientPlayerVehicleExit", player, toggle ) 

?

I'm getting bored of giving you new code everytime you say "dont work", and don't even try to help me to help you (debugging).

Edited by Guest
Link to comment

here is my edit :

local player = getLocalPlayer ( ) 
fpsmode = false 
addEventHandler ( "onClientCursorMove", getRootElement ( ), 
    function ( guiy1, guiy1, guix2, guiy2, x2, y2, z2 ) 
        if not isCursorShowing ( ) and not isChatBoxInputActive ( ) and not isMainMenuActive ( ) and fpsmode and isPedInVehicle ( player ) then 
            local x1, y1, z1 = getPedBonePosition ( player, 6 ) 
            setCameraMatrix ( x1, y1, z1, x2, y2, z2 ) 
        end 
    end ) 
  
function setFPSCamera ( ) 
    local x1, y1, z1 = getPedBonePosition ( player, 6 ) 
    setCameraMatrix ( x1, y1, z1 ) 
    if not getControlState ( "aim_weapon" ) then 
        setControlState ( "aim_weapon", true ) 
    end 
end 
  
bindKey ( "r", "down", 
    function ( ) 
        fpsmode = not fpsmode 
        toggle ( ) 
    end ) 
      
function toggle ( ) 
    if isPedInVehicle ( player ) and fpsmode then 
        addEventHandler ( "onClientPreRender", setFPSCamera ) 
    else 
        setCameraTarget ( player ) 
        removeEventHandler ( "onClientPreRender", setFPSCamera ) 
    end 
end 
addEventHandler ( "onClientPlayerVehicleEnter", player, toggle ) 
addEventHandler ( "onClientPlayerVehicleExit", player, toggle ) 

at line 27 @ addEventHandler

Link to comment

I already edited this, but here you go (again):

local player = getLocalPlayer ( ) 
fpsmode = false 
addEventHandler ( "onClientCursorMove", getRootElement ( ), 
    function ( guiy1, guiy1, guix2, guiy2, x2, y2, z2 ) 
        if not isCursorShowing ( ) and not isChatBoxInputActive ( ) and not isMainMenuActive ( ) and fpsmode and isPedInVehicle ( player ) then 
            local x1, y1, z1 = getPedBonePosition ( player, 6 ) 
            setCameraMatrix ( x1, y1, z1, x2, y2, z2 ) 
        end 
    end ) 
  
function setFPSCamera ( ) 
    local x1, y1, z1 = getPedBonePosition ( player, 6 ) 
    setCameraMatrix ( x1, y1, z1 ) 
    if not getControlState ( "aim_weapon" ) then 
        setControlState ( "aim_weapon", true ) 
    end 
end 
  
bindKey ( "f2", "down", 
    function ( ) 
        fpsmode = not fpsmode 
        toggle ( ) 
    end ) 
      
function toggle ( ) 
    if isPedInVehicle ( player ) and fpsmode then 
        outputChatBox ( "View Mode |on|", 0 , 255, 0 , true) 
        addEventHandler ( "onClientPreRender", root, setFPSCamera ) 
    elseif not fpsmode then 
        outputChatBox ( "View Mode |OFF|", 255, 255, 255, true ) 
        setCameraTarget ( player ) 
        removeEventHandler ( "onClientPreRender", root, setFPSCamera ) 
    end 
end  
addEventHandler ( "onClientPlayerVehicleEnter", player, toggle ) 
addEventHandler ( "onClientPlayerVehicleExit", player, toggle ) 

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