Jump to content

DNL291

Retired Staff
  • Posts

    3,875
  • Joined

  • Days Won

    67

Everything posted by DNL291

  1. raynner, I think you're contradicting yourself and so far you haven't been able to formulate your question correctly. Why the hell did you ask that question if you answered it yourself? If by "executed twice at the same time" you mean the function being called 2 times then you can see the example I posted above. If you think you're having some kind of problem with the variable, then show us how it's happening so we can help you fix that. Explain what exactly you want to know about the function execution process.
  2. You can use shader to change it. This resource will help you to find the texture name you're looking for: https://nightly.multitheftauto.com/files/shaders/shader_tex_names.zip
  3. Tente: function auto ( player ) local vehicle = getPedOccupiedVehicle(player) local nick_do_jogador = getPlayerName ( player ) if not getElementData ( player, "carLicense" ) then if vehicle and not isVehicleNoNeed ( getElementModel ( vehicle )) then -- não entendi qual vai ser o uso dessa função end outputChatBox("#000000[#ff0000POLICIA#000000] #bebebeO Player : "..nick_do_jogador.." #ff0000Não #bebebePossui Habilitação!", root, 255, 255, 255, true) elseif getElementData ( player, "carLicense" ) then outputChatBox("#000000[#ff0000POLICIA#000000] #bebebeO Player : "..nick_do_jogador.." #04B404Possui #bebebeHabilitação !", root, 255, 255, 255, true) end end addCommandHandler ("hab", auto )
  4. You copied-and-pasted and an example of MTA Wiki which is pretty simple, to make a tutorial using a code that isn't yours? Also you can't even understand that code. Proof of this is that you only changed the function name and forgot to change in the event handler too. Would be better you post in the scripting section so someone would explain you how it works.
  5. Here's an example if you haven't understand yet: addEvent( "onPlayerWasted2" ) addEventHandler( "onPlayerWasted", root, function ( totalAmmo, killer ) triggerEvent( "onPlayerWasted2", source, killer ) end ) addEventHandler( "onPlayerWasted2", root, function ( killer ) outputChatBox( "hasKiller: "..tostring(hasKiller) ) -- output: "hasKiller: nil" local hasKiller = false if killer and isElement(killer) then hasKiller = true end end ) I've used a custom event so you can undestand with more ease how the event is called. Note that "onPlayerWasted2" won't get called at the same funcion for two players, so the variable "resets" each time the event is called.
  6. if guiCheckBoxGetSelected(noti) then triggerServerEvent( "messagesend", localPlayer, player ) end server addEvent( "messagesend", true ) addEventHandler( "messagesend", root, function ( player ) outputChatBox("message has arrived", client, 255, 168, 0, true) if isElement(player) then outputChatBox("message send", player, 255, 168, 0, true) end end )
  7. Relax, no need to act like a mentally unbalanced person. I'm sure I got what you said. I think you weren't able to understand how everything works. If you read carefully what I have explained, you will know that it should be executed like in the second way:
  8. onPlayerLogin is triggered when each player logs in and it gets executed for all players. About the variable, it's accessible only inside the event and this code looks fine from what I can see. Client-side functions works individually while the Server-side functions works globally, ie for all players at the same time.
  9. I don't know exactly what you mean by "the variable is shared with the whole server", but just to clarify: A local variable is limited only to the script whereas a global variable is limited to the resource itself. I read the other part of your post like 5 times but unfortunately I didn't understand what you meant. I suggest you illustrate your question using a code. PS: When translating something to English, be careful about the Portuguese word "Lua" which is moon in English.
  10. Try looking for the godmode code in all your scripts or with your server empty, start resource by resource until you find the problem. Also, if you have any godmode script, make sure it's working fine.
  11. Sim. onClientResourceStop + triggerServerEvent e envia os dados pra serem salvos na conta. onClientResourceStop vai funcionar substituindo os dois eventos do lado server - onPlayerQuit e onResourceStop. Quando sair da conta, você pode usar onPlayerLogout mesmo e chamar um evento no client para salvar os dados chamando outro evento do lado server.
  12. Ah sim, agora entendi. Tem esta função útil que acredito que seja a mesma coisa que getPlayerIdleTime e você pode usar no lado client: function isElementMoving (theElement ) if isElement ( theElement ) then -- First check if the given argument is an element return Vector3( getElementVelocity( theElement ) ).length ~= 0 end return false end Como eu disse na outra resposta, você pode fazer o level no lado client também.
  13. There's no table called "A", that's why you're getting this message.
  14. Is the server database working correctly? Any errors in debug?
  15. Pelo que eu vi, no loop, você verifica na 3ª linha se o jogador não está AFK para que o código prossiga. Por que você está fazendo outra checagem de 5 minutos inativo então? O AFK do element-data funciona de outra forma? Dito isso, indo ao problema, creio que o que mais te impede de fazer o código de uma forma mais eficiente e organizada, é estar misturando essa verificação de AFK junto com o sistema de level dentro desse loop global. Fiz aqui um código que você pode usar para a verificação da inatividade dos jogadores: addEventHandler( "onResourceStart", resourceRoot, function() setTimer( startMonitoringPlayers, 10000, 0 ) end ) function startMonitoringPlayers() for _, player in pairs( getElementsByType("player") ) do local acc = getPlayerAccount(player) if not isGuestAccount(acc) and isPlayerAFK( player ) and getElementData( player, "playerAFKState" ) ~= true then setElementData( player, "playerAFKState", true ) elseif not isGuestAccount(acc) and isPlayerAFK( player ) ~= true and getElementData( player, "playerAFKState" ) then setElementData( player, "playerAFKState", false ) end end end function isPlayerAFK( player ) if isElement(player) then return ( getPlayerIdleTime( player ) >= 300000 ) end return false end Com o element-data atualizado para sincronizar com o client, você pode usá-lo no outro lado pra caso precisse. Na pior das hipóteses, vai demorar 10 segundos pra detectar o estado do jogador, mas você poder colocar um tempo mais baixo se achar conveniente. Percebi também que você pausa o progresso do level quando fica inativo por 5 minutos. Você pode colocar no lugar do setElementData uma tabela individual e quando detectar se o jogador ficou AFK ou voltou ao jogo você pode colocar o triggerClientEvent que você usou na linha 9 do seu código. Nessa chamada ao client, você pode saber no lado do client quando ele fica AFK e quando volta, acho que com essas informações, você pode fazer o código do level no lado client.
  16. Any errors in debug? Btw, kickPlayer is a native MTA function, rename it with a diferent name.
  17. Skin mod: https://community.multitheftauto.com/index.php?p=resources&s=details&id=15240 DONE EDIT: Modfication: https://community.multitheftauto.com/index.php?p=resources&s=details&id=15268 - Not sure if the uploader is really the author of this script. As the description says, it's a kind of script copied from CIT and it also has encrypted/compiled script files. Anyway, I think the upload should be checked, that's why I'm reporting it. @Dutchman101 also DONE
  18. "onClientGUIClick" guiCheckBoxGetSelected engineLoadTXD engineImportTXD engineLoadDFF engineReplaceModel engineRestoreModel
  19. local weapon = getPedWeapon(localPlayer) local weaponName = getWeaponNameFromID(weapon) outputChatBox( "Weapon name: "..tostring(weaponName) )
  20. getPedWeapon returns the weapon ID and getWeaponNameFromID returns the weapon name. You should be using getPedWeapon instead of getWeaponNameFromID.
  21. Is the function "click" attached to the "onClientClick" event? Try debugging the code using outputChatBox and see what each value shows. It's hard to figure out what's wrong just by looking at that piece of code. It would be better if you posted all code of the gridList.
  22. Não entendi a sua pergunta, o que você quer fazer exatamente? Se puder descrever o seu problema de uma forma mais clara, será melhor para obter ajuda de uma forma mais eficiente! Edit: Sobre o posicionamento da tela, você pode usar o resource Guieditor.
  23. @Jaaaack, faça postagens em Português nesta área aqui: https://forum.multitheftauto.com/forum/97-portuguese-português/ E qualquer post relacionado à programação Lua na área Programação em Lua. Edit: MOVED
  24. There's a Map Editor file called 'objects.xml' that has all objects IDs. You'll need to convert it to Lua, though, to avoid loops through the whole file.
×
×
  • Create New...