Jump to content

Iaan

Members
  • Posts

    18
  • Joined

  • Last visited

Posts posted by Iaan

  1. On 21/04/2017 at 07:29, ozulus said:

    I don't think it's really required since it can be done with any other programming languages. Just google it, there are already a few of examples.

    I know it, but, why not implement this ? It's something simple and very productive.

    I use a script similiar: 

    On 04/03/2017 at 23:10, MIKI785 said:

    It would be useful. But in the meantime you could use this simple shell script (if running linux):

    
    for name in *.png #will go through all pngs, use * for all files.
    do
    echo "<file src=\"/images/$name\" type=\"client\" />" #$name will get replaced with file names
    done
    

    Just put it in the same directory as the files and then run simply like: ./test.sh > list.txt

    Then just copy it from list.txt to meta.xml.

    Hopefully someone can find it useful if they're not familiar with shell scripting.

     

  2. 19 hours ago, lordhenry said:

    Esse jeito acima não vai dar certo. A variável isDrunk será aplicada ao script em si e não aos jogadores. Dessa forma, se um jogador der o comando /bebado e a variável ficar true, dai essa variável será true para todo mundo.

    Eu faria desse jeito assim:

    
    function onJoin (source)
        setElementData (source,"drunk.Status", false) -- Todo jogador que entra no server recebe status de bêbado como false por padrão.
    end
    addEventHandler ("onPlayerJoin", getRootElement(), onJoin)
    
    function drunkPlayer (source)
        if getElementData (source,"drunk.Status") == false then -- Se o jogador estiver com status de bêbado como false, faz o seguinte:
            setPedWalkingStyle (source, 126) -- Coloca estilo de andar bêbado.
            toggleControl (source, "sprint", false) -- Desativa a função de correr, podendo somente andar na velocidade normal ou caminhar.
            setElementData (source, "drunk.Status", true) -- Coloca o status de bêbado desse jogador como true.
        else -- Se o jogador não possuir status de bêbado como false, faz o seguinte:
            setPedWalkingStyle (source, 0) -- Coloca estilo de andar normal.
            toggleControl (source, "sprint", true) -- Ativa a função de correr.
            setElementData (source, "drunk.Status", false) -- Coloca o status de bêbado desse jogador como false.
        end
    end
    addCommandHandler ("bebado", drunkPlayer) -- Executa essa função ao usar o comando /bebado.
    

     

    Exato, meu exemplo foi o mais genérico possível. Queria apenas demonstrar o uso da função e não fazer um script para /bebado.

  3. 23 minutes ago, #banana said:

    sim,intendi seu modo de pensar mas como já disse no post gostaria de fazer ele andar como uma animação,pois se eu colocar o  setPedWalkingStyle vão poder correr e etc... então vai fugir do foco principal que é só fazer andar bêbado sem correr.

    Havia entendido que só precisava do style... 

    Para fazer do jeito que você quer, assim que você ativa a animação você vai precisar bloquear o controle de correr com toggleControl(https://wiki.multitheftauto.com/wiki/ToggleControl) e quando sair da animação, você vai precisar habilitar novamente.

     

    local isDrunk = false
    function drunkPlayer(player,cmd)
      if not (isDrunk) then
      	setPedWalkingStyle(player,126)
        toggleControl(player,"sprint",false)
        isDrunk = true
      else
        setPedWalkingStyle(player,0)
         toggleControl(player,"sprint",true)
        isDrunk = false
      end
    end
    addCommandHandler("bebado",drunkPlayer)

    (Não testei)

  4. function changeSkin(player,cmd,skinID)
    	skinID = tonumber(skinID)
    	if(skinID) then
    		if(setElementModel(player,skinID)) then
    			outputChatBox("SKIN SETADA.",player)
    		else
    			outputChatBox("Erro ao setar skin.",player)
    		end
    	end
    end
    addCommandHandler("change",changeSkin)

     

    Recomendo a entender os conceitos básicos de programação pois isso é um script muito simples. (Caso não tenha uma verificação de quem pode alterar a skin e tudo mais.)

     

    Mas existe resources que são mais completos, basta procurar na MTA Community.

  5. 16 hours ago, DNL291 said:

    Acho que me entendeu mal. Eu vi que já resolveu usando: local playeraccount = getPlayerAccount ( source ). E nada contra sobre ter funcionado, se tá tudo OK, parabéns por conseguir arrumar o código, dessa forma que aprende Lua na verdade.

    Eu disse sobre aquele erro "Expected element at argument 1, got nil", era por causa do: setTimer(function()... Isso cria outra função, e source passa a ser inválido. Mas passando o elemento para a função criada em setTimer vai resolver, como eu disse. Evita definir uma variável que ocupa mais memória, a na verdade é a solução mais lógica.

    Exatamente, acho que muitos aprendem errado dessa forma pensando "se está funcionando está certo.".

    É bom tentar sempre otimizar o código.

    • Like 2
  6. 7 minutes ago, Dante383 said:

    Good idea, but I would do asterisk substitute for any characters also. For example:

    *.txd - all files with txt extension

    file_*.txd - file_1, file_2, file_3, etc

    Of course, this is another nice example.

  7. 6 hours ago, ccw said:

    Does the MTA Linux server have full internet access?

    What server IP is shown in the server log:

    
    Querying MTA master server... success! (Auto detected IP:?????)

     

    Before,IP is not shown, now i tried and successful.
    1 - Open the linux-server and wait for IP
    2 - Open client in VM
    Thanks for support, bro.

  8. 6 hours ago, ccw said:

    Please start the Linux server again.

     

    I tried this:

    1 - Open Linux Server

    2 - Try enter MTA client...

    But when I open the Linux server and open the client on the VM, same thing happens.

  9. 1 hour ago, ccw said:

    What happens when you press 'OK' ?

    Opens a site with these instructions:

    https://updatesa.multitheftauto.com/sa/trouble/?v=1.5.3-9.10999.0.000&id=A0050DC89EF2DF7DB6A13D2BEFBFB9B4&tr=serial-validation

    But i found a bug when i tried this.

    1 - Desactive internet from your Linux (So that your virtual machine does not have internet)

    2 - Open your server in linux with root

    3 - Open your mta-client in vm

    4 - Then the MTA will not check your serial and will open.

    5 - Play it

     

    (You can let your IP from virtual machine invalid for use only local)

    Works only on local servers.

     

    jrJZoJW.png

     

     

    k5600RP.png

    If you activate internet  then MTA crashes

     

     

  10. Hello everyone, I'm having problems with the `mta sa` client ...

    When I installed the MTA and try to open it it gives me the following message:

    ---------------------------
    MTA: San Andreas  [CN01]   (CTRL+C to copy)
    ---------------------------
    There was a problem validating your serial
    ---------------------------
    OK   
    ---------------------------

     

    Moderator edit (knownledgebase note): If you're getting the error "CN01: There was a problem validating your serial" then you need to:

    follow the instructions at https://updatesa.multitheftauto.com/sa/trouble/?tr=serial-validation

    For example, if you're on Windows, these would be the extended steps for instruction 1) at the link above

    - Run MTA on the host system atleast once, so without VMware on the same PC.

    - Then use VM(ware) to use MTA again, after doing that.

    Reason: MTA wants to generate your MTA serial on the 'real' PC, so it can restore your original MTA serial into your VM. This is a technical measure to stop people from ban evading & easy serial changing with VM's.

    So long story short, you just need to use MTA without VM one time, and then you can keep using VM forever. Your PC cannot "first meet" MTA while running through a VM.

    If you're on Linux, the Linux MTA server contains an alternative to complete the same process; use instruction 2 from the link.

     

    I1HTmwF.png

    I can open gta-sa normally...

    Someone can help me?

    Ps: I forgot, I'm using a virtual machine (VMWARE)

×
×
  • Create New...