Jump to content

on3pixel

Members
  • Posts

    28
  • Joined

  • Last visited

Posts posted by on3pixel

  1. A playSound funkció kliensoldali. Ezt kliensként kell használnia kiszolgáló helyett, ezért próbálja meg ezt:

     

    function Zene ()
    	local sound = playSound("zene.mp3")
    	setSoundVolume(sound, 0.5)
    end
    addEventHandler("onClientPlayerJoin", localPlayer Zene)

     

  2. Função para detectar morte do jogador no server:

    onPlayerWasted - Multi Theft Auto: Wiki

    No client:

    onClientPlayerWasted - Multi Theft Auto: Wiki


    Utilizando o onClientPlayerWasted:
     

    messages = { 
    "Better luck next time",
    "Don't think you're so cool now, do you?",
    "Nice one, pal",
    "Your opinion is void" 
    }
    
    function wastedMessage ( killer, weapon, bodypart )
    	local randomID = math.random ( 1, #messages ) --get a random ID from the table
    	local randomMessage = messages[randomID] --use that to retrieve a message
    	outputChatBox ( randomMessage, 255, 0, 0 ) --output the message
    end
    addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), wastedMessage ) --add an event for the local player only

    Utilizando o onPlayerWasted:

     

    -- register player_Wasted as a handler for onPlayerWasted
    function player_Wasted ( ammo, attacker, weapon, bodypart )
    	-- if there was an attacker
    	if ( attacker ) then
    		-- we declare our variable outside the following checks
    		local tempString
    		-- if the element that killed him was a player,
    		if ( getElementType ( attacker ) == "player" ) then
    			-- put the attacker, victim and weapon info in the string
    			tempString = getPlayerName ( attacker ).." killed "..getPlayerName ( source ).." ("..getWeaponNameFromID ( weapon )..")"
    		-- else, if it was a vehicle,
    		elseif ( getElementType ( attacker ) == "vehicle" ) then
    			-- we'll get the name from the attacker vehicle's driver
    			tempString = getPlayerName ( getVehicleController ( attacker ) ).." killed "..getPlayerName ( source ).." ("..getWeaponNameFromID ( weapon )..")"
    		end
    		-- if the victim was shot in the head, append a special message
    		if ( bodypart == 9 ) then
    			tempString = tempString.." (HEADSHOT!)"
    		-- else, just append the bodypart name
    		else
    			tempString = tempString.." ("..getBodyPartName ( bodypart )..")"
    		end
    		-- display the message
    		outputChatBox ( tempString )
    	-- if there was no attacker,
    	else
    		-- output a death message without attacker info
    		outputChatBox ( getPlayerName ( source ).." died. ("..getWeaponNameFromID ( weapon )..") ("..getBodyPartName ( bodypart )..")" )
    	end
    end
    addEventHandler ( "onPlayerWasted", root, player_Wasted )

     

  3. On 17/07/2022 at 04:53, 6jiuhoff said:

    I ran my script where the test command is used. Then launched pAttach. I enter commands - it gives an error. Restarted the scripts and the server, does not help. I do not know how to fix the error, I do not have enough experience

    You need to start pAttach and then start your script. Always start he dependency before starting the scripts that depends on your dependency.

    start pAttach
    -> then start your script.

    do not start your script then start pAttach.

  4. You can set the element visible to in the marker:
     

    marker createMarker ( float x, float y, float z [, string theType = "checkpoint", float size = 4.0, int r = 0, int g = 0, int b = 255, int a = 255, element visibleTo = getRootElement( ) ] )

     

  5. 5 hours ago, 6jiuhoff said:
    Hello. I don't know English and I use a translator. When using the test command on the server side, I got an error (see picture). Also, my debugscript gave me a warning, in the 12th line of checkupdate.lua. Do not prompt, in what there can be a problem?

     

     

    https://imgur.com/jGGsWYt

    The error is clearly on your debugscript. Just start the rsource pAttach that your script is requesting.

     

    • Like 1
  6. You can set data to the the item from the gridlist and get it later, Idk if it's what you want but it should work:

    DGS = exports.dgs
    function clientsideResourceStart ()
        local numberList = DGS:dgsCreateGridList ( 0.80, 0.10, 0.15, 0.60, true )
        local column = DGS:dgsGridListAddColumn ( numberList, "Column Title", 0.85 )
        if ( column ) then
            local row = DGS:dgsGridListAddRow ( numberList )
            local myItem = DGS:dgsGridListSetItemText ( numberList, row, column, tostring( math.random(0, 10) ^ 100 ) )
            DGS:dgsGridListSetItemData ( numberList, row, column, "Test" )
            local myItemData = DGS:dgsGridListGetItemData ( numberList, row, column )
            outputChatBox ( "My gridlist item data: " .. myItemData )
        end
    end
    addEventHandler ( "onClientResourceStart", resourceRoot, clientsideResourceStart )

     

  7. Algumas funções tem o lado client e o lado server, o MarkerHit é um exemplo.

    Para usar como client:
    addEventHandler("onClientMarkerHit", marker, função)

    No server-side:
    addEventHandler("onMarkerHit", marker, função)

    Arrumei seu código, você pode colar isso aqui em seu client script e deve funcionar:
     

    local visible = false
    local mrk = createMarker (2493.9443359375,-952.806640625,81.248107910156, "cylinder", 2, 211, 102 ,13)
    local screenW, screenH = guiGetScreenSize()
    function painel()
        dxDrawLine((screenW * 0.2632) - 1, (screenH * 0.3021) - 1, (screenW * 0.2632) - 1, screenH * 0.7526, tocolor(45, 191, 25, 254), 1, false)
        dxDrawLine(screenW * 0.7801, (screenH * 0.3021) - 1, (screenW * 0.2632) - 1, (screenH * 0.3021) - 1, tocolor(45, 191, 25, 254), 1, false)
        dxDrawLine((screenW * 0.2632) - 1, screenH * 0.7526, screenW * 0.7801, screenH * 0.7526, tocolor(45, 191, 25, 254), 1, false)
        dxDrawLine(screenW * 0.7801, screenH * 0.7526, screenW * 0.7801, (screenH * 0.3021) - 1, tocolor(45, 191, 25, 254), 1, false)
        dxDrawRectangle(screenW * 0.2632, screenH * 0.3021, screenW * 0.5169, screenH * 0.4505, tocolor(35, 75, 33, 244), false)
        dxDrawText("Trabalho Ilegal -BVC", screenW * 0.2559, screenH * 0.3021, screenW * 0.7750, screenH * 0.3607, tocolor(96, 248, 88, 254), 1.00, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText("Ganho: R$ 580", screenW * 0.4169, screenH * 0.4688, screenW * 0.6110, screenH * 0.5625, tocolor(16, 189, 7, 254), 1.00, "bankgothic", "center", "center", false, false, false, false, false)
        dxDrawLine((screenW * 0.4176) - 1, (screenH * 0.5977) - 1, (screenW * 0.4176) - 1, screenH * 0.6641, tocolor(16, 189, 7, 254), 1, false)
        dxDrawLine(screenW * 0.6125, (screenH * 0.5977) - 1, (screenW * 0.4176) - 1, (screenH * 0.5977) - 1, tocolor(16, 189, 7, 254), 1, false)
        dxDrawLine((screenW * 0.4176) - 1, screenH * 0.6641, screenW * 0.6125, screenH * 0.6641, tocolor(16, 189, 7, 254), 1, false)
        dxDrawLine(screenW * 0.6125, screenH * 0.6641, screenW * 0.6125, (screenH * 0.5977) - 1, tocolor(16, 189, 7, 254), 1, false)
        dxDrawRectangle(screenW * 0.4176, screenH * 0.5977, screenW * 0.1949, screenH * 0.0664, tocolor(107, 0, 0, 254), false)
        dxDrawText("Pegar Trabalho ", screenW * 0.4169, screenH * 0.5951, screenW * 0.6125, screenH * 0.6641, tocolor(207, 141, 36, 199), 1.00, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText("Carga de Maconha", screenW * 0.4206, screenH * 0.3867, screenW * 0.6110, screenH * 0.4557, tocolor(107, 0, 0, 254), 2.00, "diploma", "center", "center", false, false, false, false, false)
    end
    
    
    function abrirPainel()
        if not visible then
            visible = true
            addEventHandler("onClientRender", getRootElement(), painel)
        else
            visible = false
            removeEventHandler("onClientRender", getRootElement(), painel)
        end
    end
    addEventHandler("onClientMarkerHit", mrk, abrirPainel)
    
    addEventHandler("onClientMarkerLeave", mrk, function ()
        visible = false
        removeEventHandler("onClientRender", getRootElement(), painel)
    end)


     

  8. Sorry. I didn't understand your question.

    Do you want to have the count of users on your DISCORD server from your mta? Example, do you want to run /users on your MTA server and get the count of users from your DISCORD server?

  9. Há muito conteúdo disponível na internet. Você pode aprender até lendo scripts de outras pessoas, você pode encontrar vários no repositório de resources do próprio MTA:
     

    Quote


    Há muitos videos tambem.

    Como Programar Em Lua - MTA #1:

    Quote

     

     

    Até no próprio WIKI do mta tem uma introdução ao scripting:
     

    Quote

    Espero ver você em breve :)

  10. Basta remover a condicional do inWater então.

     

    function setPlayerOnFire(cmd, playerName)
    local player = getPlayerFromName ( playerName )
      if player then
      local notOnFire = not isPedOnFire(player)
        if notOnFire then
        setPedOnFire(player, true)
        end
      end
    end
    addCommandHandler("fogo", setPlayerOnFire)

    Espero que esse funcione :)

  11. Tente com isso:
     

    function setPlayerOnFire(cmd, playerName)
    	local player = getPlayerFromName ( playerName )
    	if player then
            local inWater = isElementInWater(player)
            if inWater then
                local notOnFire = not isPedOnFire(player)
    
                if notOnFire then
                    setPedOnFire(player, true)
                end
            end
     	end
    end
    addCommandHandler("fogo", setPlayerOnFire)

    Não testei no jogo, mas creio que deva funcionar

  12. To administrate my 3 MTA servers I use the discord. I can reboot the servers, send commands to it and things related. All my servers are under containers, so I can easily change the resource limits and so on. It's more "secure" then leaving it on the web, because you can set for your usage only, with your unique DISCORD ID.

  13. Hi,

    Have you unlocked them from iptables?

    iptables -I INPUT -p tcp --dport 22005 -j ACCEPT
    iptables -I INPUT -p udp -m multiport --dports 22126,22003 -j ACCEPT

    This should hit fine.. It's what I do on my end to fix.
     

×
×
  • Create New...