Jump to content

Alexs

Members
  • Posts

    2,869
  • Joined

  • Last visited

Everything posted by Alexs

  1. Alexs

    fileWrite limit?

    Some average amount to take into consideration?
  2. Is there any size limit for fileWrite? How many characters can I write? How long can be the string that will be written?
  3. Buenos días, Como habrán notado, he vuelto a MTA este lunes y abrí nuevamente mi servidor para, de una vez por todas, aplicar todos esos planes que tengo para él. Así fue que lo primero que hice fue crear un panel de login para reemplazar al que utilizaba desde hace dos años. He aquí los resultados: * El vídeo no fue grabado ni editado por mi, sino por un compañero de Myval Works.
  4. No lo había notado, tienen razón. Gracias.
  5. Buenas tardes a todos, Estaba editando el spawn de @50p (creo que era de él), pero me ha ocurrido algo realmente extraño. Montones de veces he realizado la misma edición, esto es, hacer que el menú aparezca en cuanto el jugador se loggee, pero esta vez el evento se gatilla hacia el cliente, sólo que el cliente, por algún motivo que no llego a comprender, no reacciona de ninguna manera. Servidor (ver linea 117): g_root = getRootElement( ); classGroups = { }; addEvent( "spawn_clientRequestSpawn", true ); addEventHandler( "spawn_clientRequestSpawn", g_root, function( categoryIndex, classIndex, skinIndex ) if skinIndex then local class = classGroups[ categoryIndex ].classes[ classIndex ]; local skin = class.skinMngr.skins[ skinIndex ]; local spawn = true; local spawned; --[[if not classGroups[ cetegoryIndex ].owner then -- if there is NO owner of the clan/gang spawn player spawn = true; else -- if there IS owner of the clan/gang then check if he's member of the clan/gang end]] if spawn then if not class.team then class.team = createTeam( class.name, class.color.red, class.color.green, class.color.blue ); end local plrTeam = getPlayerTeam( client ); if ( ( plrTeam ) and ( plrTeam ~= class.team ) and ( countPlayersInTeam( plrTeam ) == 300 ) ) then destroyElement( plrTeam ); end spawned = spawnPlayer( client, skin.spawnLoc.x, skin.spawnLoc.y, skin.spawnLoc.z, skin.spawnLoc.rot, skin.modelId, 0, 0, class.team ); end if spawned then setElementData( client, "team", class.name ) fadeCamera( client, true ); setCameraTarget( client, client ); setTimer( setCameraTarget, 200, 1, client, client ); triggerClientEvent( client, "spawn_SpawnedSuccessfully", client ); --setPlayerMoney( client, 500 ); for _, weapon in ipairs( class.weaponMngr.weapons ) do giveWeapon( client, weapon.id, weapon.ammo, false ); end createBlipAttachedTo( client, 0, 2, class.color.red, class.color.green, class.color.blue ) else triggerClientEvent( client, "spawn_FailedToSpawn", client ); if countPlayersInTeam( class.team ) == 0 then destroyElement( class.team ); class.team = nil; end end end end ); addEventHandler( "onPlayerSpawn", g_root, function ( ) end ); addEventHandler( "onPlayerWasted", g_root, function( ) fadeCamera( source, false, 4 ); setTimer( requestMenu, 5000, 1, source ); deleteAllPlayerBlips( source ) end ); function requestMenu( player ) callClientFunc( player, "showSpawnMenu", true, true ); callClientFunc( player, "classSelected" ); end addCommandHandler( "kill", function( plr ) killPed( plr ); end ) function preloadClassesInfo( ) local groups = getElementsByType( "category" ); for _, group in ipairs( groups ) do table.insert( classGroups, Group:New( group ) ); end end addEventHandler( "onResourceStart", getResourceRootElement(), preloadClassesInfo ) function deleteAllPlayerBlips(player) local elements = getAttachedElements(player) if (elements) then for i, element in ipairs(elements) do if (getElementType(element) == "blip") then destroyElement(element) end end end print( "number of players in team: " .. tostring( countPlayersInTeam( getPlayerTeam( player ) ) ) ); end addEventHandler( "onPlayerQuit", g_root, function() deleteAllPlayerBlips(source) end ); --ESTO LO AÑADI YO addEventHandler( 'onPlayerLogin', root, function( ) triggerClientEvent( source, 'enableSpawn', source ) end ) ------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------ function callClientFunc( player, funcName, ... ) if #{ ... } ~= 0 then triggerClientEvent( player, "_clientCallFunction", root, funcName, ... ) else triggerClientEvent( player, "_clientCallFunction", root, funcName ) end end addEvent( "_serverCallFunction", true ) addEventHandler( "_serverCallFunction", root, function( funcName, ... ) _G[ funcName ](...) end ) Cliente (ver linea 130): g_Me = getLocalPlayer( ); g_root = getRootElement( ); g_ResRoot = getResourceRootElement( ); screenSize = { guiGetScreenSize( ) }; --local stripHeight = .15 * (screenSize[ 2 ]*2); letterBox = { stripHeight = screenSize[ 2 ] * .15, stripAlpha = .93, -- 0-1 animLength = 01, -- seconds animStartTick = 0, animFinishTick = 0, keepAnimating = true, flyIn = function ( ) letterBox.animStartTick = 0; addEventHandler( "onClientRender", g_root, animateLetterBox_flyIn ); setTempPedRotating( true ); end, flyOut = function ( ) letterBox.animStartTick = 0; setTempPedRotating( false ); removeEventHandler( "onClientRender", g_root, animateLetterBox_flyIn ) addEventHandler( "onClientRender", g_root, animateLetterBox_flyOut ); end, } local pedRot = 0; allHUDElements = { "area_name", "radar", "vehicle_name", } iconWidths = { [0] = 21, [1] = 15, [2] = 97, [3] = 55, [4] = 83, [5] = 72, [6] = 55, [7] = 138, [8] = 104, [9] = 59, [10] =40 , [11] =31 , [12] =41 , [14] =10 , [15] =71 , [16] =13 , [17] =10 , [18] =4 , [19] =17, [22] =35 , [23] =50 , [24] =37 , [25] =75 , [26] =67 , [27] =66 , [28] =17 , [29] =35 , [30] =70 , [31] =71 , [32] =22 , [33] =75 , [34] =86 , [35] =74 , [36] =75 , [37] =19 , [38] =54 , [39] =8, [42] = 14, } icons = { [0] = ":killmessages/icons/fist.png", [1] = ":killmessages/icons/brassknuckle.png", [2] = ":killmessages/icons/golfclub.png", [3] = ":killmessages/icons/nitestick.png", [4] = ":killmessages/icons/knifecur.png", [5] = ":killmessages/icons/bat.png", [6] = ":killmessages/icons/shovel.png", [7] = ":killmessages/icons/poolcue.png", [8] = ":killmessages/icons/katana.png", [9] = ":killmessages/icons/chnsaw.png", [10] = ":killmessages/icons/gun_dildo1.png", [11] = ":killmessages/icons/gun_dildo2.png", [12] = ":killmessages/icons/gun_vibe1.png", [14] = ":killmessages/icons/flowera.png", [15] = ":killmessages/icons/gun_cane.png", [16] = ":killmessages/icons/grenade.png", [17] = ":killmessages/icons/teargas.png", [18] = ":killmessages/icons/molotov.png", [19] = ":killmessages/icons/explosion.png", [22] = ":killmessages/icons/colt45.png", [23] = ":killmessages/icons/Silenced.png", [24] = ":killmessages/icons/desert_eagle.png", [25] = ":killmessages/icons/chromegun.png", [26] = ":killmessages/icons/sawnoff.png", [27] = ":killmessages/icons/shotgspa.png", [28] = ":killmessages/icons/micro_uzi.png", [29] = ":killmessages/icons/mp5lng.png", [30] = ":killmessages/icons/ak47.png", [31] = ":killmessages/icons/m4.png", [32] = ":killmessages/icons/tec9.png", [33] = ":killmessages/icons/cuntgun.png", [34] = ":killmessages/icons/sniper.png", [35] = ":killmessages/icons/rocketla.png", [36] = ":killmessages/icons/heatseek.png", [37] = ":killmessages/icons/flame.png", [38] = ":killmessages/icons/minigun.png", [39] = ":killmessages/icons/satchel.png", [42] = ":killmessages/icons/fireextinguisher.png", }; classGroups = { }; classesInfo = { }; classesWeapons = { }; classesSkins = { }; --ESTO ERA EXACTAMENTE IGUAL, SOLO QUE UTILIZANDO 'onClientResourceStart' addEvent( 'enableSpawn', true ); addEventHandler( 'enableSpawn', getResourceRootElement(), function ( ) fadeCamera( true ); setTimer( setCameraMatrix, 50, 1, 1967.71, 1342.9, 26.63, 2034.47, 1343.02, 20.01 ); --letterBox.flyIn( ); preloadClassesInfo( ); createClassSelectionWnd( ); createGroupSelectionWnd( ); createClassDescriptionWnd( ); createClassWeaponWnd( ); --setTimer( createTempPed, 100, 1 ); showCursor( true ); showSpawnMenu( false, true ); --showHUDComponents( allHUDElements ); end ); function createTempPed( model ) -- 7474 - object id -- 8661 local x, y, z = getWorldFromScreenPosition( screenSize[ 1 ] - gridList:Size(false) / 2 - 70, ( screenSize[ 2 ]/2) --[[/ 1.6 ) * .8]], 10 ); local cX, cY, cZ = getCameraMatrix( ); x, y, z = getWorldFromScreenPosition( screenSize[ 1 ] - gridList:Size(false) / 2 - 70, ( screenSize[ 2 ]/2 )--[[ / 1.6 ) * .8]], 10 ) g_ground = createObject( 7474, x, y, z - 1.02, 0, 0, 90 ); tempPed = createPed( 0 and model or 0, x, y, z ); setPedRotation( tempPed, pedRot ); setElementFrozen( tempPed, true ); setPedAnimation( tempPed, "dancing", "dnce_m_b", -1, true, true, false ) --setPedAnimation( tempPed, "cop_ambient", "Coplook_nod", -1, true, true, false ) --setPedRotation( tempPed, 90 ); setElementAlpha( g_ground, 0 ); setTempPedRotating( true ); end function destroyTempPed( ) if tempPed then destroyElement( g_ground ); destroyElement( tempPed ); g_ground = nil; tempPed = nil; end end function setTempPedRotating( rotate ) if ( ( rotate ) and ( not pedRotating ) ) then addEventHandler( "onClientRender", g_root, rotatePed ); pedRotating = true; elseif ( not rotate ) then removeEventHandler( "onClientRender", g_root, rotatePed ); pedRotating = nil; end end function rotatePed( ) if tempPed then pedRot = pedRot + 1; setPedRotation( tempPed, pedRot ); end end function preloadClassesInfo( ) local groups = getElementsByType( "category" ); for _, group in ipairs( groups ) do table.insert( classGroups, Group:New( group ) ); end end function hideHUDComponents( components ) for i, comp in pairs( components ) do showPlayerHudComponent( comp, false ); end --showChat( false ); end function showHUDComponents( components ) for i, comp in pairs( components ) do showPlayerHudComponent( comp, true ); end --showChat( true ); end --addEventHandler( "onClientRender", getRootElement(), function animateLetterBox_flyIn ( ) if letterBox.animStartTick == 0 then letterBox.animStartTick = getTickCount(); letterBox.animFinishTick = letterBox.animStartTick + letterBox.animLength * 1000; letterBox.keepAnimating = true; end local stripH; local currentStripHeight = letterBox.stripHeight; if letterBox.keepAnimating then local currentTick = getTickCount(); local percentage = ( ( letterBox.animLength * 1000 ) - ( letterBox.animFinishTick - currentTick ) ) / ( letterBox.animLength * 1000 ); currentStripHeight = letterBox.stripHeight * percentage; if currentStripHeight > letterBox.stripHeight then currentStripHeight = letterBox.stripHeight; letterBox.keepAnimating = false; end end dxDrawRectangle( -1, -1, screenSize[ 1 ] + 1, currentStripHeight, tocolor( 0,0,0,255 * letterBox.stripAlpha ), false ); dxDrawLine( -1, screenSize[ 2 ], screenSize[ 1 ] + 1, screenSize[ 2 ], tocolor( 0, 0, 0, 255 * letterBox.stripAlpha ), currentStripHeight*2, false ); end
  6. Si lo hace, pero la posición no se actualiza. function ped ( thePlayer ) if pedxd then return end thePlayer = thePlayer pedxd = createPed ( 120, 5540.6654, 1020.55122, 1240.545 ) timer = setTimer(function() local px,py,pz= getElementPosition(thePlayer) setElementPosition(pedxd,px+2,py,pz) end, 2000, 0) end addCommandHandler("ped",ped) Perdón por la estructura visual, respondí desde un dispositivo móvil.
  7. En este código de @Tomas: function AbrirS() cuenta = getPlayerAccount (client) if isGuestAccount (cuenta) then return outputConsole ("Debes de registrarte para visualizar el panel", client) end triggerServerEvent("showPanel",resourceRoot,client) end end addEvent( "onPanel", true ) addEventHandler("onPanel", root, AbrirS) Hay un error, pues 'triggerServerEvent' es solo para client-side. Prueba así: function AbrirS() cuenta = getPlayerAccount (client) if isGuestAccount (cuenta) then return outputConsole ("Debes de registrarte para visualizar el panel", client) end triggerClientEvent ( client, 'showPanel', client, client) --lamento el triple 'client', pero evite transformar mucho el codigo. end end addEvent( "onPanel", true ) addEventHandler("onPanel", root, AbrirS)
  8. Alexs

    [Ayuda] Lava.

    Si no me equivoco, un elemento en llamas pierde vida por si solo, así que el timer seria innecesario.
  9. Utiliza 'outputChatBox', 'getElementType' y 'type', así te aseguras de que tipo de variable es 'source'.
  10. Entonces asegúrate de que 'source' sea un zombie.
  11. Cuando alguien pregunta respecto a una variable, se espera que se confirme mediante la función 'type', 'tostring' o similares para asegurarse de que no es una confusión sobre la definición de la variable.
  12. ¿Estas seguro de que 'source' es el zombie que apareció?
  13. ¿Podrías mostrarnos el código completo?
  14. Prueba con el código sin editar y sin ocultar tu IP, a mi me funcionó sin mayores problemas.
  15. Yo lo estuve probando antes de publicarlo y funcionó sin problemas.
  16. ¿Estas seguro de que no utilizas ningún método que pudiese alterar los resultados?
  17. ¿Que información se muestra cuando entras a http://ip-api.com/json ?
  18. Alexs

    NAME REGISTER

    En la cuarta linea de tu código, cambia 'source' por 'player'.
  19. Es bastante inocente creer que una API (que cualquiera podría utilizar) te dirá la posición exacta de una persona a partir de su IP, supongo que se utilizan ciertas posiciones de referencia para establecer la localización de las direcciones.
  20. Hice algunas correcciones, así se aprende de mejores formas. --Es innecesario definir 'resourceRoot', es una variable predefinida para client y server. function checkTransfer() if isTransferBoxActive() then --Comparar aqui dos boolean es redundante. setTimer(checkTransfer,2000,1) --Los temporizadores de MTA son una pesima opcion, algun juego con 'onClientRender' es mas eficiente. else fadeCamera(true) end end addEventHandler("onClientResourceStart",resourceRoot,checkTransfer) * Sobre las variables predefinidas: viewtopic.php?f=91&t=39678
  21. Alexs

    NAME REGISTER

    ha ya vale entonces lo pndre en el server del panel login dentro de la función donde registra hay funcionara ? Si, eso debería funcionar.
  22. Alexs

    NAME REGISTER

    No sirve porque no existe ningún evento llamado 'onPlayerRegister'.
×
×
  • Create New...