-
Posts
1,102 -
Joined
Everything posted by Enargy,
-
for _, messages in ipairs (mensajes) do if messages:find(message) then print("hola") end end Que necesidad tiene usar print? Nunca supe para que funciona .
-
En lugar de usar un loop puedes usar getVehicleType. Es mas eficiente.
-
Puede ser en ambos; ya que cuando se inicia el resource sera visible para todos. Los dos eventos en sí son iguales.
-
Aunque la wiki tenga ejemplos donde te puedas guiar, yo te recomendaría que aprendas de lua.org ya que te explican que son tablas, para que se usan strings y entre otros; ya que si sabes lo básico de lua sabrás entender como están compuesto los ejemplos que te brinda la wiki.
-
Hace unos años intente algo así pero me dijeron que el slothbot usa animaciones para que el ped pueda caminar.
-
function getVehiclesInWater() local vehiclesInWater = {} for _, vehicle in ipairs(getElementsByType("vehicle")) do if isElementInWater(vehicle) then table.insert(vehiclesInWater, vehicle ) end end return vehiclesInWater end setTimer( function() for i, vehicle in pairs(getVehiclesInWater()) do if isElementInWater(vehicle) then -- Aquí tu codigo de respawn. end end end, 600*1000, 0) -- Cada 10 Minutos la funcion se inicia.
-
Pero si el GM es Paradise... ¿Porque lo vendes? si se supone que es publico.
-
Tomas se refiere a esto function isCursorOnElement(x,y,w,h) local mx,my = getCursorPosition () local fullx,fully = guiGetScreenSize() cursorx,cursory = mx*fullx,my*fully if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then return true else return false end end function movelogin ( _, _, xh, yh ) local x, y, w, h = xh, yh, --[[width]], --[[height]] if isCursorOnElement( xh, yh, w, h ) then tr,tg,tb,ta = 153, 9, 16, 243 else tr,tg,tb,ta = 0, 0, 0, 243 end end addEventHandler( "onClientCursorMove", getRootElement( ), movelogin)
-
Deberías de hacerlo que dentro del juego puedas compilar por una gui. PD: Si tiene eso pues bien, no me he fijado en el script.
-
Olvidaste cambiar los valores al usar copy & paste. setElementPosition ( playerSource, positions[randomPos].x, positions[randomPos].y, positions[randomPos].z )
-
De los nombres sacas el nombre de los archivos, genio.
-
fetchRemote( "https://luac.multitheftauto.com/?compile=1&debug=0&obfuscate=1", complieFileAPI, fileLoad(path)) Hace exactamente eso, obfuscate=1 Pues no me habia fijado , En sí me gusto su trabajo.
-
Buen trabajo! Aunque para mí sigue siendo mas confiable el compilador que trae el mta (luac.multitheftauto.com), ya que tiene la función Extra obfuscation que permite encriptar el archivo.
-
Creo que deberías saber que de las dos formas Es igual. Bad argument #1 to floor (number expected gol nil) Es el error que sale. vervida no te está dando ningún valor.
-
guiFade( element gui, string state )
-
exports["extra_health"]:getElementExtraHealth( v ) es igual a exports.extra_health:getElementExtraHealth( v ) Supongo que usaste setElementExtraHealth para asignare la vida a esos peds en alguna otra parte de tu código, Por que en sí el código lo veo bien.
-
local avaible_skin = { [280]=true, [281]=true, [282]=true, [283]=true, [284]=true } function blahblah(thePlayer,_,id) if ( avaible_skin[tonumber(id)] ) then setElementModel(thePlayer,id); return true; end return false; end addCommandHandler("duty",blahblah)
-
getRootElement and root are the same.
-
Si te explicaras mejor...
-
El error esta en el interpolate, el calculo que haces esta malo.
-
Prueba function xdDrawAnimWindow(text,alto,ancho,color,font,anim) btAncho = ancho btAlto = alto/20 local now = getTickCount() local elapsedTime = now - start local endTime = start + 1500 local duration = endTime - start local progress = elapsedTime / duration local x1, y1, z1 = interpolateBetween ( 0, 0, 0, ancho, alto, 255, progress, anim) local x2, y2, z2 = interpolateBetween ( 0, 0, 0, btAncho, btAlto, btAlto/11, progress, anim) dxDrawRectangle ( x1, y2 * 15, x1 - 50, y2 * 15 / 8, color ) dxDrawRectangle ( x1, y2 * 15, x1 - 50, y1, tocolor ( 0, 0, 0, 200 ) ) dxDrawText ( text, x1 * 3 - 50, y2 * 15 * 2 + 30, 0, 0, tocolor ( 255, 255, 255, 255 ), z2, font,"center","center") end
-
Postea lo que hiciste.
-
Nose si ya esta solucionado esto pero da igual, Edité el código de Tomas. --[[ function myPed( thePlayer ) local x, y, z = getElementPosition( thePlayer ); y = y - 5 ped = createPed( 0, x, y, z ) if ped then follow( ped, thePlayer ) end end addCommandHandler( "myped", myPed ) ]] function follow(element, player) if (not isElement(element) or not isElement(player)) then return end if (isPedInVehicle(element)) then return end local cX, cY = getElementPosition(player) local pX, pY = getElementPosition(element) local copangle = (360 - math.deg(math.atan2((cX - pX), (cY - pY)))) % 360 setPedRotation(element, copangle) setElementInterior(element, getElementInterior(player)) setElementDimension(element, getElementDimension(player)) local dist = getDistanceBetweenPoints2D(cX, cY, pX, pY) if (dist > 16) then -- Warp local x, y, z = getElementPosition(player) setElementPosition(element, x, y, z) setTimer(follow, 200, 1, element, player) elseif (dist > 6) then -- Sprint setPedAnimation( element, "PED", "sprint_civi" ) setTimer(follow, 200, 1, element, player) elseif (dist > 4) then -- Jog setPedAnimation( element, "PED", "JOG_maleA" ) setTimer(follow, 200, 1, element, player) elseif (dist > 1.5) then -- Walk setPedAnimation( element, "PED", "WALK_civi" ) setTimer(follow, 200, 1, element, player) elseif (dist <= 2) then -- Stop setPedAnimation( element, "PED", "IDLE_stance" ) setTimer(follow, 200, 1, element, player) end end
-
En teoría no trabaja así mi código, solo cancelo el evento, el triggeo se hace por comando. addEventHandler( "onPlayerChat", root, function() cancelEvent() end ) function playerChat( player, type, ... ) local messageType = type local message = table.concat({...}, " ") if isCommand( player, message ) then -- Si el texto es conocido como un comando existente. return end triggerEvent( "onPlayerSendMessage", root, player, messageType, message ) end cmd = { {"Global"}, {"Clan"}, {"Local"}, } for i = 1, #cmd do addCommandHandler( cmd[i][1], playerChat ) end Anyway, de todas formas gracias.
-
En lugar de hacer toda la aritmética en cada argumento, reescribe la función. local _dxDrawRectangle = dxDrawRectangle local _dxDrawText = dxDrawText function dxDrawRectangle( x, y, w, h, color, postGUI, relative ) if ( relative ) then sx, sy = guiGetScreenSize() pX, pY = ( sx/ 1024 ), ( sy / 768 ) x, y, w, h = pX*x, pY*y, pX*w, pY*h end _dxDrawRectangle( x, y, w, h, color, postGUI ); end function dxDrawText( txt, x, y, w, h, color, size, font, align, bottom, clip, wordwrap, colorCode, postGUI, relative ) if ( relative ) then sx, sy = guiGetScreenSize() pX, pY = ( sx / 1024 ), ( sy / 768 ) x, y, w, h = pX*x, pY*y, pX*w, pY*h end _dxDrawText( txt, x, y, w, h, color, size, font, align, bottom, clip, wordwrap, colorCode, postGUI); end Sintaxis: bool dxDrawText ( string text, float left, float top [, float right=left, float bottom=top, int color=white, float scale=1, mixed font="default", string alignX="left", string alignY="top", bool clip=false, bool wordBreak=false, bool postGUI=false, bool colorCoded=false, bool subPixelPositioning=false, float fRotation=0, float fRotationCenterX=0, float fRotationCenterY=0 ], bool relative=false ) bool dxDrawRectangle ( float startX, float startY, float width, float height [, int color = white, bool postGUI = false, bool subPixelPositioning = false ], bool relative=false ) Al usar el código no hace falta hacer ningún calculo. local _dxDrawRectangle = dxDrawRectangle local _dxDrawText = dxDrawText function dxDrawRectangle( x, y, w, h, color, postGUI, relative ) if ( relative ) then sx, sy = guiGetScreenSize() pX, pY = ( sx/ 1024 ), ( sy / 768 ) x, y, w, h = pX*x, pY*y, pX*w, pY*h end _dxDrawRectangle( x, y, w, h, color, postGUI ); end function dxDrawText( txt, x, y, w, h, color, size, font, align, bottom, clip, wordwrap, colorCode, postGUI, relative ) if ( relative ) then sx, sy = guiGetScreenSize() pX, pY = ( sx / 1024 ), ( sy / 768 ) x, y, w, h = pX*x, pY*y, pX*w, pY*h end _dxDrawText( txt, x, y, w, h, color, size, font, align, bottom, clip, wordwrap, colorCode, postGUI); end function window () scX, scY = guiGetScreenSize() local screenX = 1366 local screenY = 768 local sx = scX/screenX local sy = scY/screenY xdDrawAnimWindow("Panel de armas", 345*sx, 364*sy, tocolor(51, 51, 51, 200),"default-bold","OutBack") end function dxgui() dxDrawRectangle(841, 194, 24, 24, tocolor(255, 0, 0, alphaQuit), false, true) dxDrawText("X", 841, 194, 865, 221, tocolor(255, 255, 255, 255), 2.00, "default-bold", "center", "center", false, false, false, false, true) dxDrawRectangle(531, 242, 126, 20, tocolor(255, 255, 255, alphaKnife), false, true) --KNIFE dxDrawText("Knife LVL:1", 534, 242, 653, 261, tocolor(0, 0, 0, 255), 1, "default-bold", "center", "center", false, false, false, false, true) end EDIT: quit = guiCreateButton(0.615*ancho, 0.256*alto, 0.017*ancho, 0.031*alto, "", false) Si cambias false por true, no hace falta hacer la aritmética en sí.