PhantomDamn Posted August 5, 2013 Share Posted August 5, 2013 Hola, he estado probando un recurso de shoot en autos.. anteriormente me funcionaba bien en la version 1.3.1 pero ahora volvi a probarlo y no funciona... no se si la nueva version habra cambiado funciones o no se... aqui les dejo el script client side : -- Script by MuLTi! Do not remove credits! -- 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 if (getElementModel ( theVehicle ) ) = "480" 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) --]] y este es el debugscript en modo 3: WARNING: Loading script failed : missiles/client.lua:23: 'then' expected near '=' WARNING: Loading script failed : missiles/client.lua:23: 'then' expected near '=' WARNING: Loading script failed : missiles/client.lua:23: 'then' expected near '=' Link to comment
Bc# Posted August 5, 2013 Share Posted August 5, 2013 linea 23, es == no = asi: if (getElementModel ( theVehicle ) ) == "480" then Link to comment
PhantomDamn Posted August 5, 2013 Author Share Posted August 5, 2013 gracias , me funciono. Link to comment
PhantomDamn Posted August 26, 2013 Author Share Posted August 26, 2013 Bc como hago para privatizar este script para una id de vehiculo.. Link to comment
EstrategiaGTA Posted August 26, 2013 Share Posted August 26, 2013 Usaste un if y getElementModel para obtener la ID del vehículo, ¿no está ya privatizado? Link to comment
Tonyx97 Posted August 27, 2013 Share Posted August 27, 2013 Segun vi el script o mismo la linea 23, lo que esta haciendo es decir que si el modelo del vehiculo (valor integral) es igual a "480" (string) entonces.. vbla bla, no puedes comparar un valor integral con una string, deberias quitarle las comillas al 480 y se te privatizara al modelo 480 Link to comment
Recommended Posts