Jump to content

DarkByte

Members
  • Posts

    207
  • Joined

  • Last visited

Everything posted by DarkByte

  1. Working but how to create vehicle by their custom name like /cv bugatti or /cv lamborghini ?
  2. Yea, and got vehicle name by a lower name like /cv bugatti and get vehicle name from tables.
  3. I want to create vehicles by a lower name and get them from tables and then insert the script in this one. function createVehicleCommand(cmd, ...) local vehID local vehiclesToCreate = {} local elem = getPedOccupiedVehicle(g_Me) local args = { ... } for i,v in ipairs(args) do vehID = tonumber(v) if not vehID then vehID = getVehicleModelFromName(v) end if elem then errMsg('• Please leave the vehicle to create another one!') return end if vehID then table.insert(vehiclesToCreate, math.floor(vehID)) end end server.giveMeVehicles(vehiclesToCreate) end addCommandHandler('createvehicle', createVehicleCommand) addCommandHandler('cv', createVehicleCommand)
  4. Hi i made this script but its not working. function getVehicleModelFromName(vehId) local vehiclen = getVehicleModelFromName(vehID) if vehiclen then return vehiclen end for _,vehiclen in ipairs(getElementsByType("vehicle")) do if string.find(string.gsub(getVehicleModelFromName(vehId):lower(),"#%x%x%x%x%x%x", ""), getVehicleModelFromName:lower(), 1, true) then return vehiclen end end return false end
  5. DarkByte

    Laser

    Yea its workin', but when player is aiming in his team mate laser turns in red but i don't need that
  6. DarkByte

    Laser

    One last thing. When laser and image is aiming on a vehicle or a enemy to be red. Can you help me?
  7. DarkByte

    Laser

    Holy SHiT. To make a missile follow a object
  8. DarkByte

    Laser

    Ok. How to make a missile follow a object or a vehicle?
  9. DarkByte

    Laser

    And to change those lines to a image. EDIT Can you change for me to throw a missile with id 19 not a abject?
  10. DarkByte

    Laser

    One more thing. I got this script on community. Can you help me to draw the lines only when player is in hunter not in every vehicle? -- Client local gMe = getLocalPlayer() local cando = true local key = "vehicle_fire" local waitseconds = 1 local enabled = true function renderRocketFX() for index, object in pairs(getElementsByType("object")) do if(getElementData(object, "rocket.state") == true) then local x1, y1, z1 = getElementPosition(object) for i = 1, 5, 1 do fxAddTyreBurst(x1, y1, z1, 0, 0, 0) fxAddPunchImpact(x1, y1, z1, 0, 0, 0) end end end end addEventHandler("onClientRender", getRootElement(), renderRocketFX) addEventHandler("onClientPreRender", getRootElement(), renderRocketFX) addEventHandler("onClientRender", getRootElement(), function() if(enabled == true) then local veh = getPedOccupiedVehicle(gMe) if not(veh) then return end local col2 = getElementData(veh, "r.col2") local col1 = getElementData(veh, "r.col1") if not(col2) or not(col1) then return end local x, y, z = getElementPosition(col2) local x1, y1, z1 = getElementPosition(col1) z1 = z1+getElementDistanceFromCentreOfMassToBaseOfModel(veh)*2 local hit, x2, y2, z2 = processLineOfSight(x, y, z, x1, y1, z1) if not(x2) or not(y2) or not(z2) then x2, y2, z2 = x, y, z end local sx, sy = getScreenFromWorldPosition(x2, y2, z2) if not(sx) or not(sy) then return end dxDrawLine(sx, sy-12.9, sx, sy+12.9, tocolor(0, 255, 0), 2) dxDrawLine(sx-12.9, sy, sx+12.9, sy, tocolor(0, 255, 0), 2) end end) addEvent("onClientRocketFire", true) addEventHandler("onClientRocketFire", getRootElement(), function(theRocket) local x, y, z = getElementPosition(theRocket) local sound = playSound3D("rocket.mp3", x, y, z, false) setSoundMaxDistance(sound, 100) attachElements(sound, theRocket) end) function fireVehicleRocket() if(cando == false) then return end if(enabled == false) then return end local veh = getPedOccupiedVehicle(gMe) if(veh) then else unbindKey(key, "up", fireVehicleRocket) return end local col1 = getElementData(veh, "r.col1") local col2 = getElementData(veh, "r.col2") local x1, y1, z1 = getElementPosition(col1) local x2, y2, z2 = getElementPosition(col2) z1 = z1+getElementDistanceFromCentreOfMassToBaseOfModel(veh)*2 local hit, hx, hy, hz = processLineOfSight(x1, y1, z1, x2, y2, z2) if not(hx) or not(hy) or not(hz) then hx, hy, hz = x2, y2, z2 end local distanz = getDistanceBetweenPoints3D(x1, y1, z1, hx, hy, hz) local time = distanz*10 cando = false setTimer(function() cando = true end, waitseconds*1000, 1) triggerServerEvent("onRocketCreation", gMe, x1, y1, z1, hx, hy, hz, time) end addEventHandler("onClientPlayerWasted", gMe, function() unbindKey(key, "up", fireVehicleRocket) end) addEventHandler("onClientVehicleExit", getRootElement(), function(thePlayer) if(thePlayer ~= gMe) then return end unbindKey(key, "up", fireVehicleRocket) end) addEventHandler("onClientVehicleEnter", getRootElement(), function(thePlayer) if(thePlayer ~= gMe) then return end bindKey(key, "up", fireVehicleRocket) end) function checkVehicleCol() for index, car in pairs(getElementsByType("vehicle")) do if not(getElementData(car, "r.col1")) then local col1 = createColSphere(0, 0, 0, 2) local col2 = createColSphere(0, 0, 0, 2) setElementData(car, "r.col1", col1, false) setElementData(car, "r.col2", col2, false) attachElements(col1, car) attachElements(col2, car, 0, 250, 0) end end end setTimer(checkVehicleCol, 1000, 1) addEventHandler("onClientResourceStop", getResourceRootElement(getThisResource()), function() for index, car in pairs(getElementsByType("vehicle")) do setElementData(car, "r.col1", nil, false) setElementData(car, "r.col2", nil, false) end end) addCommandHandler("missiles", function() enabled = not enabled local shit if(enabled == true) then shit = "enabled" else shit = "disabled" end outputChatBox("Missiles have been "..shit..".", 0, 255, 255) end) -- PROJECTILE VERSION! -- --[[ local x1, y1, z1 = getElementPosition(col1) local rx, ry, rz = getElementRotation(veh) local rotX,rotY,rotZ = getElementRotation(veh) local x, y, z = getElementPosition(veh) local matrix = getElementMatrix(veh) local offX = 0 * matrix[1][1] + 1 * matrix[2][1] + 0 * matrix[3][1] + 1 * matrix[4][1] local offY = 0 * matrix[1][2] + 1 * matrix[2][2] + 0 * matrix[3][2] + 1 * matrix[4][2] local offZ = 0 * matrix[1][3] + 1 * matrix[2][3] + 0 * matrix[3][3] + 1 * matrix[4][3] local vx = offX - x local vy = offY - y local vz = offZ - z x = 0 * matrix[1][1] + 3 * matrix[2][1] + 0 * matrix[3][1] + 1 * matrix[4][1] y = 0 * matrix[1][2] + 3 * matrix[2][2] + 0 * matrix[3][2] + 1 * matrix[4][2] z = 0 * matrix[1][3] + 3 * matrix[2][3] + 0 * matrix[3][3] + 1 * matrix[4][3] createProjectile(gMe, 19, x, y, z, 200, nil, 0, 0, 360 - rotZ, vx, vy, vz) --]] --Server addEvent("onRocketCreation", true) addEventHandler("onRocketCreation", getRootElement(), function(x, y, z, hx, hy, hz, time) local car = getPedOccupiedVehicle(source) if not(car) then return end local rx, ry, rz = getElementRotation(car) local object = createObject(3786, x, y, z+0.5, rx*1.01, ry*1.01, rz-90) local marker = createMarker(x, y, z+0.5, "corona", 1.0, 0, 255, 0) triggerClientEvent(getRootElement(), "onClientRocketFire", source, object) setElementData(object, "rocket.state", true) attachElements(marker, object) setElementCollisionsEnabled(object, false) setObjectScale(object, 1) moveObject(object, time, hx, hy, hz, 0, 0, 0, "InQuad") setTimer( function() destroyElement(object) destroyElement(marker) createExplosion(hx, hy, hz, 7) createExplosion(hx, hy, hz+4, 4) end, time, 1) end)
  11. I need to draw crosshair at the end of the turret, not in middle of screen
  12. DarkByte

    Laser

    Not working. It sais failed to create texture in debug
  13. DarkByte

    Problem

    Bilal trying to clone groam again ha?
  14. OMG. I already made that not working+ You have some errors in script.
  15. DarkByte

    Laser

    But can you help add a image as crosshair at tank?
  16. DarkByte

    Laser

    Thanks man. It had some errors in syntax but i already fixed.
  17. http://imgur.com/GazHPek
  18. To make image move by tank turret and to get end of the target.
  19. DarkByte

    Laser

    One more thing. Line is going through walls.
  20. TO remove CORONA and change to image.
×
×
  • Create New...