Jump to content

Jonas^

Members
  • Posts

    1,016
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by Jonas^

  1. Cara sempre procure deixar o código organizado e e indentado de forma correta, assim fica mais facil de você entender oque você esta fazendo, tem muitas coisas nesse código seu que daria pra fazer de uma forma bem melhor, código devidamente indentado: oldTeam = {} -- Tabela para salvar o Team antigo. napvp = createColRectangle ( 5441.9, -1926.4, 119.5, 133 ) event_iniciado = 1 verificarOne = 0 local spawns = { { 5460.70264, -1825.30945, 10.97057 }, { 5454.74805, -1884.13953, 10.29621 }, { 5537.57373, -1887.13306, 11.04092 }, { 5545.14746, -1829.44873, 10.29401 }, { 5501.95557, -1861.66174, 10.29621 } } function start_admin_event (player) if (event_iniciado == 1) then local accName = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Owner" ) ) then outputDebugString ("Evento Iniciado") event_iniciado = event_iniciado +1 i = 0 pvp_1 = createTeam("PVP-Red [use /pvp]", 255, 0, 0) pvp_2 = createTeam("PVP-Green [use /pvp]", 0, 255, 0) pvp_3 = createTeam("PVP-Blue [use /pvp]", 0, 0, 255) pvp_4 = createTeam("PVP-Yellow [use /pvp]", 255, 255, 0) addCommandHandler ( "pvp", tele ) end else outputChatBox("The event is already activated", player, 255, 0, 0) end end addCommandHandler ( "eventStart", start_admin_event ) function entrar_na_zona( thePlayer, matchingDimension ) if getElementType ( thePlayer ) == "player" then --outputChatBox( "Working One" ) redirecionar_team (thePlayer ) end end addEventHandler("onColShapeHit", zonapvp, entrar_na_zona) function sair_da_zona ( thePlayer, matchingDimension ) if getElementType ( thePlayer ) == "player" then --outputChatBox( "Working Two" ) retirar_team (thePlayer ) end end addEventHandler("onColShapeLeave", zonapvp, sair_da_zona) function tele (player) local teles = math.random ( #spawns ) if ( teles ) then local isTeamPlayer = getPlayerTeam ( player ) if getElementData(player,"SavedTeam") then setElementData(player,"inPVP",true) else --outputDebugString ("Esse playe foi pro pvp mas não tem team") verificarOne = verificarOne +1 end setElementPosition(player, unpack ( spawns [ teles ] )) end end function redirecionar_team (thePlayer) playerTeam = getPlayerTeam(thePlayer) i = i + 1 if i > 4 then i = 1 end if pvp_1 and pvp_2 and pvp_3 and pvp_4 then if playerTeam then --/// Verifica se o player já estava em um Team oldTeam[thePlayer] = getTeamName(playerTeam) --/// Salva o Team na tabela oldTeam end if i == 1 then setPlayerTeam ( thePlayer, pvp_1 ) end if i == 2 then setPlayerTeam ( thePlayer, pvp_2 ) end if i == 3 then setPlayerTeam ( thePlayer, pvp_3 ) end if i == 4 then setPlayerTeam ( thePlayer, pvp_4 ) end end end function retirar_team (player) if getElementData(player,"SavedTeam") then if getTeamFromName(oldTeam[player]) then --/// Verifica se o Team antigo ainda existe setPlayerTeam(player, getTeamFromName(oldTeam[player])) --/// Seta o player no Team que está na tabela oldTeam end local t = getElementData ( player, "SavedTeam" ) setElementData(player,"SavedTeam",false) end end addCommandHandler ("stop123", function (player) local accName = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Owner" ) ) then if event_iniciado >= 2 then for k , v in ipairs(getElementsByType("player")) do if getElementData(v,"inPVP") then retirar_team (v) end end for i, team in ipairs(getElementsByType("team")) do destroyElement(team) end removeCommandHandler ( "pvp" ) event_iniciado = 1 else outputChatBox("Unable to stop because it was not started", player, 255, 0, 0) end end end)
  2. Provavelmente seja alguma element-data que você terá que informar em seu velocimetro, poste na área adequada da próxima vez. Área adequada para criar tópicos relacionados a esse. Programação em Lua Tópicos uteis: Informações úteis - Scripting/Configurações/Tutoriais para o MTA [VÍDEO] Tudo sobre este fórum
  3. GetPlayerAccount GetAccountName GetElementData SetElementData IsObjectInACLGroup AddCommandHandler Eventos (client-side) OnClientPlayerDamage OnClientPlayerStealthKill Edit: Próxima vez crie tópico na área adequada, se é novo por aqui, de uma olhada como funciona nosso fórum. Área adequada para criar tópicos relacionados a esse. Programação em Lua Tópicos uteis: Informações úteis - Scripting/Configurações/Tutoriais para o MTA [VÍDEO] Tudo sobre este fórum
  4. Merry Christmas and may everyone have a successful 2020!
  5. Na verdade agora que vi que não é preciso confirmar com o comando padrão do admin aeuhaeaeaeua, agora nem eu sei oque ta acontecendo, só vendo pra saber.
  6. Dificuldade em... if isObjectInACLGroup ("user."..getAccountName(getPlayerAccount (source)), aclGetGroup ("Console")) then outputChatBox ("*#FFEE00ʙᴄʙ ʟᴏᴄᴀʟ #FFEE00- #FF6A6APresidente #FFEE00- #ffffff"..removeHex(getPlayerName(source)).." ("..getElementData(source, "ID")..")#FFEE00 - #ffffff#FF6A6A "..tresc, gracze, 255, 255, 255, true) end function removeHex( s ) if type(s) == "string" then while(s:find("#%x%x%x%x%x%x")) do s = s:gsub("#%x%x%x%x%x%x","") end end return s or false end
  7. É, na realidade não pensei na possibilidade dele ter mexido no painel admin e ter mexido logo na parte de registro.... mas, são hiposteses, apenas olhando pra saber oque realmente esta acontecendo. Agora que percebi também que ele citou ali nos comandos: '' meto /register matias 1234 e depois /login matias 1234 apareçe assim login :No known account for ´matias` "" Faz sentido acontecer isso se ele esta digitando desta forma o comando de /register, até porque é necessario confirmar a senha. /register matias 1234 1234.
  8. Não tem como ter dado erro, esses comandos são nativos do painel admin, verifique se o seu painel admin esta com permissão de administrador, ou se tem algum outro resource cancelando os 2 comandos.
  9. Levando em consideração que este comando só sera utilizado uma vez por conta, é viável setar diretamente a data na conta do jogador sem usar element-data, além do mais se o servidor der crash por algum motivo, os dados não serão perdidos. local mPorte = createMarker (1154.28467, -1743.70789, 12.39844, "cylinder", 2, 255, 255, 255, 50) local lojaArma = createMarker (1154.50305, -1749.57227, 12.57031, "cylinder", 2, 255, 255, 255, 50) addEventHandler ("onMarkerHit", mPorte, function (hitElement, matchingDimension) if getElementType (hitElement) == "player" then -- Se o elemento que colidiu no marker for um player, então: outputChatBox ("Você deseja um porte de armas por 10K? Use o comando /porte", hitElement) end end) addEventHandler ("onMarkerHit", lojaArma, function (hitElement, matchingDimension) if getElementType (hitElement) == "player" then -- Se o elemento que colidiu no marker for um player, então: outputChatBox ("Para comprar uma glock por R$7.500, digite /glock", hitElement) end end) addCommandHandler ("porte", function (thePlayer, cmd) if not isGuestAccount (getPlayerAccount (thePlayer)) then -- Se o jogador estiver logado, então: if isElementWithinMarker (thePlayer, mPorte) then -- Se o jogador estiver no marker da "mPorte", então: if getPlayerMoney(thePlayer) >= 10000 then -- Se o jogador tiver um saldo igual ou mais que 10000, então: if getAccountData (getPlayerAccount(thePlayer), "Porte1") then -- Se o jogador possuir porte de armas, então: outputChatBox ("Você já tem um porte de armas!", thePlayer, 255, 0, 0) -- Feedback negativo informando que ele já possui porte de armas. else -- Se o jogador não possuir porte de armas, então: setAccountData (getPlayerAccount(thePlayer), "Porte1", true) -- Seta a data com o bool true informando que o jogador agora possue porte de armas. outputChatBox ("Você adquiriu o porte de armas e pagou $10000!", thePlayer, 0, 255, 0) -- Feedback positivo informando que ele adquiriu o porte de armas com sucesso. takePlayerMoney (thePlayer, 10000) -- Retira 10000 do saldo atual do jogador. end else -- Se o jogador não tiver a quantia de $10000, então: outputChatBox ("Você não possui um valor superior a $10000!", thePlayer, 255, 0, 0) -- Feedback negativo informando que ele não possui esse valor. end else -- Se o jogador não estiver no marker de pegar o porte, então: outputChatBox ("Você deve estar no lugar de compra de porte de armas...!", thePlayer, 255, 0, 0) -- Feedback negativo informando que o jogador não esta no local correto. end else outputChatBox ("Você precisa estar logado para executar este comando!", thePlayer, 255, 0, 0) -- Feedback negativo informando que o jogador precisa logar no servidor. end end) addCommandHandler ("glock", function (thePlayer, cmd) if isElementWithinMarker (thePlayer, lojaArma) then -- Se o jogador estiver no marker da "lojaArma", então: if getPlayerMoney(thePlayer) >= 7500 then -- Se o jogador tiver um saldo igual ou mais que 7500, então: if getAccountData (getPlayerAccount(thePlayer), "Porte1") then -- Se o jogador possuir porte de armas, então: giveWeapon (thePlayer, 22, 250) -- Recebe uma glock com 250 munições. takePlayerMoney (thePlayer, 7500) -- É retirado 7500 de seu saldo. outputChatBox ("Você comprou sua glock e pagou R$7500!", thePlayer, 0, 255, 0) -- Feedback positivo informando a compra da arma. else -- Se o jogador não possuir porte de armas, então: outputChatBox ("Você não tem o porte de armas!", thePlayer, 255, 0, 0) -- Feedback negativo informando que o jogador não possui porte de armas. end else -- Se o jogador não tiver a quantia de $7500, então: outputChatBox ("Você não possui um valor superior a $7500!", thePlayer, 255, 0, 0) -- Feedback negativo informando que ele não possui esse valor. end end end) @Taay
  10. local objeto = createObject (980, 1497.400, -698.5, 96.5, 0, 0, 0) local x, y, z = getElementPosition (objeto) local Zona = createColCircle (x, y, 6, 6) function Function (thePlayer, matchingDimension) if getElementType (thePlayer) == "player" then -- Se o elemento que colidiu no col for um player, então: if (isObjectInACLGroup ("user."..getAccountName (getPlayerAccount (thePlayer)), aclGetGroup("Admin"))) then -- Se o jogador estiver na acl "Admin" por exemplo, então: moveObject (objeto, 500, 1497.400, -698.5, 20.300) outputChatBox ("@Portão aberto!", thePlayer) end end end addEventHandler ("onColShapeHit", Zona, Function) function Function2 (thePlayer, matchingDimension) if getElementType (thePlayer) == "player" then -- Se o elemento que saiu do col for um player, então: if (isObjectInACLGroup ("user."..getAccountName (getPlayerAccount (thePlayer)), aclGetGroup("Admin"))) then -- Se o jogador estiver na acl "Admin" por exemplo, então: moveObject (objeto, 500, 1497.400, -698.5, 96) outputChatBox ("@Portão fechado!", thePlayer) end end end addEventHandler ("onColShapeLeave", Zona, Function2) @Niick
  11. Correção: addCommandHandler ("pf", function (thePlayer, cmd, nick) if isObjectInACLGroup ("user."..getAccountName (getPlayerAccount (thePlayer)), aclGetGroup ("PF_CMD")) then -- Se o jogador estiver na acl "PF_CMD", então: if not nick then return outputChatBox ("ERRO! Informe um nick por gentileza!", thePlayer, 255, 0, 0) end -- Se nenhum nick for informado retorna e cancela a execução! local jogador = getPlayerFromPartialName (nick) if not jogador then -- Se nenhum jogador com o nick informado for encontrado, então: return outputChatBox ("ERRO! Nenhum jogador com esse nick foi encontrado!", thePlayer, 255, 0, 0) end if (isObjectInACLGroup ("user."..getAccountName (getPlayerAccount (thePlayer)), aclGetGroup("PF"))) then -- Se o jogador estiver na acl "PF", então: aclGroupRemoveObject (aclGetGroup("PF"), "user."..getAccountName (getPlayerAccount (thePlayer))) -- Remove o jogador da acl "PF". outputChatBox ("Você removeu o jogador '"..string.gsub(getPlayerName (jogador), "#%x%x%x%x%x%x", "").."' do grupo da PF!", thePlayer, 0, 255, 0) outputChatBox ("O jogador '"..string.gsub(getPlayerName (thePlayer), "#%x%x%x%x%x%x", "").."' removeu você do grupo da PF", jogador, 255, 0, 0) else -- Senão: aclGroupAddObject (aclGetGroup("PF"), "user."..getAccountName (getPlayerAccount (thePlayer))) -- Adiciona o jogador da acl "PF". outputChatBox ("Você adicionou o jogador '"..string.gsub(getPlayerName (jogador), "#%x%x%x%x%x%x", "").."' ao grupo da PF!", thePlayer, 0, 255, 0) outputChatBox ("O jogador '"..string.gsub(getPlayerName (thePlayer), "#%x%x%x%x%x%x", "").."' adicionou você ao grupo da PF", jogador, 0, 255, 0) end else outputChatBox ("Você não tem permissão!", thePlayer, 255, 0, 0) end end) function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end OBS: Não testei, teste com /debugscript 3 ativado, se tiver erros poste aqui.
  12. Certifique-se que o resource (ph_main) esta funcionando perfeitamente.
  13. https://wiki.multitheftauto.com/wiki/OnVehicleExplode
  14. Ou, você pode congelar o jogador ao invés de kickar por um tempo até a conexão estabilizar novamente, como o DNL disse acima, esses problemas de conexão são bem comuns.
  15. Dessa forma que você fez não. addEventHandler ("onMarkerHit", ml, function (hitElement, matchingDimension) if getPlayerMoney (hitElement) >= 400 then takePlayerMoney (hitElement, 400) setElementPosition (hitElement, 733.827, -1355.561, 23.586) end end)
  16. Você não precisa usar o lado servidor pra fazer isso, basta usar OnClientMarkerHit
  17. Se você quer bloquear todos comandos exceto o de chat, use o exemplo do lord.
  18. Verdade, pensei que ele queria bloquear apenas um comando, não todos além do say. Mas de qualquer forma, é um exemplo, ele mesmo poderia dar um upgrade.
  19. Ué, verifique se ele esta no marker, se tiver use o evento pra cancelar o comando. local meuMarcador = createMarker (-2408.83, -600.46, 131.60, "cylinder", 2.0, 0, 0, 255, 255) addCommandHandler ("teste", function (thePlayer, cmd) outputChatBox ("Comando executado com sucesso!", thePlayer, 0, 255, 0) end) addEventHandler ("onPlayerCommand", root, function (cmd) if isElementWithinMarker (source, meuMarcador) then -- Se o jogador estiver no marker 'meuMarcador', então: if cmd == "teste" then -- Se ele tentou utilizar o comando 'teste' dentro do marker, então: outputChatBox ("Você esta dentro do marker! Não foi possível usar o comando '/"..cmd.."'", source, 255, 30, 30) cancelEvent () end end end)
  20. Como você tentou? poste se comprovar que você realmente tentou e não apenas fez de qualquer jeito pra ganhar pronto, quem sabe a gente possa fazer o código, já que eu fiz da última vez e nem assim você tentou se esforçar...
  21. Você esta chamando essa função onde? não poste códigos pela metade por favor...
  22. Só não esqueça de corrigir a primeira função, primeiro deve ser a verificação da data, desta forma: function AceitarEmprego02 (source) exports.Scripts_OnMarkerMsgs_:delete (source) unbindKey (source, LetraParaMarkers, "down", AceitarEmprego02) if getElementData (source, "AirNew>Encaminhamento") == "Entregador de Jornal" then setElementData (source, "AirNew>Encaminhamento", false) setElementData (source, "Emprego", "Entregador de Jornal") exports.Scripts_Dxmessages:outputDx (source, "Você Agora Trabalha de Entregador de Jornal, Para Mais Informações Digite ( /Profissao )", "success") else exports.Scripts_Dxmessages:outputDx (source, "Você Precisa Estar Encaminhado da Agencia de Empregos para Trabalhar neste Local!", "error") end if not isObjectInACLGroup ("user."..getAccountName (getPlayerAccount (source)), aclGetGroup("Entregador")) then -- Se o jogador não estiver na acl "Entregador", então: aclGroupAddObject (aclGetGroup("Entregador"), "user."..getAccountName (getPlayerAccount (source))) -- Adiciona ele na acl "Entregador". end end
×
×
  • Create New...