FelipeMallmann
Members-
Posts
168 -
Joined
-
Last visited
Everything posted by FelipeMallmann
-
[Resolvido] Verificar se um player está dentro da area
FelipeMallmann replied to FelipeMallmann's topic in Programação em Lua
Sim, muito Obrigado! -
[Resolvido] Verificar carga no caminhao
FelipeMallmann replied to FelipeMallmann's topic in Programação em Lua
Feito cara Valeu!! Era isso que precisava, consegui finalizar meu ideia. Valeu mesmo -
Fala galera, estou com outra duvida, procurei na wiki mas nao achei, eu acredito que deva existir uma funçao que faça isso, pois é padrao do gta, mas realmente nao encontrei. Preciso verificar se um caminhao está com uma carga atras. Tanto quanto o caminhao quanto essa carga sao veiculos. Só preciso saber como verificar se o caminhao está com a carga encaixada atras dele ou nao. É possivel? Obrigado.
-
Eai galera, estou com uma duvida de como posso fazer para verificar se o player está dentro de uma area. Minha ideia é quando ele morrer, pegar todos os players do server, verificar se eles estao dentro de uma area. addEventHandler ( "onPlayerWasted", root, function( player ) if turfElement[source] and source == turfElement[source][1] then local turf,area,id = unpack( turfElement[source] ) local players1 = getElementsByType ( "player" ) for theKey,thePlayer in ipairs(players1) do if ( --[[player está dentro da area--]] ) then --... --... end end end end ) a variavel da area é essa local turf,area,id = unpack( turfElement[source] ) Obrigado
-
Hey guys, I need some help, it's my first time working with tables, I want to understand how it really works.. I have these 2 local variable, the first one gets the gang that owns the gangzone, and the second gets all members from this group (online and offline members) or at least it should get. My problem is this for _,v ipairs because I get an error that says i cant do getElementData from a table. Just to you guys undertand: I'm trying to get all members from a group and give money to all members, but I'm getting problems with this for and tables. How can I outPutChatBox the table to see if I'm getting the right names ? local turfGang = executeSQLQuery("SELECT GangOwner FROM Turf_System WHERE Turfs=?", "Turf["..tostring(3).."]" ) local gangMembers = executeSQLQuery("SELECT member_account FROM gang_members WHERE gang_name=?", turfGang ) --local players = getElementsByType ( "player" ) for _, v in ipairs( gangMembers ) do if getElementData(v, "gang") == turfGang then outputChatBox("sucesso", getRootElement(), 0, 255, 0, false ) --giveplayermoney... end end Thanks!
-
Hey guys, I need some help, it's my first time working with tables, I want to understand how it really works.. I have these 2 local variable, the first one gets the gang that owns the gangzone, and the second gets all members from this group (online and offline members) or at least it should get. My problem is this for _,v ipairs because I get an error that says i cant do getElementData from a table. Just to you guys undertand: I'm trying to get all members from a group and give money to all members, but I'm getting problems with this for and tables. How can I outPutChatBox the table to see if I'm getting the right names ? local turfGang = executeSQLQuery("SELECT GangOwner FROM Turf_System WHERE Turfs=?", "Turf["..tostring(3).."]" ) local gangMembers = executeSQLQuery("SELECT member_account FROM gang_members WHERE gang_name=?", turfGang ) --local players = getElementsByType ( "player" ) for _, v in ipairs( gangMembers ) do if getElementData(v, "gang") == turfGang then outputChatBox("sucesso", getRootElement(), 0, 255, 0, false ) --giveplayermoney... end end Thanks!
-
Thanks !!!
-
Hey guys, can someone tells me how exported functions work? I have a resource and want to use 1 function of this resource in another resource, I just need to set in the meta.xml that I want to export the function or what must I do? Thanks!
-
Fala ai galera, estou com uma duvida, ja dei uma pesquisada na wiki mas nao encontrei nada.. Existe alguma função pra setar algum objeto visivel no mapa e que a medida que esse objeto se mova ele continue visivel no mapa (tipo um blip movel) Obrigado. @ Edit: escrevendo o post me veio em mente o que eu queria. https://wiki.multitheftauto.com/wiki/Cr ... AttachedTo @Topico fechado.
-
[Ajuda] Bloquear valores double
FelipeMallmann replied to FelipeMallmann's topic in Programação em Lua
Ae Muito obrigado! Eu nao verifiquei se ele é inteiro ou nao, mas sim quando entra no else que manda por parametros a função de realmente depositar dinheiro ele vai converter o dinheiro pra inteiro com o math.floor. Muito obrigado ! -
Eai galera, estou com um problema aqui que é o seguinte: Eu uso um sistema de banco postado aqui na comunidade do mta só que encontrei um problema nele, vou tentar explicar. O dinheiro no jogo é sempre um valor inteiro, ou seja, não há números quebrados nele, mas esse sistema de banco ele aceita depositar números quebrados. Se caso eu deposite 1.9$ no banco, ele só vai retirar da minha mão 1$, mas no banco vai ter 1.9$, e se ele fizer isso varias vezes, vai ganhando muito dinheiro. Minha duvida é como verificar se essa variável ammount é um numero inteiro ou se é um numero double. function performBankAction( ) local amount = nil if source == withdrawTab.button then amount = tonumber( guiGetText( withdrawTab.amount ) ) if amount == nil then showWarningMessage( "Voce deve colocar a quantia\nque deseja sacar!" ) elseif amount < 1 then showWarningMessage( "Voce nao pode colocar valores negativos!" ) else triggerServerEvent( "bank_withdrawMoney", g_localPlayer, g_localPlayer, amount ) end elseif source == depositTab.button then amount = tonumber( guiGetText( depositTab.amount ) ) if amount == nil then showWarningMessage( "Voce deve colocar a quantia\nque deseja depositar!" ) elseif amount < 1 then showWarningMessage( "Voce nao pode colocar valores negativos!" ) else triggerServerEvent( "bank_depositMoney", g_localPlayer, g_localPlayer, amount ) end elseif source == transferTab.button then local to_who = guiGetText( transferTab.to ) amount = tonumber( guiGetText( transferTab.amount ) ) if to_who == nil or to_who == false or to_who == "" then showWarningMessage( "Voce deve escrever o nome\ndo jogador para transferir\no dinheiro!" ) elseif amount == nil then showWarningMessage( "Voce deve colocar a quantia\nque deseja transferir!" ) elseif amount < 1 then showWarningMessage( "Voce nao pode colocar valores negativos!" ) else local money_receiver = getPlayerFromNick( to_who ) if money_receiver == g_localPlayer then showWarningMessage( "Voce nao pode transferir\npara voce mesmo!" ) elseif money_receiver ~= g_localPlayer then triggerServerEvent( "bank_transferMoney", g_localPlayer, g_localPlayer, money_receiver, amount ) else showWarningMessage( "Jogador \"".. to_who .."\"\nnao esta conectado!" ) end end end end Obrigado!
-
Hmm entendi! Funcionou Eu usei o setElementData para matar o player Mas ainda estou com uma duvida. Nesse tipo de function o source e o getLocalPlayer() pegam o player que chama a função. Entao nesse caso eles sao iguais ou há alguma diferença entre eles? Obrigado!
-
Eai galera, estou tentando fazer alguma coisa que verifique a muniçao dos player, e caso seja muito alta matar ele (ou talvez seta-la para uma quantia menor, mas isso é o de menos) o problema é que ele não está entrando no if mesmo se tem uma quantidade alta de muniçao na arma. function checkWeapon ( prevSlot, curSlot ) local weapon = getPedWeapon ( getLocalPlayer(), curSlot ) if (getWeaponAmmo ( weapon ) >= 2000) then killPed (getLocalPlayer()) end end addEventHandler ( "onClientPlayerWeaponSwitch", getRootElement(), checkWeapon )
-
É que enquanto estou fora dessa colShape os zombies nascem de boa perto de mim, após entrar na colShape eles param de nascer e o problema vem ao sair dela novamente porque eles não nascem mais (mesmo fora) e nem se matando arruma, só relogando. Fiz um teste e tentei setar eles como Frozen setPedFrozen ( thePlayer, true ) Ao invés de mata-los, mas tanto dentro quanto fora eles não ficaram freezados.
-
Eu estou testando uma resource e nela é criado um team e depois é depois os bots são setados para esse team. Minha duvida é que tanto um zombie quanto esse bot são peds, mas apenas os zombies dão dinheiro, essa funçao "onZombieGetsKilled" não considera qualquer ped morto, eu tentei procurar ela para dar uma olhada mas não achei.
-
Ainda não deu Por algum motivo quando o player sai desse colShape não nasce mais zombies perto dele. Já tentei usar o seu codigo de umas 10 formas diferentes, fiz funcão chamando onColShapeLeave, usei simplesmente o seu codigo sem mais nada junto, fiz de tudo! Ainda estou precisando dessa resource, se alguem souber o que pode estar faltando. Obrigado.
-
Olá galera do forum, estou com uma duvida e preciso de uma ajudinha, queria saber se é possivel identificar um determinado time de um bot e o player que mata-lo ganhar dinheiro. Existe esse funçao que funciona para zombies. Há alguma assim (ou parecida) para teams? addEventHandler( "onZombieGetsKilled", getRootElement(), function( killer ) givePlayerMoney( killer, 100 ); end ) Obrigado
-
Ok, vou testar aqui! Muito obrigado! Depois edito esse topico para avisar se funcionou! @EDIT: Funcionou! Muito obrigado novamente
-
NewAge, fazendo o que você me sugeriu dai eu poderia fazer um getElementData(element, dinheiro) para exibir?
-
Eai galera, estou tentando modifcar um scoreboard para adicionar a aba de dinheiro nele, o problema é que eu não estou conseguindo fazer aparecer o dinheiro de todos os jogadores nele, ou aparece em todos os players o dinheiro de quem apertou tab, ou então todos ficam 0 { name = "Humanidade", width = 100, data = function (element) return getElementData ( element, "humanity" ) or 0 end }, { name = "Matou (Players)", width = 100, data = function (element) return ( getElementData ( element, "murders" ) or 0 ) end }, { name = "Matou (Zombies)", width = 100, data = function (element) return ( getElementData ( element, "zombieskilled" ) or 0 ) end }, { name = "Tempo vivo", width = 100, data = function (element) return formatTimeFromMinutes(getElementData ( element, "alivetime" ) or 1 ) end }, { name = "Dinheiro", width = 100, data = function (element) return getPlayerMoney (element) or 0 end }, { name = "Grupo", width = 100, data = function (element) return getElementData ( element, "gang" ) or "Sem Grupo" end }, } { name = "Dinheiro", width = 100, data = function (element) return getPlayerMoney (element) or 0 end }, Eu tentei fazer com getElementData mas o dinheiro não é um elementData então sempre caia no 0 e se eu fizer com getPlayerMoney (element) o dinheiro de quem estiver abrindo esse scoreboard vai ficar ao lado do nome de todos os outros. Como poderia ser feito isso? Há alguma forma de pegar o dinheiro seguindo esse mesmo padrao de getElementData? como pode ser feito? Enfim, essas sao minhas perguntas. Obrigado!
-
Eai galera, pensei em uma ideia aqui e queria ver se ela funcionaria sem dar erros. Minha ideia é fazer o seguinte, se o player entrar com uma resoluçao abaixo de 800x600 ele ser kickado Por exemplo: function teste (player) local screenW,screenH = guiGetScreenSize() if screenW <= 800 and screenH <= 600 then outputChatBox ('Por favor utilize uma resolução acima de 800x600', player, 0, 255, 0, true) kickPlayer(player) addEventHandler ( "onPlayerLogin", player, teste ) Alguma coisa desse tipo funcionaria? Obrigado. Obs: o motivo disso é que mesmo com essa funçao que pega as cordenadas da tela uma imagem ou um texto nunca fica no mesmo lugar certinho e é muito chato ter gente reclamando das resoluções.
-
[Duvida] Como funciona um arquivo .xml
FelipeMallmann replied to FelipeMallmann's topic in Programação em Lua
Hmm, Obrigado NewAge! -
[Duvida] Como funciona um arquivo .xml
FelipeMallmann replied to FelipeMallmann's topic in Programação em Lua
Cara não estou falando de meta, meu deus.... -
Eai galera! Estou com umas duvidas aqui, antes de fazer esse topico eu pesquisei e pesquisei mas não encontrei as respostas.. Minha duvida é mais na área de salvamento de dados, Me falaram que resources que usam xml para salvar alguma coisa é ruim pois o player pode modificar, já que funciona como uma especie de client-side e fica no computador do cara, e que ai quando ele entrar, a resource vai puxar o arquivo que salvou no computador dele (e que pode ser modificado por ele), causando assim uma maneira dos players abusarem disso. Estou com duvidas sobre isso, queria saber se é verdade ou não, se caso for verdade se há alguma solução para se "defender" disso, se é melhor usar arquivos .db para salvar, e essas coisas assim! Muitos obrigado!
-
Galera, estou tendo esses erros, de alguma forma ta vindo valor nulo e dai o dinheiro do player fica negativo e com umas 13 casas decimais erros: ERROR: banco1\server\bank.script.server.lua:339: attempt to index field '?' (a nil value) ERROR: banco1\server\bank.script.server.lua:325: attempt to index field '?' (a nil value) ERROR: banco1\server\bank.script.server.lua:245: attempt to index field '?' (a nil value) function withdrawMoney( player, money ) local playerBankID = getBankID( getPlayerBank( player ) ) if type( money ) == 'number' and playersAccount[ player ].balance < money then triggerClientEvent( player, "bank_showWarningMessage", player, "Insufficient founds!" ) elseif type( money ) == 'string' and money == 'all' then money = playersAccount[ player ].balance if money > 0 then local atm = ( banksInfo[ playerBankID ].ATM and true or false ) local triggered = triggerEvent( "onPlayerWithdrawMoney", player, getPlayerBank( player ), money, atm ) if triggered then playersAccount[ player ]:withdraw( money, player ) bank_savePlayerMoney( player, getPlayerAccount( player ) ) triggerClientEvent( player, "bank_updateMyBalance", player, playersAccount[ player ].balance ) end else triggerClientEvent( player, "bank_showWarningMessage", player, "You have no money in your\naccount!" ) end else if money > 0 then local atm = ( banksInfo[ playerBankID ].ATM and true or false ) local triggered = triggerEvent( "onPlayerWithdrawMoney", player, getPlayerBank( player ), money, atm ) if triggered then --outputChatBox( "You've withdrawn $"..tostring( money )..".", player, 255, 255, 0 ) playersAccount[ player ]:withdraw( money, player ) bank_savePlayerMoney( player, getPlayerAccount( player ) ) triggerClientEvent( player, "bank_updateMyBalance", player, playersAccount[ player ].balance ) end end end end addEvent( "bank_withdrawMoney", true ) addEventHandler( "bank_withdrawMoney", root, withdrawMoney ) Linha 245 local atm = ( banksInfo[ playerBankID ].ATM and true or false ) ------------------------------------------------- function transferMoney( player, receiver, money ) local playerBankID = getBankID( getPlayerBank( player ) ) if type( money ) == 'number' and playersAccount[ player ].balance >= money then local atm = ( banksInfo[ playerBankID ].ATM and true or false ) local triggered = triggerEvent( "onPlayerTransferMoney", player, getPlayerBank( player ), money, receiver, atm ) if triggered then playersAccount[ player ]:withdraw( money, player, true ) playersAccount[ receiver ]:deposit( money ) triggerClientEvent( player, "bank_updateMyBalance", player, playersAccount[ player ].balance ) bank_savePlayerMoney( player, getPlayerAccount( player ) ) bank_savePlayerMoney( receiver, getPlayerAccount( receiver ) ) if isPlayerInBank( receiver ) then triggerClientEvent( receiver, "bank_updateMyBalance", receiver, playersAccount[ receiver ].balance ) end end elseif type( money ) == 'string' and money == 'all' then money = playersAccount[ player ].balance local atm = ( banksInfo[ playerBankID ].ATM and true or false ) local triggered = triggerEvent( "onPlayerTransferMoney", player, getPlayerBank( player ), money, receiver, atm ) if triggered then playersAccount[ player ]:withdraw( money, player, true ) playersAccount[ receiver ]:deposit( money ) bank_savePlayerMoney( player, getPlayerAccount( player ) ) bank_savePlayerMoney( receiver, getPlayerAccount( receiver ) ) triggerClientEvent( player, "bank_updateMyBalance", player, playersAccount[ player ].balance ) if isPlayerInBank( receiver ) then triggerClientEvent( receiver, "bank_updateMyBalance", receiver, playersAccount[ receiver ].balance ) end end else triggerClientEvent( player, "bank_showWarningMessage", player, "Insufficient founds!" ) end end addEvent( "bank_transferMoney", true ) addEventHandler( "bank_transferMoney", root, transferMoney ) Linha 325 e 339 playersAccount[ receiver ]:deposit( money ) Há alguma forma de resolver isso, ou ao menos evitar esse erro? Obrigado!
