alexaxel705

Members
  • Content Count

    20
  • Joined

  • Last visited

Community Reputation

15 Decent

3 Followers

About alexaxel705

  • Rank
    Civilian

Details

  • Location
    Russian Federation

Recent Profile Visitors

1,301 profile views
  1. function RGBToHex(red, green, blue, alpha) if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255) or (alpha and (alpha < 0 or alpha > 255))) then return nil end if(alpha) then return string.format("#%.2X%.2X%.2X%.2X", red,green,blue,alpha) else return string.format("#%.2X%.2X%.2X", red,green,blue) end end dxDrawText(RGBToHex(getTeamColor(getTeamFromName("Police"))).."Police", 450,40,64,20,tocolor(255,255,255,255),1.00,"default-bold","center","center", nil, nil, nil, true)
  2. function checkwater() if(isPedDoingTask(localPlayer, "TASK_COMPLEX_IN_WATER")) then setElementHealth(localPlayer, getElementHealth(localPlayer)-0.5) end end addEventHandler("onClientPreRender", root, checkwater) in client
  3. @Erema93 Теоретически, для этого необходимо единовременно загрузить более 211 уникальных моделей в радиусе 300 метров. На практике такое трудно представить, разве что какая нибудь пирамида из авто. Theoretically, for this it is necessary to simultaneously load more than 211 unique models within a radius of 300 meters. In practice, it’s hard to imagine, except perhaps some kind of pyramid from a car.
  4. Вот видео инструкция по запуску скрипта.
  5. alexaxel705

    Unlimit

    it's possible, using the same methods. for script Unlimited Object initial file size ~800 Mb. i'll try experementing with skins and objects in the future.
  6. alexaxel705

    Area name

    setPlayerHudComponentVisible("area_name", false) in client setPlayerHudComponentVisible(thePlayer, "area_name", false) in server
  7. Thomas_Nightfire GetMarrot return Angle in the range from -180 to 180 on which we need to turn wheel. -180 right, +180 left. if active reverse +180 right, -180 left function setPedAnalogControlState takes values from 0.0 to 1.0 therefore, we lower the angle concentration at an acceptable level
  8. Thomas_Nightfire function getPointInFrontOfPoint(x, y, z, rZ, dist) local offsetRot = math.rad(rZ) local vx = x + dist * math.cos(offsetRot) local vy = y + dist * math.sin(offsetRot) return vx, vy, z end function GetMarrot(angle, rz) local marrot = 0 if(angle > rz) then marrot = -(angle-rz) else marrot = rz-angle end if(marrot > 180) then marrot = marrot-360 elseif(marrot < -180) then marrot = marrot+360 end return marrot end function findRotation(x1, y1, x2, y2) local t = -math.deg(math.atan2(x2 - x1, y2 - y1)) return t < 0 and t + 360 or t end local px,py,pz = getElementPosition(localPlayer) local prx,pry,prz = getElementRotation(localPlayer) local vx,vy,vz = getPointInFrontOfPoint(px,py,pz, prz+90, 15) local thePed = createPed(299, vx,vy,vz+1, prz+180) local theVehicle = createVehicle(404, vx,vy,vz+1, 0,0,prz+180) warpPedIntoVehicle(thePed, theVehicle) function UpdateBot() px,py,pz = getElementPosition(localPlayer) prx,pry,prz = getElementRotation(localPlayer) vx,vy,vz = getElementPosition(theVehicle) local vrx,vry,vrz = getElementRotation(theVehicle) local brakes = false local maxspd = 40 local MaxDist = 4 local vehreverse = false if(getDistanceBetweenPoints2D(px,py, vx, vy) < MaxDist) then brakes = true end if(brakes) then setPedAnalogControlState(thePed, "accelerate", 0) setPedAnalogControlState(thePed, "brake_reverse", 0) setPedControlState(thePed, "handbrake", true) setElementVelocity (theVehicle, 0,0,0) else local vxv, vyv, vzv = getElementVelocity(theVehicle) local s = (vxv^2 + vyv^2 + vzv^2)^(0.5)*156 -- Speed local rot = GetMarrot(findRotation(vx,vy,px,py),vrz) if(rot > 80) then if(rot > 100) then vehreverse = true end rot = 20 elseif(rot < -20) then if(rot < -80) then vehreverse = true end rot = -20 end if(vehreverse) then setPedAnalogControlState(thePed, "brake_reverse", 1-(s*1/maxspd)) setPedAnalogControlState(thePed, "accelerate", 0) setPedControlState(thePed, "handbrake", false) if(s > 10) then setPedControlState(thePed, "handbrake", true) else if(rot > 0) then setPedAnalogControlState(thePed, "vehicle_left", (rot)/20) else setPedAnalogControlState(thePed, "vehicle_right", -(rot)/20) end end else if(rot > 0) then setPedAnalogControlState(thePed, "vehicle_right", (rot)/20) else setPedAnalogControlState(thePed, "vehicle_left", -(rot)/20) end setPedAnalogControlState(thePed, "brake_reverse", 0) setPedControlState(thePed, "handbrake", false) if(s < maxspd) then setPedAnalogControlState(thePed, "accelerate", 1-(s*1/maxspd)) else setPedAnalogControlState(thePed, "accelerate", 0) setPedAnalogControlState(thePed, "brake_reverse", (s/maxspd)-1) end end end end setTimer(UpdateBot, 50, 0) Demo
  9. function scriptCreateTank ( commandName ) local luckyBugger = getLocalPlayer() -- get the local player local x, y, z = getElementPosition ( luckyBugger ) -- retrive the player's position local theVehicle = createVehicle ( 404, x, y, z + 10 ) -- create the tank 10 units above them setElementData(theVehicle, "model", 737) outputChatBox ( "You got Tank'd!", 255, 0, 0) end --Attach the 'scriptCreateTank' function to the "tank" command addCommandHandler ( "tank", scriptCreateTank ) [M]Province Надо указать новый ID модели setElementData(theVehicle, "model"). Модель которая указывается в createVehicle значения не имеет, главное чтобы была в диапазоне от 400 до 611. Во время события onClientElementStreamIn он читает новую модель, и занимает свободный слот в диапазоне игровых моделей от 400 до 611 с учетом типа транспортного средства, в данном случае "Automobile". При событии onClientElementStreamOut он освобождает раннее занятый слот.
  10. Для добавления новой модели, например на ID 737. Надо закинуть файлы txd и dff новой модели в папку models/ Добавить в meta.xml <file src="models/NewModel.dff" type="client" download="false" /> <file src="models/NewModel.txd" type="client" download="false" /> И добавить название модели в client.lua local ModelsName = { ... [736] ... [737] = {"models/NewModel", "Automobile"}, } Перед запуском скрипт надо распаковать. Ну и скачивать его соответственно с https://github.com/alexaxel705/Unlimited-Vehicle Для спауна авто используй функцию CreateVehicle() в server.lua Демонстрация работы скрипта: http://109.227.228.4/Unlimited-Vehicle-System.mp4
  11. local wind = false function checkTime() local h, _ = getTime() if(h == 6) then if(not isElement(wind)) then wind = createObject(1337,2321.5, -1659.5,13.5) outputChatBox("Object created") end else if(isElement(wind)) then destroyElement(wind) outputChatBox("Object destroyed") end end end addEventHandler("onClientRender", getRootElement(), checkTime)
  12. alexaxel705

    vehicle nodes

    Alternative vehicle-node script https://github.com/alexaxel705/vehicle-node Debug mode:
  13. I updated this function in June 2017 If today the question is relevant, then here is a stable solution local identityMatrix = { [1] = {1, 0, 0}, [2] = {0, 1, 0}, [3] = {0, 0, 1} } function QuaternionTo3x3(x,y,z,w) local matrix3x3 = {[1] = {}, [2] = {}, [3] = {}} local symetricalMatrix = { [1] = {(-(y*y)-(z*z)), x*y, x*z}, [2] = {x*y, (-(x*x)-(z*z)), y*z}, [3] = {x*z, y*z, (-(x*x)-(y*y))} } local antiSymetricalMatrix = { [1] = {0, -z, y}, [2] = {z, 0, -x}, [3] = {-y, x, 0} } for i = 1, 3 do for j = 1, 3 do matrix3x3[i][j] = identityMatrix[i][j]+(2*symetricalMatrix[i][j])+(2*w*antiSymetricalMatrix[i][j]) end end return matrix3x3 end function getEulerAnglesFromMatrix(x1,y1,z1,x2,y2,z2,x3,y3,z3) local nz1,nz2,nz3 nz3 = math.sqrt(x2*x2+y2*y2) nz1 = -x2*z2/nz3 nz2 = -y2*z2/nz3 local vx = nz1*x1+nz2*y1+nz3*z1 local vz = nz1*x3+nz2*y3+nz3*z3 return math.deg(math.asin(z2)),-math.deg(math.atan2(vx,vz)),-math.deg(math.atan2(x2,y2)) end function fromQuaternion(x,y,z,w) local matrix = QuaternionTo3x3(x,y,z,w) local ox,oy,oz = getEulerAnglesFromMatrix( matrix[1][1], matrix[1][2], matrix[1][3], matrix[2][1], matrix[2][2], matrix[2][3], matrix[3][1], matrix[3][2], matrix[3][3] ) return ox,oy,oz end local rotx, roty, rotx, rotw = 0, 0, 0.190809, 0.9816272 -- you can read the Quaternion from IPL file createObject(1337, 5540.6654, 1020.55122, 1240.545, fromQuaternion(rotx, roty, rotx, rotw))
  14. function enLVPD2(source, interior, vehicle) if(getElementType(source) == "player") then local vehicle = getPedOccupiedVehicle(source) if vehicle then outputChatBox("* Выйдите из Т/С", source, 255, 255, 0) else local accName = getAccountName ( getPlayerAccount ( source ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "LVPD" and "Admin" ) ) then setElementInterior ( source, 3, 238.68228, 141.67117, 1003.02344 ) else outputChatBox("*У Вас нет пропуска", thaPlayer, 255, 255, 0) end end end end addEventHandler ("onMarkerHit", m, enLVPD2 )
  15. function putPlayerInPosition(timeslice) local cx,cy,cz,ctx,cty,ctz = getCameraMatrix() ctx,cty = ctx-cx,cty-cy timeslice = timeslice*0.1 if getKeyState("num_7") then timeslice = timeslice*4 end if getKeyState("num_9") then timeslice = timeslice*0.25 end local mult = timeslice/math.sqrt(ctx*ctx+cty*cty) ctx,cty = ctx*mult,cty*mult if getKeyState("w") then abx,aby = abx+ctx,aby+cty end if getKeyState("s") then abx,aby = abx-ctx,aby-cty end if getKeyState("d") then abx,aby = abx+cty,aby-ctx end if getKeyState("a") then abx,aby = abx-cty,aby+ctx end if getKeyState("space") then abz = abz+timeslice end if getKeyState("lshift") then abz = abz-timeslice end setElementRotation(localPlayer,0,0, getPedCameraRotation(localPlayer), "ZXY", true) setElementPosition(localPlayer,abx,aby,abz) end function toggleAirBrake() air_brake = not air_brake or nil if air_brake then abx,aby,abz = getElementPosition(localPlayer) addEventHandler("onClientPreRender",root,putPlayerInPosition) else abx,aby,abz = nil removeEventHandler("onClientPreRender",root,putPlayerInPosition) end end bindKey("num_0","down",toggleAirBrake)