Jump to content

aka Blue

Members
  • Posts

    2,106
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by aka Blue

  1. ¿You are going to share the code? Nice job.
  2. En estos tutoriales aprenderemos a crear nuestro panel de logueo usando CEF para ejecutar nuestra página web en Multi Theft Auto. Utilizaremos: HTML: Creación principal del panel. CSS: Modelado del panel, animaciones, etc. Lua: Usar las funciones de Lua para el registro/logueo dentro del servidor. (Funcionará con las cuentas de MTA, próximamente con SQLite)
  3. I think it would be nice to remove the border around the inserted images and remove the current absence of esthetic. I mean this border: http://imgur.com/a/A829T
  4. aka Blue

    Solucion?

    El . se lo añades tú mismo por lo que veo, es decir, no se coloca sólo. Lo que podrías hacer es pasar los 2 valores directamente a server-side y ahí ponerles el . Ah, y me fijé en algo: Es 'serverEvent' xd.
  5. aka Blue

    Solucion?

    Usa math.floor( number ) para aproximar el número a 2
  6. aka Blue

    Aprender lua

    Creo que con OOP sí se usa ; al final. Creo, no lo sé bien, porque nunca usé OOP.
  7. aka Blue

    Aprender lua

    Te advierto que javascript/html/css son bastante diferentes a Lua. Sí, tienen cosas parecidas, pero no funciona igual (como por ejemplo las variables var, eso no existe en Lua, que yo sepa), pero sí, si tienes una mínima idea de programación (variables, condicionales, creación de funciones, eventos) pues bien. Suerte
  8. aka Blue

    Aprender lua

    @Simple01 te pasó el manual y el libro oficial del lenguaje Lua, así que, que yo sepa, no he visto otros en 'Español' o más 'detallados' e 'interesantes'.
  9. aka Blue

    Aprender lua

    Ah y en ésta página también tengo algo aunque anda bastante inactiva: http://www.tutorialesmta.esy.es/index.php
  10. aka Blue

    Aprender lua

    Cuando tengas un poco de idea o deseas pasarte, subo tutoriales a youtube cada cierto tiempo: https://www.youtube.com/channel/UCRO1Jt1jxYbbd17ZC2hMt2Q
  11. Try this: function klakson () if (isKeyBound (source,"capslock")) or (isKeyBound (source,"h")) then setControlState (source, "horn", true ) outputChatBox ("on",getRootElement(),255,0,0,true) -- only information else toggleControl ( "horn", false ) outputChatBox (source,"off",getRootElement(),255,0,0,true) -- only information end end addEventHandler ("onPlayerJoin",getRootElement(),klakson)
  12. Deberías explicar un poco mejor lo que quieres hacer y compartir un poco más de código, que, sinceramente, no creo que alguien te quiera robar. local data = { } function saveDatas() local account = getPlayerAccount(source) if (account) then local setText = data[ player ] setAccountData(account, "finalizada", setText ) end end addEventHandler("onPlayerQuit", root, saveDatas) addEventHandler("onPlayerLogout", root, saveDatas) function loadDatas() local account = getPlayerAccount(source) if (isGuestAccount(account) == false) then local count = getAccountData(account,"finalizada") if count then data[ player ] = { } data[ player ] = count else data[ player ] = { } data[ player ] = "Error" end end end addEventHandler("onPlayerLogin", root, loadDatas)
  13. ¡Genial! Muy buen trabajo, me ha gustado, ahora me pasaré PD: ¿Tenéis hora de apertura?
  14. Para hacer eso lo mejor que creo que podrías hacer es hacerlo client-side con la función getCameraMatrix y pasar los valores que te devuelve a server-side creando el objeto. PD: Pone shared, pero como pone en la wiki, la función server-side devuelve el último setCameraMatrix establecido en el servidor.
  15. ¿Rituales satánicos? ¿Hola? . Buena suerte, se ve interesante.
  16. @Mauro.e x, y, z lo pones como variable global, eso está mal. Y aparte, estás moviendo al jugador... (? function doMove( player ) local x, y, z = getElementPosition(player) setElementPosition( objeto, tonumber(x)+1, tonumber(y), tonumber(z) ) end local players = getElementsByType( 'player' ) for i=1, #players do bindKey( players[i], "w", "down", doMove ) end
  17. Para ir a un robo obviamente necesitarían usar un comando/evento, etc. Mete a cada jugador a una tabla y checkea si esta tiene 4 jugadores. En caso de que el último sea el 5, que inicie el robo, que supongo que tendrás alguna función. Aquí te dejo un código: local tabla_robos = { } addCommandHandler( "robar_tienda", function( player ) local robos_local = tabla_robos[ tienda ] if tabla_robos[ tienda ] == nil then tabla_robos[ tienda ] = 0 end if robos_local > 5 then tabla_robos[ tienda ] = robos_local + 1 else outputChatBox( "Ésta tienda ya ha sido robada 5 veces.", player, 255, 0, 0 ) end end ) PD: El código que te he pasado, cada vez que se roba una tienda se le suma 1. No sé como tienes el sistema de tiendas así que bueno, te lo paso para que te hagas una idea.
  18. aka Blue

    Ayuda

    No, no es necesario. Eso es cliente, ya que engineSetModelLODDistance es una función client-side y te ahorras el trigger de servidor-cliente con ese archivo.
  19. aka Blue

    Ayuda

    Crea un archivo cliente e introduce ésto dentro: addEventHandler ( "onClientResourceStart", root, function ( ) local objects = getElementsByType( 'object' ) for i=1, #objects do local v = objects[ i ] local model = getElementModel( v ) engineSetModelLODDistance ( v, 220 ) setFarClipDistance( 4000 ) setOcclusionsEnabled ( false ) end end )
  20. aka Blue

    Ayuda

    ¿Usas mapa en .lua o .map?
  21. Estás en la sección equivocada. Publica aquí para que te atiendan en Español. This is English section, post here to get supported by the Spanish section. Anyway, you can use this/Puedes usar esto, usa la variable de arriba para asignarle nombre a tu comando: superjumping = 0 comando = "aqui_tu_comando" function rocketjump() startrocketjumpingthing = nil if getControlState("jump") == true then local task = getPedSimplestTask(getLocalPlayer()) if task == "TASK_SIMPLE_IN_AIR" and superjumping == 0 then if isTimer(startgroundchecktimer) then resetTimer ( startgroundchecktimer) else startgroundchecktimer = setTimer ( startjumpgroundcheck, 300, 1) end superjumpgroundcheck = 0 addEventHandler("onClientRender",getRootElement(), rocketplayer ) addEventHandler("onClientRender",getRootElement(), jumpgroundcheck ) triggerServerEvent ("onSpeedChange", getLocalPlayer(), "jumping") jumpstart = getTickCount() superjumping = 1 end end end function triggersuperjump(key, keyState) if getElementData( getLocalPlayer(), "transport_power" ) == "superjump" then if keyState == "down" then local px,py,pz = getElementPosition( getLocalPlayer () ) local isclear = isLineOfSightClear ( px, py, pz,px, py, pz-3,true,true, true, true,true,true, false, getLocalPlayer() ) if isTimer(startrocketjumpingthing) == false and isclear == false then startrocketjumpingthing = setTimer ( rocketjump, 650, 1) end elseif keyState == "up" then removeEventHandler("onClientRender",getRootElement(), rocketplayer ) end end end addCommandHandler( comando, triggersuperjump ) function rocketplayer() local px,py,pz = getElementPosition( getLocalPlayer () ) local currenttask = getPedSimplestTask(getLocalPlayer()) if getTickCount() - jumpstart < 4500 and currenttask ~= "TASK_SIMPLE_NAMED_ANIM" then if getTickCount() - jumpstart > 3000 then theZ = 0 elseif getTickCount() - jumpstart > 2000 then theZ = .1 else theZ = .3 end local playerangle = getPedRotation(getLocalPlayer()) local newradRot = math.rad ( playerangle ) local radius = 3 local ex = px + radius * math.sin(newradRot) local ey = py + -(radius) * math.cos(newradRot) local ez = pz x,y,z = px-ex,py-ey,pz-ez local dist = math.sqrt(x*x+y*y+z*z) x = x*.4/dist y = y*.4/dist setElementVelocity(getLocalPlayer(),x, y, theZ) else removeEventHandler("onClientRender",getRootElement(), rocketplayer ) end end function jumpgroundcheck() if superjumpgroundcheck == 1 then local px,py,pz = getElementPosition( getLocalPlayer () ) local isclear = isLineOfSightClear ( px, py, pz,px, py, pz-2.5,true,true, true, true,true,true, false, getLocalPlayer() ) local currenttask = getPedSimplestTask(getLocalPlayer()) if isclear == false or currenttask == "TASK_SIMPLE_LAND" or isElementInWater(getLocalPlayer()) == true then removeEventHandler("onClientRender",getRootElement(), jumpgroundcheck ) setElementPosition(getLocalPlayer(),px,py,pz ) removeEventHandler("onClientRender",getRootElement(), rocketplayer ) superjumping = 0 triggerServerEvent ("onJumpChange", getLocalPlayer(), "normal") end end end function startjumpgroundcheck() superjumpgroundcheck = 1 startgroundchecktimer = nil triggerServerEvent ("onJumpChange", getLocalPlayer(), "jumping") end Recuerda: El nombre del comando no es /nombre, simplemente el nombre, por ejemplo: comando = "saltar"
  22. Añade una condicional en la función donde añade los teams al scoreboard con lo siguiente: if #getPlayersInTeam( team ) > 0 then -- Si la cantidad de jugadores en el team indicado es mayor a 0 -- Se añade al scoreboard else return -- No se hace nada end
  23. Me leí correctamente el uso de cada función de db y ya lo entendí mucho mejor y fixeé el sistema con un pequeño check, éste: local exists = dbQuery ( sql , "SELECT * FROM accounts WHERE account = ?", username ) local result = dbPoll( exists, -1 ) if result and #result > 0 then outputChatBox( "Account exists" ) else outputChatBox( "Account does not exists, adding to database..." ) end Lo comparto por si alguien llega a tener un error parecido. Básicamente el poll lo que hace es esperar una respuesta de la base de datos, obtenida, realizamos una condicional, la cual comprueba si existe el valor en la tabla. En caso de que esté en 'blank' o 'nil', la registra. Gracias @Bc#, de todos modos.
  24. No, no, no uso ese sistema. Esa nota sale en la wiki, sobre executeSQLQuery.
×
×
  • Create New...