-Doc- Posted June 7, 2015 Share Posted June 7, 2015 Whats wrong there: if vehID == 520 or 425 or 432 then Link to comment
Anubhav Posted June 7, 2015 Share Posted June 7, 2015 if vehID == 520 or vehID == 425 or vehID == 432 then Link to comment
-Doc- Posted June 7, 2015 Author Share Posted June 7, 2015 Can you help me add laser at rhino in this script? reloadTime = 6000 -- for Rhino reloadTimeHydra = 4000 -- for Hydra reloadTimeHunter = 3000 -- for Hunter range = 2 --*** BETTER NOT TOUCH BELOW *** event = nil fired = false drawHandler = nil armedVehicles = {[425]=true, [520]=true, [432]=true} w, h = guiGetScreenSize() height = nil endY = nil r, g = 255, 0 time = 0 function getPositionFromElementOffset(element,offX,offY,offZ) local m = getElementMatrix ( element ) -- Get the matrix local x = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1] local y = offX * m[1][2] + offY * m[2][2] + offZ * m[3][2] + m[4][2] local z = offX * m[1][3] + offY * m[2][3] + offZ * m[3][3] + m[4][3] return x, y, z end function onStart() height = math.ceil(h / 50) if height < 19 then height = 19 end endY = math.ceil((h/100)*6) corona = createMarker (0, 0, -10, "corona", 1.0, 200, 100, 0, 150) bindKey ( "mouse1", "down", toggleRhino ) bindKey("vehicle_fire", "down", toggleHunter) bindKey("vehicle_secondary_fire", "down", toggleHunter) color = tocolor(255, 255, 255, 200) end addEventHandler("onClientResourceStart", resourceRoot, onStart) function entering( thePlayer, seat ) if thePlayer == localPlayer then toggleControl ( "vehicle_fire", true ) toggleControl ( "vehicle_secondary_fire", true ) local model = getElementModel ( source ) if model == 432 or model == 425 or model == 520 then drawHandler = addEventHandler("onClientRender", root, reloadFinished) end if model == 432 then toggleControl ( "vehicle_fire", false ) toggleControl ( "vehicle_secondary_fire", false ) addEventHandler("onClientRender", root, marker) event = true end end end addEventHandler("onClientVehicleEnter", getRootElement(), entering) function exit( thePlayer, seat ) if thePlayer == localPlayer then local model = getElementModel ( source ) if model == 432 then if event ~= nil then removeEventHandler("onClientRender", root, marker) event = nil end toggleControl ( "vehicle_fire", true ) toggleControl ( "vehicle_secondary_fire", true ) end end end addEventHandler("onClientVehicleExit", getRootElement(), exit) addEventHandler("onClientElementDestroy", getRootElement(), function () if (getElementModel(source) == 432 and getVehicleController(source) == localPlayer) then if event ~= nil then removeEventHandler("onClientRender", root, marker) event = nil end toggleControl ( "vehicle_secondary_fire", true ) end end) function wasted() if source == localPlayer then if event ~= nil then removeEventHandler("onClientRender", root, marker) event = nil end toggleControl ( "vehicle_fire", true ) toggleControl ( "vehicle_secondary_fire", true ) end end addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), wasted ) function clientResourceStop() toggleControl ( "vehicle_fire", true ) toggleControl ( "vehicle_secondary_fire", true ) end addEventHandler( "onClientResourceStop", getResourceRootElement(getThisResource()), clientResourceStop ) function toggleRhino() if fired == false then if isPedInVehicle ( localPlayer ) and not isCursorShowing() then local veh = getPedOccupiedVehicle ( localPlayer ) if (veh) then if ( getElementModel ( veh ) == 432 ) then fired = true local turX, turY, turZ = getElementPosition(veh) local cx,cy,cz = getVehicleComponentPosition( veh, "misc_a" ) local x, y, z = getVehicleComponentPosition( veh, "misc_c" ) local barrelX, barrelY, barrelZ = getPositionFromElementOffset(veh,cx,cy,cz) local muzzleX, muzzleY, muzzleZ = getPositionFromElementOffset(veh,x,y,z) local velX = (muzzleX - barrelX) /range local velY = (muzzleY - barrelY) /range local velZ = (muzzleZ - barrelZ) /range local vx, vy, vz = getElementVelocity(veh) setElementVelocity (veh, vx+(((velX/3)*(-1))/50), vy+(((velY/3)*(-1))/50), vz+(((velZ/3)*(-1))/50) ) bullet = createProjectile(veh, 21, muzzleX, muzzleY, muzzleZ, 1, nil, 0, 0, 0, velX, velY, velZ) createExplosion(turX, turY, turZ-10, 8, false, 0.5, false) removeEventHandler("onClientRender", root, reloadFinished) drawHandler = nil start = getTickCount() drawHandler = addEventHandler("onClientRender", root, reload) time = 6000 soundTimer = setTimer(function() local sound = playSound("reload.mp3") setSoundVolume(sound, 0.1) end, (reloadTime-1000), 1) end end end end end function toggleHunter(control) if isPedInVehicle(localPlayer) then local model = getElementModel(getPedOccupiedVehicle(localPlayer)) if model == 425 and fired == false and control == "vehicle_fire" then fired = true setTimer(function() toggleControl ( "vehicle_fire", false ) end, 100, 1) setTimer(function() toggleControl ( "vehicle_fire", true ) fired = false end, reloadTimeHunter, 1) removeEventHandler("onClientRender", root, reloadFinished) drawHandler = nil start = getTickCount() drawHandler = addEventHandler("onClientRender", root, reload) time = 3000 elseif model == 520 and fired == false and control == "vehicle_secondary_fire" then fired = true setTimer(function() toggleControl ( "vehicle_secondary_fire", false ) end, 100, 1) setTimer(function() toggleControl ( "vehicle_secondary_fire", true ) fired = false end, reloadTimeHydra, 1) removeEventHandler("onClientRender", root, reloadFinished) drawHandler = nil start = getTickCount() drawHandler = addEventHandler("onClientRender", root, reload) time = 4000 end end end function reload() if not isPedInVehicle(localPlayer) then removeEventHandler("onClientRender", root, reload) drawHandler = nil end setMarkerColor ( corona, 255, 0, 0, 100 ) local getTime = (getTickCount()) - start local height = math.ceil(h / 50) if height < 19 then height = 19 end dxDrawRectangle (0, h-endY-height-6, height+6, endY, tocolor(0,0,0,150), false) local endY = math.ceil((h/100)*6) endY = endY - 4 if getTime <= time then endY = (getTime/time)*endY else removeEventHandler("onClientRender", root, reload) drawHandler = nil drawHandler = addEventHandler("onClientRender", root, reloadFinished) if getElementModel(getPedOccupiedVehicle(localPlayer)) ~= 432 then local sfx = playSFX ( "genrl", 136, 72 ) setSoundVolume (sfx, 1) end setMarkerColor ( corona, r, g, 0, 150 ) start = nil fired = false end dxDrawRectangle (2, h-endY-height-8, height+2, endY, tocolor(220,0,0,150), false) end function reloadFinished() if not isPedInVehicle(localPlayer) then removeEventHandler("onClientRender", root, reloadFinished) drawHandler = nil else dxDrawRectangle (0, h-endY-height-6, height+6, endY, tocolor(0,0,0,150), false) dxDrawRectangle (2, h-endY-height-4, height+2, endY-4, tocolor(220,0,0,150), false) end end function marker() if not isPedInVehicle(localPlayer) then removeEventHandler("onClientRender", getRootElement(), marker) if isTimer(soundTimer) then killTimer(soundTimer) end fired = false drawHandler = nil setElementPosition (corona, 0, 0, -10) else local vx, vy, vz = nil, nil, nil local cx, cy, cz = nil, nil, nil local veh = getPedOccupiedVehicle ( localPlayer ) if veh then local x, y, z = getVehicleComponentPosition( veh, "misc_a" ) cx, cy, cz = getPositionFromElementOffset( veh, x, y, z ) x, y, z = getVehicleComponentPosition( veh, "misc_c" ) vx, vy, vz = getPositionFromElementOffset( veh, x, y, z ) if vx ~= nil then local velX = (vx - cx) /range local velY = (vy - cy) /range local velZ = (vz - cz) /range local vx1, vy1 = cx + (velX * 50 * 0.1), cy + (velY * 50 * 0.1) local vx2, vy2 = cx + (velX * 50 * 0.2), cy + (velY * 50 * 0.2) local vx3, vy3 = cx + (velX * 50 * 0.3), cy + (velY * 50 * 0.3) local vx4, vy4 = cx + (velX * 50 * 0.5), cy + (velY * 50 * 0.5) local vx5, vy5 = cx + (velX * 50 * 0.6), cy + (velY * 50 * 0.6) local vx6, vy6 = cx + (velX * 50 * 0.7), cy + (velY * 50 * 0.7) local vx7, vy7 = cx + (velX * 50 * 0.-- s8) -->, cy + (velY * 50 * 0. local m1 = cz + (velZ * 50 * 0.1) - ((getGravity()*2400*0.01)/2) local m2 = cz + (velZ * 50 * 0.2) - ((getGravity()*2400*0.04)/2) local m3 = cz + (velZ * 50 * 0.3) - ((getGravity()*2400*0.09)/2) local m4 = cz + (velZ * 50 * 0.5) - ((getGravity()*2400*0.25)/2) local m5 = cz + (velZ * 50 * 0.6) - ((getGravity()*2400*0.36)/2) local m6 = cz + (velZ * 50 * 0.7) - ((getGravity()*2400*0.49)/2) local m7 = cz + (velZ * 50 * 0.-- s8) --> - ((getGravity()*2400*0.64)/2) Link to comment
-Doc- Posted June 7, 2015 Author Share Posted June 7, 2015 Can you help me add laser at rhino in this script? reloadTime = 6000 -- for Rhino reloadTimeHydra = 4000 -- for Hydra reloadTimeHunter = 3000 -- for Hunter range = 2 --*** BETTER NOT TOUCH BELOW *** event = nil fired = false drawHandler = nil armedVehicles = {[425]=true, [520]=true, [432]=true} w, h = guiGetScreenSize() height = nil endY = nil r, g = 255, 0 time = 0 function getPositionFromElementOffset(element,offX,offY,offZ) local m = getElementMatrix ( element ) -- Get the matrix local x = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1] local y = offX * m[1][2] + offY * m[2][2] + offZ * m[3][2] + m[4][2] local z = offX * m[1][3] + offY * m[2][3] + offZ * m[3][3] + m[4][3] return x, y, z end function onStart() height = math.ceil(h / 50) if height < 19 then height = 19 end endY = math.ceil((h/100)*6) corona = createMarker (0, 0, -10, "corona", 1.0, 200, 100, 0, 150) bindKey ( "mouse1", "down", toggleRhino ) bindKey("vehicle_fire", "down", toggleHunter) bindKey("vehicle_secondary_fire", "down", toggleHunter) color = tocolor(255, 255, 255, 200) end addEventHandler("onClientResourceStart", resourceRoot, onStart) function entering( thePlayer, seat ) if thePlayer == localPlayer then toggleControl ( "vehicle_fire", true ) toggleControl ( "vehicle_secondary_fire", true ) local model = getElementModel ( source ) if model == 432 or model == 425 or model == 520 then drawHandler = addEventHandler("onClientRender", root, reloadFinished) end if model == 432 then toggleControl ( "vehicle_fire", false ) toggleControl ( "vehicle_secondary_fire", false ) addEventHandler("onClientRender", root, marker) event = true end end end addEventHandler("onClientVehicleEnter", getRootElement(), entering) function exit( thePlayer, seat ) if thePlayer == localPlayer then local model = getElementModel ( source ) if model == 432 then if event ~= nil then removeEventHandler("onClientRender", root, marker) event = nil end toggleControl ( "vehicle_fire", true ) toggleControl ( "vehicle_secondary_fire", true ) end end end addEventHandler("onClientVehicleExit", getRootElement(), exit) addEventHandler("onClientElementDestroy", getRootElement(), function () if (getElementModel(source) == 432 and getVehicleController(source) == localPlayer) then if event ~= nil then removeEventHandler("onClientRender", root, marker) event = nil end toggleControl ( "vehicle_secondary_fire", true ) end end) function wasted() if source == localPlayer then if event ~= nil then removeEventHandler("onClientRender", root, marker) event = nil end toggleControl ( "vehicle_fire", true ) toggleControl ( "vehicle_secondary_fire", true ) end end addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), wasted ) function clientResourceStop() toggleControl ( "vehicle_fire", true ) toggleControl ( "vehicle_secondary_fire", true ) end addEventHandler( "onClientResourceStop", getResourceRootElement(getThisResource()), clientResourceStop ) function toggleRhino() if fired == false then if isPedInVehicle ( localPlayer ) and not isCursorShowing() then local veh = getPedOccupiedVehicle ( localPlayer ) if (veh) then if ( getElementModel ( veh ) == 432 ) then fired = true local turX, turY, turZ = getElementPosition(veh) local cx,cy,cz = getVehicleComponentPosition( veh, "misc_a" ) local x, y, z = getVehicleComponentPosition( veh, "misc_c" ) local barrelX, barrelY, barrelZ = getPositionFromElementOffset(veh,cx,cy,cz) local muzzleX, muzzleY, muzzleZ = getPositionFromElementOffset(veh,x,y,z) local velX = (muzzleX - barrelX) /range local velY = (muzzleY - barrelY) /range local velZ = (muzzleZ - barrelZ) /range local vx, vy, vz = getElementVelocity(veh) setElementVelocity (veh, vx+(((velX/3)*(-1))/50), vy+(((velY/3)*(-1))/50), vz+(((velZ/3)*(-1))/50) ) bullet = createProjectile(veh, 21, muzzleX, muzzleY, muzzleZ, 1, nil, 0, 0, 0, velX, velY, velZ) createExplosion(turX, turY, turZ-10, 8, false, 0.5, false) removeEventHandler("onClientRender", root, reloadFinished) drawHandler = nil start = getTickCount() drawHandler = addEventHandler("onClientRender", root, reload) time = 6000 soundTimer = setTimer(function() local sound = playSound("reload.mp3") setSoundVolume(sound, 0.1) end, (reloadTime-1000), 1) end end end end end function toggleHunter(control) if isPedInVehicle(localPlayer) then local model = getElementModel(getPedOccupiedVehicle(localPlayer)) if model == 425 and fired == false and control == "vehicle_fire" then fired = true setTimer(function() toggleControl ( "vehicle_fire", false ) end, 100, 1) setTimer(function() toggleControl ( "vehicle_fire", true ) fired = false end, reloadTimeHunter, 1) removeEventHandler("onClientRender", root, reloadFinished) drawHandler = nil start = getTickCount() drawHandler = addEventHandler("onClientRender", root, reload) time = 3000 elseif model == 520 and fired == false and control == "vehicle_secondary_fire" then fired = true setTimer(function() toggleControl ( "vehicle_secondary_fire", false ) end, 100, 1) setTimer(function() toggleControl ( "vehicle_secondary_fire", true ) fired = false end, reloadTimeHydra, 1) removeEventHandler("onClientRender", root, reloadFinished) drawHandler = nil start = getTickCount() drawHandler = addEventHandler("onClientRender", root, reload) time = 4000 end end end function reload() if not isPedInVehicle(localPlayer) then removeEventHandler("onClientRender", root, reload) drawHandler = nil end setMarkerColor ( corona, 255, 0, 0, 100 ) local getTime = (getTickCount()) - start local height = math.ceil(h / 50) if height < 19 then height = 19 end dxDrawRectangle (0, h-endY-height-6, height+6, endY, tocolor(0,0,0,150), false) local endY = math.ceil((h/100)*6) endY = endY - 4 if getTime <= time then endY = (getTime/time)*endY else removeEventHandler("onClientRender", root, reload) drawHandler = nil drawHandler = addEventHandler("onClientRender", root, reloadFinished) if getElementModel(getPedOccupiedVehicle(localPlayer)) ~= 432 then local sfx = playSFX ( "genrl", 136, 72 ) setSoundVolume (sfx, 1) end setMarkerColor ( corona, r, g, 0, 150 ) start = nil fired = false end dxDrawRectangle (2, h-endY-height-8, height+2, endY, tocolor(220,0,0,150), false) end function reloadFinished() if not isPedInVehicle(localPlayer) then removeEventHandler("onClientRender", root, reloadFinished) drawHandler = nil else dxDrawRectangle (0, h-endY-height-6, height+6, endY, tocolor(0,0,0,150), false) dxDrawRectangle (2, h-endY-height-4, height+2, endY-4, tocolor(220,0,0,150), false) end end function marker() if not isPedInVehicle(localPlayer) then removeEventHandler("onClientRender", getRootElement(), marker) if isTimer(soundTimer) then killTimer(soundTimer) end fired = false drawHandler = nil setElementPosition (corona, 0, 0, -10) else local vx, vy, vz = nil, nil, nil local cx, cy, cz = nil, nil, nil local veh = getPedOccupiedVehicle ( localPlayer ) if veh then local x, y, z = getVehicleComponentPosition( veh, "misc_a" ) cx, cy, cz = getPositionFromElementOffset( veh, x, y, z ) x, y, z = getVehicleComponentPosition( veh, "misc_c" ) vx, vy, vz = getPositionFromElementOffset( veh, x, y, z ) if vx ~= nil then local velX = (vx - cx) /range local velY = (vy - cy) /range local velZ = (vz - cz) /range local vx1, vy1 = cx + (velX * 50 * 0.1), cy + (velY * 50 * 0.1) local vx2, vy2 = cx + (velX * 50 * 0.2), cy + (velY * 50 * 0.2) local vx3, vy3 = cx + (velX * 50 * 0.3), cy + (velY * 50 * 0.3) local vx4, vy4 = cx + (velX * 50 * 0.5), cy + (velY * 50 * 0.5) local vx5, vy5 = cx + (velX * 50 * 0.6), cy + (velY * 50 * 0.6) local vx6, vy6 = cx + (velX * 50 * 0.7), cy + (velY * 50 * 0.7) local vx7, vy7 = cx + (velX * 50 * 0.-- s8) -->, cy + (velY * 50 * 0. local m1 = cz + (velZ * 50 * 0.1) - ((getGravity()*2400*0.01)/2) local m2 = cz + (velZ * 50 * 0.2) - ((getGravity()*2400*0.04)/2) local m3 = cz + (velZ * 50 * 0.3) - ((getGravity()*2400*0.09)/2) local m4 = cz + (velZ * 50 * 0.5) - ((getGravity()*2400*0.25)/2) local m5 = cz + (velZ * 50 * 0.6) - ((getGravity()*2400*0.36)/2) local m6 = cz + (velZ * 50 * 0.7) - ((getGravity()*2400*0.49)/2) local m7 = cz + (velZ * 50 * 0.-- s8) --> - ((getGravity()*2400*0.64)/2) Link to comment
Walid Posted June 7, 2015 Share Posted June 7, 2015 We don't give support with leaked scripts. Link to comment
-Doc- Posted June 7, 2015 Author Share Posted June 7, 2015 Leaked script? It's from community =-=. I just wanna add laser at it and i don't know how Link to comment
#RooTs Posted June 7, 2015 Share Posted June 7, 2015 Leaked script? It's from community =-=. I just wanna add laser at it and i don't know how URL download ? Link to comment
-Doc- Posted June 7, 2015 Author Share Posted June 7, 2015 There https://community.multitheftauto.com/index.php?p=resources&s=details&id=1280 Link to comment
-Doc- Posted June 7, 2015 Author Share Posted June 7, 2015 Now can someone help me to draw a laser at the tank? Link to comment
#RooTs Posted June 7, 2015 Share Posted June 7, 2015 We don't give support with leaked scripts. is this a joke? script uploaded to date 2010-11-13 14:27:11 Link to comment
#RooTs Posted June 7, 2015 Share Posted June 7, 2015 @Roots can u help me? what you need? Link to comment
-Doc- Posted June 7, 2015 Author Share Posted June 7, 2015 When i'm in rhino to draw near canon a laser with red color Link to comment
-Doc- Posted June 7, 2015 Author Share Posted June 7, 2015 Anyone? I wanna make it like this http://imgur.com/iwxTSjP Link to comment
-.Paradox.- Posted June 7, 2015 Share Posted June 7, 2015 isLineOfSightClear processLineOfSight getVehicleTurretPosition math.cos math.sin math.pow math.sqrt getScreenFromWorldPosition dxDrawLine3D Link to comment
#RooTs Posted July 24, 2015 Share Posted July 24, 2015 @El_Zorro, poste the your code. please Link to comment
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