Xwad Posted April 30, 2015 Posted April 30, 2015 hi i donwloaded a script but the camera switches back to the plane without reason. How can i fix it?? Recently i saw a post and there they sad: change setCameraMatrix function. Please help its very important:(
Walid Posted April 30, 2015 Posted April 30, 2015 hi i donwloaded a script but the camera switches back to the plane without reason. How can i fix it?? Recently i saw a post and there they sad: change setCameraMatrix function. Please help its very important:( what are you talking about try to explane your problem better or just post some screenshots.
Xwad Posted April 30, 2015 Author Posted April 30, 2015 i cant make picture only video becaouse this bug is a camera bug when i try to look right then the camera always get back to the normal position://
Xwad Posted April 30, 2015 Author Posted April 30, 2015 test it pls you will se its bugging.. Maybe the functions are old?
Irish Posted May 1, 2015 Posted May 1, 2015 At least link us to that resource so we can actually see what you're talking about.
Mr.unpredictable. Posted May 1, 2015 Posted May 1, 2015 How we we suppose to know what is creating problem, atleast post the resource link or the part of the code.
Xwad Posted May 1, 2015 Author Posted May 1, 2015 ohh omg sry i forgot!!! https://community.multitheftauto.com/in ... ls&id=3919
Xwad Posted May 2, 2015 Author Posted May 2, 2015 Please help me fix that. I saw a commant that I must change all onClientRender to onClientPreRender. I tryed but it still does not work..
ALw7sH Posted May 2, 2015 Posted May 2, 2015 Have you read the description ? *****Bugs***** If your camera switches back to the plane without reason, than type in "/fixAc130". I hope this will fix that problem!
Xwad Posted May 2, 2015 Author Posted May 2, 2015 there was a same post like this and there the man wrote that : "i fix, just change setCameraMatrix function." I just dont know what i need to change in SetCameraMatrix.
Xwad Posted May 2, 2015 Author Posted May 2, 2015 This is that part: function cammera(screenX, screenY, absoluteX, absoluteY, vx,vy,vz) local x,y,z = getElementPosition(getPedOccupiedVehicle(getLocalPlayer())) local rx, ry, rz = getElementRotation(getPedOccupiedVehicle(getLocalPlayer())) rz = rz +180 local cx = x + math.cos(math.rad(rz)) * 3 local cy = y + math.sin(math.rad(rz)) * 3 setCameraMatrix ( cx, cy, z, vx,vy,vz) drawHud() end function keepCamAtAc130() local x,y,z = getElementPosition(getPedOccupiedVehicle(getLocalPlayer())) local rx, ry, rz = getElementRotation(getPedOccupiedVehicle(getLocalPlayer())) rz = rz +180 local cx = x + math.cos(math.rad(rz)) * 3 local cy = y + math.sin(math.rad(rz)) * 3 setCameraMatrix(cx, cy, z) drawHud() end
Walid Posted May 2, 2015 Posted May 2, 2015 try to use setPedLookAt() or setCameraMatrix() -- this it can help you really i don't undrestand your problem.
Xwad Posted May 2, 2015 Author Posted May 2, 2015 i wrote donw my problem.. My problem is that when i type /ac130 and enter the plane and press space then i cant look around with the camera becaouse it always get back to the normal position. Please just try it out download the script and test it. You will see the problem. There must be a way to fix it. you mean need i try use this function?: setPedLookAt()
Xwad Posted May 2, 2015 Author Posted May 2, 2015 I made a video from the bug and upload it to youtube!! pls watch!! https://www.youtube.com/watch?v=XFWAQ_4 ... e=youtu.be
WhoAmI Posted May 3, 2015 Posted May 3, 2015 client.lua --------------------------- --(c) by MazzMan/Maxim --------------------------- canDriverUseGun = true ammo = {} ammo.small = false ammo.middle = false ammo.big = true ammo.smallShots = 50 ammo.middleShots = 6 ammo.smallCanShoot = true ammo.middleCanShoot = true ammo.smallReloading = false ammo.middleReloading = false ammo.bigReloading = false setElementData(getLocalPlayer(), "ac130KeysBound", false) addEventHandler("onClientVehicleEnter", getRootElement(), function(thePlayer, seat) if(getLocalPlayer() == thePlayer and getElementModel(source) == 592 and getElementData(source, "ac130"))then if(canDriverUseGun)then bindKey("space", "down", setBinds) elseif(seat == 1)then bindKey("space", "down", setBinds) end end end) function removeAllGunControls() unbindKey("space", "down", setBinds) setCameraGoggleEffect("normal") setElementData(getLocalPlayer(), "ac130KeysBound", false) removeEventHandler("onClientRender", getRootElement(), keepCamAtAc130) removeEventHandler("onClientCursorMove", getRootElement(), cammera) unbindKey("mouse1", "down", shoot) setCameraTarget(getLocalPlayer()) unbindKey("mouse_wheel_up", "down", changeAmmo) unbindKey("mouse_wheel_down", "down", changeAmmo) unbindKey("v", "down", setVisionMode) end addEventHandler("onClientVehicleExit", getRootElement(), removeAllGunControls) addEventHandler("onClientResourceStop", getRootElement(), removeAllGunControls) addEventHandler("onClientPlayerWasted", getRootElement(), function() if(source == getLocalPlayer())then removeAllGunControls() end end) local windowX, windowY = guiGetScreenSize() function cammera(screenX, screenY, absoluteX, absoluteY, vx,vy,vz) local x,y,z = getElementPosition(getPedOccupiedVehicle(getLocalPlayer())) local rx, ry, rz = getElementRotation(getPedOccupiedVehicle(getLocalPlayer())) rz = rz +180 local cx = x + math.cos(math.rad(rz)) * 3 local cy = y + math.sin(math.rad(rz)) * 3 setCameraMatrix ( cx, cy, z, vx, vy, vz ) drawHud() end function keepCamAtAc130() local x,y,z = getElementPosition(getPedOccupiedVehicle(getLocalPlayer())) local rx, ry, rz = getElementRotation(getPedOccupiedVehicle(getLocalPlayer())) rz = rz +180 local cx = x + math.cos(math.rad(rz)) * 3 local cy = y + math.sin(math.rad(rz)) * 3 setCameraMatrix(cx, cy, z) end function setBinds() if(getElementData(getLocalPlayer(), "ac130KeysBound") == false)then setElementData(getLocalPlayer(), "ac130KeysBound", true) keepCamAtAc130 ( ) addEventHandler("onClientCursorMove", getRootElement(), cammera) addEventHandler ( "onClientRender", root, drawHud ) bindKey("mouse1", "down", shoot) bindKey("mouse_wheel_up", "down", changeAmmo) bindKey("mouse_wheel_down", "down", changeAmmo) bindKey("v", "down", setVisionMode) else setElementData(getLocalPlayer(), "ac130KeysBound", false) removeEventHandler("onClientCursorMove", getRootElement(), cammera) removeEventHandler ( "onClientRender", root, drawHud ) unbindKey("mouse1", "down", shoot) setCameraTarget(getLocalPlayer()) unbindKey("mouse_wheel_up", "down", changeAmmo) unbindKey("mouse_wheel_down", "down", changeAmmo) unbindKey("v", "down", setVisionMode) setCameraGoggleEffect("normal") end end function shoot() local cx, cy, cz = getCameraMatrix() local wX,wY,wZ = getWorldFromScreenPosition(windowX/2, windowY/2, 2000) local hit, x, y, z = processLineOfSight(cx, cy, cz, wX,wY,wZ) if(hit)then local distance = getDistanceBetweenPoints3D(x, y, z, cx, cy, cz) local time = distance/0.5 local ammoType if(ammo.small)then if(time >= 50)then if(ammo.smallCanShoot and ammo.smallReloading == false)then --im using a timer, becaus a while loop will cause to crash the game shootTimer = setTimer(function() if(getKeyState("mouse1"))then cx, cy, cz = getCameraMatrix() wX,wY,wZ = getWorldFromScreenPosition(windowX/2, windowY/2, 2000) hit, x, y, z = processLineOfSight(cx, cy, cz, wX,wY,wZ) if(hit)then playSound("sounds/shot_small.wav") ammoType = "small" ammo.smallShots = ammo.smallShots - 1 if(ammo.smallShots == 0)then setReloading("small") killTimer(shootTimer) end ammo.smallCanShoot = false setTimer(function() ammo.smallCanShoot = true end, 200, 1) triggerServerEvent("onAc130Shoot", getRootElement(),cx, cy, cz, x, y, z, time, ammoType) end else killTimer(shootTimer) end end, 50, 0) else return false end else return false end elseif(ammo.middle)then if(time >= 50)then if(ammo.middleCanShoot and ammo.middleReloading == false)then ammoType = "middle" ammo.middleShots = ammo.middleShots - 1 if(ammo.middleShots == 0)then setReloading("middle") end ammo.middleCanShoot = false playSound("sounds/shot_middle.wav") setTimer(function() ammo.middleCanShoot = true end, 500, 1) else return false end else return false end elseif(ammo.big)then if(ammo.bigReloading == false)then if(time >= 50)then ammoType = "big" playSound("sounds/shot_middle.wav") setReloading("big") else return false end else return false end end triggerServerEvent("onAc130Shoot", getRootElement(),cx, cy, cz, x, y, z, time, ammoType) end end function changeAmmo(key) if(key == "mouse_wheel_up")then if(ammo.small)then ammo.small = false ammo.big = true elseif(ammo.middle)then ammo.middle = false ammo.small = true elseif(ammo.big)then ammo.big = false ammo.middle = true end else if(ammo.small)then ammo.small = false ammo.middle = true elseif(ammo.middle)then ammo.middle = false ammo.big = true elseif(ammo.big)then ammo.big = false ammo.small = true end end end function setReloading(ammoType) if(ammoType == "small")then ammo.smallReloading = true setTimer(function() ammo.smallReloading = false ammo.smallShots = 50 end, 3000, 1) elseif(ammoType == "middle")then ammo.middleReloading = true setTimer(function() ammo.middleReloading = false ammo.middleShots = 6 end, 3000, 1) elseif(ammoType == "big")then ammo.bigReloading = true setTimer(function() ammo.bigReloading = false end, 3000, 1) end end function setVisionMode() if(getCameraGoggleEffect() == "normal")then setCameraGoggleEffect("nightvision") elseif(getCameraGoggleEffect() == "nightvision")then setCameraGoggleEffect("thermalvision") elseif(getCameraGoggleEffect() == "thermalvision")then setCameraGoggleEffect("normal") end end addEvent("onClientCreateEffect", true) addEventHandler("onClientCreateEffect", getRootElement(), function(x,y,z, lx, ly, lz, type, time) if(type ~= "small")then --playSound3D("sounds/shot_middle.wav", x,y,z) --local num = math.random(1, 3) --local projectileSound = playSound3D("sounds/projectile_"..num..".wav", lx, ly, lz)
Xwad Posted May 3, 2015 Author Posted May 3, 2015 Thanks that you help me but its bugging in line 389. Loading script failed: ac130\client.lua:389: unexpected symbol near '<'
Xwad Posted May 3, 2015 Author Posted May 3, 2015 Now the bug is that the camera dosent attach to the plane. I mean when i enter the plane then there is no camera bug it dosent switches back to the normal position but there is a bug. When i start going with the plane then the camera stays in one position. I mean the camera stays there where i spawned the ac130:/ the camera only attaches to the plane when i move the mause and if i dont move the mouse then the camera stays again.
Xwad Posted May 3, 2015 Author Posted May 3, 2015 Now there is no camera bugs but very big lags when i want to look around with the camera:(
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now