Jump to content

aka Blue

Members
  • Posts

    2,106
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by aka Blue

  1. Lo que te recomendaría personalmente es aprender el uso de tablas. Para optimizar tus scripts y demás. Aparte de eso, si es un sv que requiere muchos mapas, pásalos a .lua ya que los .map, al ser muchos pueden causar bastante lag en el servidor. En recursos y aportes, publiqué el script que uso para la carga de mapas y de momento, genial.
  2. If i'm not wrong, they are using the default phpbb theme, but edited.
  3. Yo uso los elementData para cosas pequeñas (valores numéricos más que nada), aunque si lo quieres optimizado, usa tablas, es bastante recomendable. Yo las uso de esta forma: local p = { } -- Cuando entra, por ejemplo p[ player ].sed = tonumber( sed ) p[ player ].hambre = tonumber( hambre ) -- Get valores function getSed( player ) if player then local sed = p[ player ].sed if sed then return sed end return false end return false end function getHambre( player ) if player then local hambre = p[ player ].hambre if hambre then return hambre end return false end return false end
  4. Deberías ordenar un poco los códigos.
  5. Creo que veo mejor la opción de @El_Zorro
  6. Lo más extraño es que tiene de gang Latinos :v
  7. Lo hice en dos por si decide eliminar la carga de progreso y dejar los dx.
  8. La función render que es la que sube el progreso, por lo visto no tiene ningún ejecutor, por lo tanto, i es igual a nil. Dame unos minutos y te posteo un ejemplo. local x, y = guiGetScreenSize( ) local progreso_barra = 0 function renderizar_progreso( ) progreso_barra = progreso_barra + 0.4 if i >= 300 then removeEventHandler( "onClientRender", root, renderizar_barras ) removeEventHandler( "onClientRender", root, renderizar_progreso ) end end addEventHandler( "onClientRender", root, renderizar_progreso ) function renderizar_barras( ) dxDrawRectangle((screenW - 23) / 2-131, (screenH - 10) / 2, 300, 25, tocolor(0, 0, 0, 130), true) dxDrawRectangle((screenW - 23) / 2-131, (screenH - 10) / 2, i, 25, tocolor(144, 3, 3, 255), true) end addEventHandler( "onClientRender", root, renderizar_barras ) La sombra del dx, dibújala siempre antes de la barra, para que quede atrás.
  9. Buenas, estuve intentando de mil y una formas hacer lo siguiente pero nada, no encuentro manera. A ver, lo que quiero hacer es que al escribir un mensaje en el chat, salga un texto encima del hueso de la cabeza del jugador, el problema es que, cuando yo lo pongo, se le pone a todos los jugadores en la cabeza y no solo a mi... Aquí dejo el código, es bastante sencillo la verdad, arreglé un pequeño ejemplo de la wiki: local fuente = dxCreateFont ( "Lato-Light.ttf", 12 ) local mensaje, tipo local localPlayer = getLocalPlayer( ) local disponible = true function eliminarMensaje( ) timer = setTimer( function ( ) mensaje = " " tipo = nil end, 1000, 1 ) end addCommandHandler( "toggletextos", function( ) if disponible == false then addEventHandler( "onClientRender", root, dibujar_names ) disponible = true else removeEventHandler( "onClientRender", root, dibujar_names ) disponible = false end end ) addEvent( "onChat", true ) addEventHandler( "onChat", getRootElement( ), function( message, type ) if message and type then eliminarMensaje( ) mensaje = message tipo = type end end ) function dibujar_names( ) local px, py, pz, tx, ty, tz local jugadores = getElementsByType( 'player' ) px, py, pz = getCameraMatrix( ) tx, ty, tz = getElementPosition( localPlayer ) for i=1, #jugadores do local v = jugadores[ i ] if getDistanceBetweenPoints3D( tx, ty, tz, getElementPosition( v ) ) <= 8 then if isLineOfSightClear( px, py, pz, tx, ty, tz, true, false, false, true, false, false, false,localPlayer ) then local sx, sy, sz = getPedBonePosition( v, 6 ) local x, y = getScreenFromWorldPosition( sx, sy, sz + 0.3 ) if x then -- getScreenFromWorldPosition returns false if the point isn't on screen dxDrawText( getPlayerName( v ):gsub("_"," "), x, y-7+2, x, y, tocolor(0, 0, 0), 1, fuente, "center", "center" ) dxDrawText( getPlayerName( v ):gsub("_"," "), x, y-7, x, y, tocolor(255, 255, 255), 1, fuente, "center", "center" ) if isChatBoxInputActive() and not isTimer( timer ) then dxDrawText( "Hablando o actuando...", x, y+43+2, x, y, tocolor(0, 0, 0), 0.7, fuente, "center", "center" ) dxDrawText( "Hablando o actuando... ", x, y+43, x, y, tocolor(255, 255, 255), 0.7, fuente, "center", "center" ) end if isConsoleActive() and not isTimer( timer ) then dxDrawText( "Consola abierta...", x, y+43+2, x, y, tocolor(0, 0, 0), 0.7, fuente, "center", "center" ) dxDrawText( "Consola abierta... ", x, y+43, x, y, tocolor(255, 255, 255), 0.7, fuente, "center", "center" ) end if tipo == 0 then dxDrawText( "> "..mensaje, x, y+43+2, x, y, tocolor(0, 0, 0), 0.7, fuente, "center", "center" ) dxDrawText( "> "..mensaje, x, y+43, x, y, tocolor(255, 255, 255), 0.7, fuente, "center", "center" ) elseif tipo == 1 then dxDrawText( "*"..getPlayerName(v):gsub("_"," ").." "..mensaje, x, y+43+2, x, y, tocolor(0, 0, 0), 0.7, fuente, "center", "center" ) dxDrawText( "*"..getPlayerName(v):gsub("_"," ").." "..mensaje, x, y+43, x, y, tocolor(255, 0, 0), 0.7, fuente, "center", "center" ) else dxDrawText( "", x, y+18, x, y, tocolor(255, 0, 0), 2, fuente, "center", "center" ) end end end end end end addEventHandler( "onClientRender", root, dibujar_names ) El triggeo: addEventHandler( "onPlayerChat", getRootElement(), function( message, type ) if type == 0 then triggerClientEvent( source, "onChat", source, message, 0 ) elseif type == 1 then triggerClientEvent( source, "onChat", source, message, 1 ) end end ) Como se aprecia, por ejemplo al yo escribir un mensaje, se trigea el evento al cliente y le crea un texto encima del hueso de la cabeza del jugador. El problema está en que se lo dibuja a todos . PD: Mi error puede ser una tontería pero es que no encuentro manera. Quizás sea por el loop, pero intenté de todo y nada.
  10. Oh damn, so nice. Keep it up
  11. A car doesn't have physically damage -.- You mean the health or the damage proof... function handleVehicleDamage(_, weapon, _, _, _, _, _) local health = getElementHealth( source ) if ( weapon == 0 ) then -- If the weapon == fist then setElementHealth( source, tonumber( health ) ) cancelEvent( ) end end addEventHandler("onClientVehicleDamage", root, handleVehicleDamage)
  12. No tengo ni p**a idea de lo que viene siendo la función remover, pero prueba a ver si te funciona la de poner: function comprar_skin( id ) local id = tonumber( id ) if id then local account = getPlayerAccount( source ) if account then if isGuestAccount( account ) then return else setElementModel( source, id ) setAccountData( account, "Sking", id ) outputChatBox( "Skin actualizado y guardado.", source, 255, 20, 20, true ) end end end end addEvent( "skins", true ) addEventHandler( "skins", getRootElement( ), comprar_skin ) function remover_skins( ) local account = getPlayerAccount( source ) if isGuestAccount( account ) then return else local skinG = getAccountData( account, "Sking" ) end end addEvent( "remover", true ) addEventHandler( "remover", getRootElement( ), remover_skins ) PD: Te recomiendo tabular un poco tu código porque se ve bastante feo teniendo todo junto o con 1 o 2 espacios. Se trata solo de tenerlo un poco más ordenado
  13. No te recomiendo usar elementData para estas cosas tan simples. Utiliza tablas o variables: local damage = { } addCommandHandler( "sd", function( ) local estado = damage[ localPlayer ] if estado == nil or estado == false then outputChatBox( "Ahora ya no puedes matar a nadie.", 255, 0, 0 ) estado[ localPlayer ] = true else outputChatBox( "Ahora puedes matar a todos los jugadores.", 0, 255, 0 ) estado[ localPlayer ] = false end end ) function cancelarDamage ( attacker, _, _ ) local estado_atacador = damage[ attacker ] if ( estado_atacador == true ) then cancelEvent( ) -- Si el atacador tiene el daño desactivado end end addEventHandler ( "onClientPlayerDamage", root, cancelarDamage )
  14. aka Blue

    [HELP] /time

    When cancelEvent() is in the first line nothing will work Mabako's Paradise method: -- overwrite MTA's default chat events addEventHandler( "onPlayerChat", getRootElement( ), function( message, type ) cancelEvent( ) if exports.players:isLoggedIn( source ) and not isPedDead( source ) then if type == 0 then localizedMessage( source, " " .. getPlayerName( source ) .. " dice: ", message, 230, 230, 230, false, 127, 127, 127 ) elseif type == 1 then me( source, message ) elseif type == 2 then faction( source, exports.factions:getPlayerFactions( source )[ 1 ], message ) end end end )
  15. Devuelve el jugador. He intentado con source y lo mismo, no funciona...
  16. Check this: function handleVehicleDamage(_, weapon, _, _, _, _, _) if ( weapon == 0 ) then -- If the weapon == fist then cancelEvent( ) end end addEventHandler("onClientVehicleDamage", root, handleVehicleDamage)
  17. Si, pero no va y no lo entiendo. Lo mismo me pasaba con otro script, que no le ponía las animaciones a unos peds. Me estoy hartando un poco de esta función ya, la verdad .
  18. debug o fake Hi es el comando, cuando lo dejo me sale en debug que el primer argumento es hi y cuando lo quito y pongo player, cmd en la función, me sale que el argumento es nil...
  19. Mmm no me va, no entiendo: addCommandHandler( "hi", function( player ) outputChatBox( "ola" ) setPedAnimation (player, "carry", "crry_prtial", 0, false, true, false, true) end ) PD: Me da que el primer argumento es nil o 'hi', no lo entiendo... esta función está bastante bugeada
  20. Puse ésto: setPedAnimation (player, "carry", "crry_prtial", -1, true, false, true, false) Pero, se pone la animación y no me deja moverme.
  21. Buenas, llevo varios días intentando hacer un job. Lo que quiero hacer es que se pegue una caja al jugador y el mismo la cargue en las manos (como en la misión de robar la casa con Ryder). ¿Cómo podría hacerlo? Gracias por leer
×
×
  • Create New...