Jump to content

MYSOTO

Members
  • Posts

    44
  • Joined

  • Last visited

Posts posted by MYSOTO

  1. function funk (source)
    
        setElementFrozen(source, true) -- Freeze player Movement
        bindKey (source, "K", "up", desbloquear) --Add key to desbloquear funtion
        next:giveItem(source, "Chocolate", 1)
    end
    
    function desbloquear (source)
        setElementFrozen(source, false) -- desbloquea el movimiento del jugador
    end

     

  2. Remplace this line:

    if
     isObjectInACLGroup( "user." .. p[ player ].username, aclGetGroup( value.aclGroup ) ) and value.nametagColor then

    For this:

     
    if
     (isObjectInACLGroup( "user." .. p[ player ].username, aclGetGroup( groups[key].aclGroup ) ) and groups[key].nametagColor) then

    You can test this :)

  3. Hello, I come to suggest that it would be good to put the particles inside the mta map editor, I know that there are already functions to create particles but it would be nice and flexible that these can be added from the editor to avoid the user having to add them outside of it itself, this would save players time 

  4. you can add new groups here in the acl file  MTA San Andreas 1.5\server\mods\deathmatch\acl.xml

    <group name="military">
            <acl name="military"></acl>
            <object name="user.pepe"></object>   - ---USERS IN ACL PEPE 
        </group>

    , Below is an example of how to add military to your code 

    function chatbox( text, type)
    
        if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then
     cancelEvent()
            local r, g, b = getPlayerNametagColor(source)
            outputChatBox("#08BCD0~| Admin |~ #1AEBC1 " .. getPlayerName ( source ) .. ":#00FF36 " .. text, getRootElement(), r, g, b, true )
            outputServerLog("CHAT: [Admin] " .. getPlayerName ( source ) .. ": " .. text)
    
        elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Moderator")) then
     cancelEvent()
            local r, g, b = getPlayerNametagColor(source)
            outputChatBox("#EB064F~| Moderator |~#1AEBC1 " .. getPlayerName ( source ) ..":#FFFFFF " .. text, getRootElement(), r, g, b, true )
            outputServerLog("CHAT: [Moderator] " .. getPlayerName ( source ) .. ": " .. text)
    
    elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("military")) then
    			cancelEvent()
    			local r, g, b = getPlayerNametagColor(source)
    			outputChatBox("#08BCD0~| military |~ #1AEBC1 " .. getPlayerName ( source ) .. ":#00FF36 " .. text, getRootElement(), r, g, b, true )
    			outputServerLog("CHAT: [military] " .. getPlayerName ( source ) .. ": " .. text)
    
        elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("SuperModerator")) then
     cancelEvent()
            local r, g, b = getPlayerNametagColor(source)
            outputChatBox("#EB064F~|> SMOD <|~##1AEBC1 " .. getPlayerName ( source ) ..":#FFFFFF " .. text, getRootElement(), r, g, b, true )
            outputServerLog("CHAT: [SMOD] " .. getPlayerName ( source ) .. ": " .. text)
    
        elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Diamante")) then
    cancelEvent()
            local r, g, b = getPlayerNametagColor(source)
            outputChatBox("#EB064F~|> VIP Diamante <|~##1AEBC1 " .. getPlayerName ( source ) ..":#FFFFFF " .. text, getRootElement(), r, g, b, true )
            outputServerLog("CHAT: [VIP DIAMANTE] " .. getPlayerName ( source ) .. ": " .. text)
    
        elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Gold")) then
    cancelEvent()
            local r, g, b = getPlayerNametagColor(source)
            outputChatBox("#EB064F~|> VIP GOLD <|~##1AEBC1 " .. getPlayerName ( source ) ..":#FFFFFF " .. text, getRootElement(), r, g, b, true )
            outputServerLog("CHAT: [VIP GOLD] " .. getPlayerName ( source ) .. ": " .. text)
    
    	elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Soporte")) then
     cancelEvent()
            local r, g, b = getPlayerNametagColor(source)
            outputChatBox("#08BCD0~| Sop |~#1AEBC1 " .. getPlayerName ( source ) .. ":#FF0005 " .. text, getRootElement(), r, g, b, true )
            outputServerLog("CHAT: [sop] " .. getPlayerName ( source ) .. ": " .. text)
    
            elseif type == 0 then
            cancelEvent ( )
            local r, g, b = getPlayerNametagColor(source)
            outputChatBox ( " " .. getPlayerName ( source ) .. ":#FFFFFF " .. text, getRootElement(), r, g, b, true )
            outputServerLog( "CHAT: " .. getPlayerName ( source ) .. ": " .. text )
    		end
    end
    addEventHandler("onPlayerChat", getRootElement(), chatbox)

     


  5. Remember to have saved the file in case it is not saved, possibly you did not restart it in the console, it may be the code editor, it also happens to me that sometimes it is bugea I recommend you restart the program or change it for another editor, I recommend atom or sublimetext to edit code

  6. You can do this with database, I would use the GetPedWeapon, takeAllWeapons and giveWeapon functions. You could use setElementData to manipulate the mta database below I leave you an example to remove all the weapons when doing the command. 

    ------server.lua-----

    function tkw ( source )
    takeAllWeapons ( source )
    end    
    addCommandHandler ( "takeweapon", tkw )
  7.     for i, thePlayer in ipairs ( getElementsByType( "player" ) ) do    
            if ( sasori ~= thePlayer ) then
                   local px, py, pz = getElementPosition( thePlayer )
                  local tx, ty, tz = getElementPosition( player )
                  if ( getDistanceBetweenPoints3D( px, py, pz, tx, ty, tz ) <= 50 ) then
                    setElementHealth( thePlayer, ( getElementHealth( sasori ) - 80 ) 
                end
            end
        end

     

    Hola tengo ese pequeño script pero quiero que le quite vida a los que están cerca del jugador pero no al jugador porfa tengo esa duda

  8. Hola bueno quería pedirles si me pueden ayudar con este script que ise lo que pasa es que ya funciona todos los botones y eso pero al momento de logearme me sale que esta mal la contraseña o no existe y al momento de registrarme me sale que ya existe queria saber si me ayudan a repararlo no se si es un problema de algun evento grid o algo por favor llevo todo el dia intentando y no me sale que podra ser el error

    cliente:

      

    GUIEditor = {
        button = {},
        window = {},
        edit = {},
        staticimage = {},
        label = {}
    }
    
        zero =  ""
        two = ""
    
            GUIEditor.window[1] = guiCreateWindow(0.38, 0.31, 0.22, 0.32, "Login", true)
            guiWindowSetSizable(GUIEditor.window[1], false)
    		showCursor(true)
    
            logon = guiCreateButton(0.03, 0.82, 0.46, 0.15, "Login", true, GUIEditor.window[1])
            guiSetFont(logon, "default-bold-small")
            GUIEditor.button[2] = guiCreateButton(0.52, 0.82, 0.46, 0.15, "Registro", true, GUIEditor.window[1])
            guiSetFont(GUIEditor.button[2], "default-bold-small")
            GUIEditor.staticimage[1] = guiCreateStaticImage(0.02, 0.06, 0.96, 0.26, ":guieditor/images/plus.png", true, GUIEditor.window[1])
            GUIEditor.label[1] = guiCreateLabel(0.41, 0.34, 0.20, 0.08, "Usuario", true, GUIEditor.window[1])
            guiSetFont(GUIEditor.label[1], "default-bold-small")
            guiLabelSetHorizontalAlign(GUIEditor.label[1], "center", false)
            guiLabelSetVerticalAlign(GUIEditor.label[1], "center")
            GUIEditor.label[2] = guiCreateLabel(0.41, 0.55, 0.20, 0.08, "contraseña", true, GUIEditor.window[1])
            guiSetFont(GUIEditor.label[2], "default-bold-small")
            guiLabelSetHorizontalAlign(GUIEditor.label[2], "center", false)
            guiLabelSetVerticalAlign(GUIEditor.label[2], "center")
            
    
            GUIEditor.edit[1] = guiCreateEdit(0.28, 0.42, 0.47, 0.11, "", true, GUIEditor.window[1])
            GUIEditor.edit[2] = guiCreateEdit(0.28, 0.65, 0.47, 0.10, "", true, GUIEditor.window[1])  
    
            guiEditSetMasked ( password, true )
    		
    		usuario = guiGetText ( GUIEditor.edit[1] )
    		guiGetText ( GUIEditor.edit[2] )
    
    		
    
    		
    
    		
         function onregister ( )
          triggerServerEvent("rg",getLocalPlayer(),usuario,contra)
         end
         addEventHandler ( "onClientGUIClick", GUIEditor.button[2], onregister)
    		
    	function onlogin ( )
          triggerServerEvent("lg",getLocalPlayer(),usuario,contra)
         end
         addEventHandler ( "onClientGUIClick", logon, onlogin)
    
         function ocu ( )
         guiSetVisible( GUIEditor.window[1], false )
    		showCursor(false)
         end
    	 addEvent ( "ocultar", true )
         addEventHandler ( "ocultar", getLocalPlayer(), ocu)
    
    
         button = guiCreateButton( 0.7, 0.1, 0.2, 0.1, "OK", true )
    --Create an edit box and define it as "editBox".
    editBox = guiCreateEdit( 0.3, 0.1, 0.4, 0.1, "", true )
    guiEditSetMaxLength ( editBox, 128 ) --the max chatbox length is 128, so force this
    
    --setup our function to output the message to the chatbox
    function outputEditBox ()
            local text = guiGetText ( editBox )--get the text from the edit box
            outputChatBox ( contra ) --output that text
    end
    addEventHandler ( "onClientGUIClick", button, outputEditBox )
    
    
    

         y servidor 

    function rg(usuario,contra)
    	if (addAccount(usuario,contra)) then
    		triggerClientEvent(source,"ocultar",source)
    		logIn (source,getAccount(usuario,contra),contra)
    	else
    		outputChatBox("la cuenta ya existe")
    end
    end
    addEvent("rg",true)
    addEventHandler("rg",getRootElement(), rg)
    
    function lg(usuario,contra)
     cuenta = getAccount(usuario,contra)
     	if (cuenta) then
    		triggerClientEvent(source,"ocultar",source)
    		logIn (source,getAccount(usuario,contra),contra)
    		outputChatBox("te logeaste correctamente")
    		setCameraTarget(source)
    	else
    		outputChatBox("la cuenta no existe o la contraseña esta mal")
    end
    end
    addEvent("lg",true)
    addEventHandler("lg",getRootElement(), lg)
    
    
    
    
    addEventHandler ( "onPlayerJoin", getRootElement(),function ()
     triggerClientEvent(source,"abrir",source)
    end)
    
    function setCameraOnPlayerJoin()
         -- slowly fade the camera in to make the screen visible
         fadeCamera(source, true, 5)
         -- set the player's camera to a fixed position, looking at a fixed point
         setCameraMatrix(source, -1568, 540, 80, -400000, 10000000, 99.881813049316)
    end
    addEventHandler("onPlayerJoin", root, setCameraOnPlayerJoin)
    addEventHandler ( "onResourceStart", getRootElement(), setCameraOnPlayerJoin )

        

  9. On 12/12/2017 at 00:12, MadnessReloaded said:

    Vale, entonces necesitas:

    
    function funcion(jugador,comando,parametro1)
      
      end
      
      
      addCommandHandler ("modopasivo",funcion)--asigna la funcion al comando "modopasivo"
    

    Dentro de esta funcion mira si está activado y usa

    
    setElementData (jugador,"modoPasivo",true) --Define al jugador si está en modo pasivo, true si lo está, false si no.
    

    para poder identificar al jugador con el modo pasivo.

     

    Ahora, para desactivar la capacidad de disparar usa:

    
    addEventHandler ("onElementDataChange",root,function(nombre) --Ocurre cuando se le hace un setElementData a alguien
      	local modopasivo = getElementData (source,"modoPasivo") --Mira a ver si el modoPasivo está activado
        
        if nombre == "modoPasivo" then --Si el elementData que se ha cambiado es modoPasivo...
          
     		if modopasivo then -- y modopasivo está activado
         	toggleControl (jugador,"fire",false) --desactiva la capacidad de disparar. 
       		else --si no está activado
         	toggleControl (jugador,"fire",true) --activa la capacidad de disparar
            end
          
         end
      end)
    
    
    --Mirate la lista de control names en la wiki de MTA
    

    Y por último

    
    function invencibilidadPasivo (atacante)
      if getElementData (source,"modoPasivo") then --¿Está en modo pasivo?
        cancelEvent() --Sí, pues cancela el daño.
        end
      end
    
    
    addEventHandler ("onClientPlayerDamage",root,invencibilidadPasivo) --Asigna la funcion a solo cuando un jugador se daña
    
    --ESTA FUNCIÓN ES DE CLIENTE
    

     

    gracias bro me ayudaste mucho

  10. On 22/11/2017 at 23:54, Uknown. said:
    
    function playerTargetCheck ( )
        for i, thePlayer in ipairs ( getElementsByType( "player" ) ) do    
        	if ( player ~= thePlayer ) then
           		local px, py, pz = getElementPosition( thePlayer )
          		local tx, ty, tz = getElementPosition( player )
          		if ( getDistanceBetweenPoints3D( px, py, pz, tx, ty, tz ) <= 50 ) then
            		setElementHealth( player, ( getElementHealth( player ) - 50 < 0 ) and 0 or getElementHealth( player ) - 50 )
            	end
            end
        end
    end
    addCommandHandler ( "sharigano", playerTargetCheck )
    

     

    gracias me ayudaste mucho xddd

     

  11. Hola tengo este pequeño script y lo que pasa que no se porque se bugea y no toma solo a los jugadores que les apunto o están cerca sino también toma a lejanos me gustaría saber como podría  hacer que a una distancia corta solo le baje vida a los jugadores cercanos pero no al reproductor
    function playerTargetCheck ( )
        local target
        for i, thePlayer in ipairs ( getElementsByType("player") ) do  -- iterate over all players
            target = getPedTarget ( thePlayer )                        -
            if ( target ) then                                         -- if there was a target
                local health = getElementHealth(target) 
                setElementHealth (target, health - 50 ) 

            end
        end
    end
    addCommandHandler ( "sharigano", playerTargetCheck )

×
×
  • Create New...