-
Posts
1,102 -
Joined
Everything posted by Enargy,
-
De nada @CiBeR, el primer argumento es el elemento que ejecuta el triggeo, luego nombre del evento y luego el/los elementos que definiran el source del evento, y lo demas argumentos adicionales.
-
local veh function openTrunk (theVehicle) trunkState = getVehicleDoorOpenRatio(theVehicle, 1) if (trunkState == 0) then setVehicleDoorOpenRatio(theVehicle, 1, 1, 1000) else setVehicleDoorOpenRatio(theVehicle, 1, 0, 1000) end end function start() if veh == nil then openTrunk(veh) end end function bindTrunk (hitElement, linkedVehicle) if (getElementType (hitElement) == "player") then if (isElement (linkedVehicle)) then toggleControl (hitElement, "enter_exit", false) if veh == nil then veh = linkedVehicle end bindKey (hitElement, "f", "down", start) end end end addEvent("bindTrunk", true) addEventHandler("bindTrunk", getRootElement(), bindTrunk) function unbindTrunk (hitElement) if (getElementType(hitElement) == "player") then toggleControl(hitElement, "enter_exit", true) if veh ~= nil then unbindKey(hitElement, "f", "down", start) veh = nil end end end addEvent("unbindTrunk", true) addEventHandler("unbindTrunk", getRootElement(), bindTrunk) setTimer (function () for index, vehicle in pairs (getElementsByType ("vehicle" )) do if not (getElementData (vehicle, "markerTrue")) then setElementData(vehicle, "markerTrue", true) triggerClientEvent(getRootElement(), "carTrunkSync", getRootElement(), vehicle) end end end, 6000, 0) ??
-
Yo lo hago de esta forma: local sx, sy = guiGetScreenSize() local rx, ry = 1024, 768 local px, py = (sx / rx), (sy / ry) dxDrawRectangle(px*500, py*500, px*500, py*500, tocolor(80, 160, 174, 255), false) dxDrawText("Hello", px*500, py*500, px*200, py*200, tocolor(0, 0, 0, 255), 1, "bankgothic", "left", "top", false, false, false, false, false) -- Para ser mas eficiente puedes reescribir las funciones directX para organizar de un solo calculo la compatibilidad para todas las resoluciones y luego las agregas en cualquier función que las necesite con valores absolutos sacados con el guieditor, sin necesidad de volver a calcular algo.
-
triggerClientEvent ( player, "onEncenderRadio", root, vehicle, link ) triggerClientEvent ( player, "onApagarRadio", root, vehicle ) EDIT: Para que otros jugadores no detengan el sonido de todos al cambiar la música. local sonido = {} function radioOn ( vehicle, link ) local x, y, z = getElementPosition(vehicle) local interior, dimension = getElementInterior ( vehicle ), getElementDimension ( vehicle ) if vehicle and link then if not sonido[vehicle] then sonido[vehicle] = playSound3D("https://www.youtubeinmp3.com/fetch/?video="..link, x, y, z, false) setElementDimension ( sonido[vehicle], dimension ) setElementInterior ( sonido[vehicle], interior ) setSoundMaxDistance ( sonido[vehicle], 4000 ) attachElements ( sonido[vehicle], vehicle ) else stopSound ( sonido[vehicle] ) sonido[vehicle] = playSound3D("https://www.youtubeinmp3.com/fetch/?video="..link, x, y, z, false) setElementDimension ( sonido[vehicle], dimension ) setElementInterior ( sonido[vehicle], interior ) setSoundMaxDistance ( sonido[vehicle], 4000 ) attachElements ( sonido[vehicle], vehicle ) end end end addEvent ( "onEncenderRadio", true ) addEventHandler ( "onEncenderRadio", getRootElement ( ), radioOn ) function apagarRadio ( vehicle ) if vehicle then if sonido[vehicle] then stopSound ( sonido[vehicle] ) sonido[vehicle] = nil end end end addEvent ( "onApagarRadio", true ) addEventHandler ( "onApagarRadio", getRootElement ( ), apagarRadio )
-
¿Por qué continúan un topic de hace mas de 1 año?
-
Are you looking for this dxDrawTextOnElement?
-
En cliente es mucho mas eficiente colocarlo: function comando() local vehicles = getElementsByType("vehicle") for k,v in ipairs(vehicles) do if not isPedInVehicle(localPlayer) then outputChatBox("Debes Subir a un Auto", 255, 0, 0) break end if getVehicleOccupant(v) ~= localPlayer then setElementCollisionsEnabled(v, not getElementCollisionsEnabled(v)) else setElementCollisionsEnabled(v, true) end end end addCommandHandler("tt", comando)
-
SetVehiclePlateText
-
Pero en lugar de thePlayer sería source por como el dijo que no le crea el auto, el error estaria en el getPlayerMoney.
-
Do it then, and didn't say but that's initial price, the price may be discussed. NO ONE is going to offer any prices.
-
Algo de Trigonometría, Seno y coseno.
-
Agrega esto en la función SPAWNCAR local r, c = guiGridListGetSelectedItem(gridlist) if (r ~= -1 and c ~= -1) then -- Lo que quieres hacer. end
-
triggerServerEvent createVehicle addEvent
-
Deberían creados. Si entras a tu servidor y no aparecen los objetos entonces al entrar un player al servidor llama la función donde se crean los objetos usando onPlayerJoin. Si eso no va al caso pues debe de haber algo en la función de inicio que no te deje crearlos. SI está en server-side no es necesario hacer eso porque se re-crearían para todos los jugadores. A mi me pasaba cuando bindeaba algo en server-side que el resource al iniciar no funcionaba pero cuando bindeaba la tecla al entrar si lo hacía. PD: De nada blue.
-
Deberían creados. Si entras a tu servidor y no aparecen los objetos entonces al entrar un player al servidor llama la función donde se crean los objetos usando onPlayerJoin. Si eso no va al caso pues debe de haber algo en la función de inicio que no te deje crearlos.
-
Death list = lista de muertes. PD: AlvareZ tanto tiempo .
-
Postea el código.
-
cinturon = { } addCommandHandler ( "guardar", function ( player, commandName, slot ) local slot = tonumber ( slot ) if slot then local arma = getPedWeapon ( player ) if arma == 0 then outputChatBox ( "Debes tener un arma en la mano para poder guardarla.", player, 255, 0, 0 ) return end if not cinturon [ player ] then cinturon[player] = {} end if not cinturon [ player ][slot] then local ammo = getPedTotalAmmo ( player ) cinturon [ player ][ slot ] = { arma = arma, ammo = ammo } takeWeapon ( player, arma ) exports.chat:me(player, "guarda un "..getWeaponNameFromID ( arma ).." en su cinturón.") else local arma = cinturon [ player ][ slot ].arma local municion = cinturon [ player ][ slot ].ammo outputChatBox ( "En ese slot llevas el arma "..getWeaponNameFromID ( arma ) .." con "..municion.." de municion.", player, 255, 255, 0 ) return end else outputChatBox ( "El cinturón sólo tiene 3 slots. Usa /"..commandName.." [slot (1,2 o 3)]", player, 255, 255, 255 ) return end end ) Te lo organicé un poco mejor y funciona perfectamente ahora. cinturon [ player ] = { } cinturon [ player ][ slot ] = { arma = arma, ammo = ammo } El problema era que estabas suscribiendo la tabla.
-
Ya había solucionado este problema hace días, de todos modos les dejo el código que me funciono y lo dejaré por si alguien lo necesite. function isMouseInPosition(x, y, w, h) if isCursorShowing( ) then local cx, cy = getCursorPosition( ) local sx, sy = guiGetScreenSize() cx, cy = cx*sx, cy*sy return cx >= x and cx <= x+w and cy >= y and cy <= y+h end return false end function isPositionInCircle(x, y, r, cx, cy) -- creditos a del subforo ingles. local i = 0 for k=(-r), r do local q = math.sqrt((r/2)*(r/2)-k*k) if isMouseInPosition(x-q+(r/2), y+k+(r/2), 2*q, 1) then i = i+1 end end return i ~= (-r)+r end
-
Intenta usar engineSetModelLODDistance
-
No entiendo, sigue dándome la misma cantidad.
-
Quieres hacer que al insertar un dato en la tabla, chequee si ya hay un dato con el mismo valor?
