Jump to content

mucuk6547

Members
  • Posts

    133
  • Joined

  • Last visited

Everything posted by mucuk6547

  1. local vehLiTable = { leftEN ={}, rightEN ={}, left={},right={}, color ={}, isBlown={}, vehType={}, strOut={} } local gWorldSelfShadow = true -- enables object self shadowing ( may be bugged for rotated objects on a custom map) local gLightTheta = math.rad(6) -- Theta is the inner cone angle (6) local gLightPhi = math.rad(30) -- Phi is the outer cone angle (18) local gLightFalloff = 1.5 -- light intensity attenuation between the phi and theta areas local gLightAttenuation = 20 -- 15 local flTimerUpdate = 200 -- the effect update time interval local lightMaxDistance = 90 local excludeVehicleId = {592,577,511,512,593,520,553,476,519,460,513,548,425,417,487,488,497,563,447,469,472,473,493,595,484,430,453,452, 446,454,581,509,481,462,521,463,510,522,461,448,468,586,602,496,401,518,527,589,419,587,533,526,474,545,517,410,600,436,439,549,491,445,604, 507,585,466,492,546,551,516,467,426,547,405,580,409,550,566,540,421,529,485,431,438,437,574,420,525,408,552,433,490,528,407,544,470,432,601, 428,523,499,609,498,524,532,578,486,406,573,455,588,403,423,414,443,515,514,531,456,459,422,482,605,530,418,572,582,413,440,543,583,478,554, 579,400,404,489,505,479,442,458,536,575,534,567,535,576,412,402,542,603,475,429,541,415,480,562,565,434,494,502,503,411,559,561,560,506,451, 558,555,477,441,464,594,501,465,564,606,607,610,584,611,608,435,450,591,590,538,570,569,537,449,568,424,504,457,483,508,571,500,444,556,557, 471,495,539} 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] -- Apply transform 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 -- Return the transformed point end addEventHandler("onClientPreRender", root, function() for index,this in ipairs(getElementsByType("vehicle")) do if vehLiTable.leftEN[this] then local rx, ry, rz = getElementRotation(this, "ZXY") ry = ry - 4 rz = rz - 90 local x1,y1,z1,x2,y2,z2 local col = vehLiTable.color[this] local vehType = vehLiTable.vehType[this] if vehType == "Bike" then x1,y1,z1 = getPositionFromElementOffset(this,0,0.8,0.1) -- (left,front,above) elseif vehType == "Train" then x1,y1,z1 = getPositionFromElementOffset(this,-0.7,15.0,-0.9) -- (left,front,above) x2,y2,z2 = getPositionFromElementOffset(this,0.7,15.0,-0.9) -- (left,front,above) else x1,y1,z1 = getPositionFromElementOffset(this,-1.0,0.5,-0.1) -- (left,front,above) x2,y2,z2 = getPositionFromElementOffset(this,1.0,-5.0,-0.1) -- (left,front,above) end if vehLiTable.leftEN[this] then exports.dynamic_lighting:setLightDirection(vehLiTable.left[this],rx,ry,rz,true) exports.dynamic_lighting:setLightPosition(vehLiTable.left[this],x1,y1,z1) exports.dynamic_lighting:setLightColor(vehLiTable.left[this],col[1],col[2],col[3],1) end if vehLiTable.rightEN[this] and vehType~="Bike" then exports.dynamic_lighting:setLightDirection(vehLiTable.right[this],rx,ry,rz,true) exports.dynamic_lighting:setLightPosition(vehLiTable.right[this],x2,y2,z2) exports.dynamic_lighting:setLightColor(vehLiTable.right[this],col[1],col[2],col[3],1) end end end for index,this in ipairs(getElementsByType("vehicle")) do if vehLiTable.rightEN[this] then local rx, ry, rz = getElementRotation(this, "ZXY") ry = ry - 4 rz = rz - -90 local x1,y1,z1,x2,y2,z2,x3,y3,z3 local col = vehLiTable.color[this] local vehType = vehLiTable.vehType[this] if vehType == "Bike" then x1,y1,z1 = getPositionFromElementOffset(this,0,0.8,0.1) -- (left,front,above) elseif vehType == "Train" then x1,y1,z1 = getPositionFromElementOffset(this,-0.7,15.0,-0.9) -- (left,front,above) x2,y2,z2 = getPositionFromElementOffset(this,0.7,15.0,-0.9) -- (left,front,above) x3,y3,z3 = getPositionFromElementOffset(this,1.0,0.5,-0.1) -- (left,front,above) else x1,y1,z1 = getPositionFromElementOffset(this,-1.0,0.5,-0.1) -- (left,front,above) x2,y2,z2 = getPositionFromElementOffset(this,1.0,0.5,-0.1) -- (left,front,above) x3,y3,z3 = getPositionFromElementOffset(this,1.0,3.5,-0.1) -- (left,front,above) end if vehLiTable.leftEN[this] then exports.dynamic_lighting:setLightDirection(vehLiTable.left[this],rx,ry,rz,true) exports.dynamic_lighting:setLightPosition(vehLiTable.left[this],x1,y1,z1) exports.dynamic_lighting:setLightColor(vehLiTable.left[this],col[1],col[2],col[3],1) end if vehLiTable.rightEN[this] and vehType~="Bike" then exports.dynamic_lighting:setLightDirection(vehLiTable.right[this],rx,ry,rz,true) exports.dynamic_lighting:setLightPosition(vehLiTable.right[this],x2,y2,z2) exports.dynamic_lighting:setLightColor(vehLiTable.right[this],col[1],col[2],col[3],1) end end end end ) function createWorldLight() return exports.dynamic_lighting:createSpotLight(0,0,3,0,0,0,0,0,0,0,true,gLightFalloff,gLightTheta,gLightPhi,gLightAttenuation,gWorldSelfShadow) end function destroyWorldLight(this) return exports.dynamic_lighting:destroyLight(this) end function isInNightTime() local hour, minutes = getTime() return (hour>=22 or hour<=5) end function lightEffectStop(thisVeh) if vehLiTable.leftEN[thisVeh] then destroyWorldLight(vehLiTable.left[thisVeh]) vehLiTable.leftEN[thisVeh]=false end if vehLiTable.rightEN[thisVeh] then destroyWorldLight(vehLiTable.right[thisVeh]) vehLiTable.rightEN[thisVeh]=false end end function lightEffectManage(thisVeh,vehType) if vehLiTable.isBlown[thisVeh] then return end local posX,posY,posZ = getElementPosition(thisVeh) local camX,camY,camZ = getCameraMatrix() local camDist = getDistanceBetweenPoints3D ( posX,posY,posZ,camX,camY,camZ ) local lightSwitched = false local ispastDist = lightMaxDistance < camDist if ispastDist then if vehLiTable.leftEN[thisVeh] then destroyWorldLight(vehLiTable.left[thisVeh]) vehLiTable.leftEN[thisVeh]=false end if vehLiTable.rightEN[thisVeh] then destroyWorldLight(vehLiTable.right[thisVeh]) vehLiTable.rightEN[thisVeh]=false end return end if ((getVehicleLightState ( thisVeh, 0 )==1 or getVehicleOverrideLights(thisVeh)==1)) and vehLiTable.leftEN[thisVeh] then destroyWorldLight(vehLiTable.left[thisVeh]) vehLiTable.leftEN[thisVeh]=false end if ((getVehicleLightState ( thisVeh, 1 )==1 or getVehicleOverrideLights(thisVeh)==1)) and vehLiTable.rightEN[thisVeh] then destroyWorldLight(vehLiTable.right[thisVeh]) vehLiTable.rightEN[thisVeh]=false end if getVehicleEngineState(thisVeh) then if (getVehicleLightState ( thisVeh, 0 )==0 and getVehicleOverrideLights(thisVeh)==0) then if isInNightTime() then if vehLiTable.leftEN[thisVeh]~=true and (getVehicleOccupant( thisVeh ,0 ) or not vehLiTable.strOut[thisVeh]) then if not ispastDist then vehLiTable.left[thisVeh] = createWorldLight() vehLiTable.leftEN[thisVeh]=true lightSwitched=true end end else if vehLiTable.leftEN[thisVeh]==true then destroyWorldLight(vehLiTable.left[thisVeh]) vehLiTable.leftEN[thisVeh]=false end end end if (getVehicleLightState ( thisVeh, 1 )==0 and getVehicleOverrideLights(thisVeh)==0 and vehType~="Bike") then if isInNightTime() then if vehLiTable.rightEN[thisVeh]~=true and (getVehicleOccupant( thisVeh ,0 ) or not vehLiTable.strOut[thisVeh]) then if not ispastDist then vehLiTable.right[thisVeh] = createWorldLight() vehLiTable.rightEN[thisVeh]=true lightSwitched=true end end else if vehLiTable.rightEN[thisVeh]==true then destroyWorldLight(vehLiTable.right[thisVeh]) vehLiTable.rightEN[thisVeh]=false end end end end if (getVehicleLightState ( thisVeh, 0 )==0 and getVehicleOverrideLights(thisVeh)==2) and vehLiTable.leftEN[thisVeh]~=true then if not ispastDist then vehLiTable.left[thisVeh] = createWorldLight() vehLiTable.leftEN[thisVeh]=true end end if (getVehicleLightState ( thisVeh, 1 )==0 and getVehicleOverrideLights(thisVeh)==2) and vehLiTable.rightEN[thisVeh]~=true and vehType~="Bike" then if not ispastDist then vehLiTable.right[thisVeh] = createWorldLight() vehLiTable.rightEN[thisVeh]=true end end if lightSwitched then vehLiTable.strOut[thisVeh]=false end if vehLiTable.rightEN[thisVeh] or vehLiTable.leftEN[thisVeh] then local r,g,b = getVehicleHeadLightColor(thisVeh) vehLiTable.color[thisVeh] = {r/255,g/255,b/255} end end addEventHandler( "onClientElementStreamOut", getRootElement( ),function () if getElementType( source ) == "vehicle" then vehLiTable.strOut[source] = true end end ) addEventHandler( "onClientElementStreamIn", getRootElement( ),function () if getElementType( source ) == "vehicle" then --vehLiTable.strOut[source] = false end end ) addEventHandler("onClientResourceStart", getResourceRootElement( getThisResource()), function() if FLenTimer then return end local shTeNul = dxCreateShader ( "shaders/shader_null.fx",0,0,false ) engineApplyShaderToWorldTexture(shTeNul, "headlight*" ) for index,thisVeh in ipairs(getElementsByType("vehicle")) do vehLiTable.isBlown[thisVeh] = isVehicleBlown(thisVeh) vehLiTable.strOut[thisVeh] = not isElementStreamedIn(thisVeh) end FLenTimer = setTimer( function() for index,thisVeh in ipairs(getElementsByType("vehicle")) do if isElementStreamedIn(thisVeh) then local vehType = getVehicleType(thisVeh) local vehID = getVehicleID(thisVeh) local isMatch = true for index,name in ipairs(excludeVehicleId) do if vehID==name then isMatch = false end end vehLiTable.vehType[thisVeh] = vehType if isMatch and ((vehType == "Automobile") or (vehType == "Monster Truck") or (vehType == "Bike") or (vehType == "Train")) then if isElementStreamedIn(thisVeh) then lightEffectManage(thisVeh,vehType) elseif not isElementStreamedIn(thisVeh) then lightEffectStop(thisVeh) end end end end end ,flTimerUpdate,0 ) end ) addEventHandler("onClientResourceStop", getResourceRootElement( getThisResource()), function() if not FLenTimer then return end killTimer(FLenTimer) for index,thisVeh in ipairs(getElementsByType("vehicle")) do lightEffectStop(thisVeh) end end ) addEventHandler("onClientVehicleExplode", getRootElement(), function() if getElementType(source) == "vehicle" then vehLiTable.isBlown[source] = true lightEffectStop(source) end end ) addEventHandler("onClientElementDestroy", getRootElement(), function () if getElementType(source) == "vehicle" then lightEffectStop(source) end end ) I can't add bindKey to this code.
  2. https://cdn.discordapp.com/attachments/278520948347502592/1114565770748379288/2023-06-03_17-44-39.mp4 why is he doing this Change shotgun animation
  3. Client; bindKey("x", "both", --- tuş ayar function(key, state) if state == "down" then if getElementData(localPlayer, "apontar") == false then setElementData(localPlayer, "apontar", true) triggerServerEvent ( "onClientSyncVOZ", localPlayer ) end else setElementData(localPlayer, "apontar", false) triggerServerEvent ( "onClientSyncVOZparar", localPlayer ) end end ) Server; addEvent("onClientSyncVOZ", true ) addEventHandler("onClientSyncVOZ", root, function() setPedAnimation(source, "GHANDS", "gsign1", 0, true, false, false) setTimer ( setPedAnimationProgress, 100, 1, source, "gsign1", 1.16) setTimer ( setPedAnimationSpeed, 1500, 1, source, "gsign1", 0) end ) addEvent("onClientSyncVOZparar", true ) addEventHandler("onClientSyncVOZparar", root, function() setTimer ( setPedAnimation, 100, 1, source, "GHANDS", "gsign1", 5000, false, false, false) setTimer ( setPedAnimation, 250, 1, source, nil) end ) Can I add the custom animation code I made, called santral.ifp, to these codes?
  4. Hi, I want the character to tilt right when moving. It bends to the right, but this time it does not move, w a s d locks. Please help me. https://i.imgyukle.com/2023/04/20/QbJ5sf.png local isLeaned = false local ifp = engineLoadIFP("parkour.ifp") function leanRight() if not isLeaned then local task = getPedTask(localPlayer, "secondary", 0) if task == "TASK_SIMPLE_USE_GUN" or task == "TASK_SIMPLE_IN_AIR" then isLeaned = true setPedAnimation(localPlayer, "parkour", "CartWheel", -1, false, false, false, true) setControlState("forwards", false) setControlState("backwards", false) setControlState("left", false) setControlState("right", false) setControlState("fire", false) end end end bindKey("q", "down", leanRight) function leanLeft() if not isLeaned then local task = getPedTask(localPlayer, "secondary", 0) if task == "TASK_SIMPLE_USE_GUN" or task == "TASK_SIMPLE_IN_AIR" then isLeaned = true setPedAnimation(localPlayer, "parkour", "CartWheel", -1, false, false, false, true) setControlState("forwards", false) setControlState("backwards", false) setControlState("left", false) setControlState("right", false) setControlState("fire", false) end end end bindKey("e", "down", leanLeft) function stopLean() if isLeaned then setPedAnimation(localPlayer, false) isLeaned = false setControlState("forwards", getKeyState("w")) setControlState("backwards", getKeyState("s")) setControlState("left", getKeyState("a")) setControlState("right", getKeyState("d")) setControlState("fire", getKeyState("mouse1")) end end bindKey("e", "up", stopLean) bindKey("q", "up", stopLean)
  5. I changed a tree model from the GTA3.IMG file, but it doesn't appear in mta, why do you think?
  6. I changed a tree model from the GTA3.IMG file, but it doesn't appear in mta, why do you think?
  7. I've searched on the internet but nothing came up, can you help me?
  8. With magic txd, the file size is very large.
  9. Hello, I made a drawing from scratch, when you import textures with TXD Workshop, it will be white in the game, please help.
  10. Let's not start well it is not in my own car.
  11. I want to make dff lock by myself or I am looking for a dff locking system that does not open.
  12. car dff size 24 mb txd 113 mb I am doing it for trial purposes but it does not appear in the game.
  13. Hello, I transferred the car, but it is crooked and the lamps are broken. How do I solve it?
  14. I watched your video, but I do not understand anything at the tissue site and I do not understand because it is written. Sorry, do you have any reason for video narration? I also got the map from your video.
  15. I installed Map 3ds max but I couldn't do the textures
  16. well, the wheel is too small in the original vehicle
  17. Hello again, half of the wheel goes into the ground, what should I do?
  18. I solved the problem as you said thank you. But I have another question, and I will ask him in a few hours. Thank you for your help.
  19. I solved the problem as you said thank you. But I have another question, and I will ask him in a few hours. Thank you for your help.
  20. I open the 3ds max package from uvw and I don't have the part you call kams script
  21. I made a carload and when I turned it into a game, the model also has a texture error. What should I do?
  22. Я конвертировал пробную шкуру с помощью Lua's, но ничего не произошло.
  23. мы его запираем, но как мы снова его включаем?
×
×
  • Create New...