Jump to content

Gaimo

Members
  • Posts

    209
  • Joined

  • Last visited

Everything posted by Gaimo

  1. linha 2 troque o 20 por outro valor e adicione um outputchatbox com a variavel level pra ver qual valor retorna, porque aparentemente o getElementData não está funcionando.
  2. function createText() local armaAtual = getPedWeapon( getLocalPlayer() ) local idWeapon = 30 -- Arma que vocẽ quer que apareça. if armaAtual == idWeapon then -- se o ID da arma atual for igual o id da arma que você quer que apereça então: dxDrawText( texto, leftX, topY, rightX, buttomY, color, font ) -- escreva o texto que você quer. end end function HandleTheRendering ( ) addEventHandler ( "onClientRender", root, createText ) end addEventHandler( "onClientResourceStart", getRootElement( ), HandleTheRendering ) Não testei.
  3. Gaimo

    Loading mods

    Have you considered adding a mod, where it selects which modified skins, cars, and weapons it wants to use?
  4. A rockstar games está dando de graça o GTA SA para quem baixar o launcher dela, segue o link: https://www.rockstargames.com/br/newswire/article/61123/Download-The-Rockstar-Games-Launcher
  5. Uma dúvida, no caso o playSound3D não tem um fadeout conforme a distância né?
  6. function verificarpeso () peso_atual = var1 --variavel que tem o peso atual da mochila peso_max = var2 -- variavel que tem o peso maximo peso_item = var3 -- peso do item if ((peso_atual + peso_item) <= peso_max) then --Se o peso atual + peso do item for menor OU IGUAL ao peso maximo então --compra end end Na real nem precisa ser uma function é só fazer a verificação no script antes de comprar if ((pesoatual + peso_item) <= peso_max) then --Compra end
  7. Não funcionaria da mesma forma sem o if (killer) ?? function rewardOnWasted ( ammo, killer, killerweapon, bodypart ) if ( killer ~= source ) then givePlayerMoney ( killer, 500 ) setPlayerWantedLevel ( killer, 6 ) end end addEventHandler ( "onPlayerWasted", getRootElement(), rewardOnWasted )
  8. Teoricamente existe alguma limitação para os mods do mta? Ou o limite é a criatividade?
  9. Ahhh, é que eu nunca deletei pelo removeAccount, só pelo próprio aplicativo db browser, e no userdata continua tudo.
  10. Não vai ficar nada no userdata? E se ficar, quando criar uma conta ela vai receber os valores antigos das contas deletadas?
  11. Testando com o timer por 2 segundos funcionou perfeitamente!!! Mas vem minha dúvida se eu usar isso no timer: (Gaimo.time[math.random(#Gaimo.time)] * 60000) O timer vai usar isso uma vez ou sempre que a função dele for chamada ele ganha um novo tempo? Script completo: local Gaimo = { -- Minutos time = { 5, 10, 15, 20}, pos = { -- x,y,z {1468.21350, -1738.90234, 13.54688}, {1473.89673, -1725.94067, 13.54688} }, money = { 1000, 2000, 3000 } } function initialFunction() setTimer(function() mainFunction() end, (Gaimo.time[math.random(#Gaimo.time)] * 60000), 1) end addEventHandler("onResourceStart", resourceRoot, initialFunction) function mainFunction() rndPos = Gaimo.pos[math.random(#Gaimo.pos)] rndMoney = Gaimo.money[math.random(#Gaimo.money)] marker = createMarker(rndPos[1], rndPos[2], (rndPos[3] - 0.6), "cylinder", 1.5, 0, 0, 0, 0) blip = createBlipAttachedTo(marker, 0, 2, 255, 255, 255, 255, 0, 250) object = createObject(1550, rndPos[1], rndPos[2], (rndPos[3] - 0.5), 0, 0, 0, true) outputChatBox("#00ff00[SERVER]: #ffffffUma bolsa com dinheiro foi perdida no mapa.", _,255, 255, 255, true) addEventHandler("onMarkerHit", marker, function(thePlayer, dim) if (getElementType(thePlayer) == "player") and not isPedInVehicle(thePlayer) and dim then if ( marker and isElement( marker ) ) then destroyElement( marker ); end if ( blip and isElement( blip ) ) then destroyElement( blip ); end if ( object and isElement( object ) ) then destroyElement( object ); end givePlayerMoney(thePlayer, rndMoney) outputChatBox("#00ff00[SERVER]: #ffffffParabéns #00ffe1" .. getPlayerName(thePlayer) .." #ffffffvocê encontrou: #00ff00R$" .. rndMoney, thePlayer, 255, 255, 255, true) initialFunction() end end) end E na ideia de OTIMIZAÇÃO, ficaria mais otimizado se eu colocasse as variáveis: rndPos = Gaimo.pos[math.random(#Gaimo.pos)] rndMoney = Gaimo.money[math.random(#Gaimo.money)] marker = createMarker(rndPos[1], rndPos[2], (rndPos[3] - 0.6), "cylinder", 1.5, 0, 0, 0, 0) blip = createBlipAttachedTo(marker, 0, 2, 255, 255, 255, 255, 0, 250) object = createObject(1550, rndPos[1], rndPos[2], (rndPos[3] - 0.5), 0, 0, 0, true) Dentro de uma tabela?? ?
  12. Uma dúvida, toda vez que a mainFunction for chamada, as variáveis vão receber um novo valor?
  13. Estou bem feliz de conseguir criar o script quase que por completo, só olhando na wiki, mas não foi dessa vez... O que o script faz, ou deveria fazer, a cada um tempo aleatório, ele vai gerar uma bolsa de dinheiro, um marker e um blip. Se o jogador entrar no marker, ele recebe uma quantia aleatória de dinheiro e aqui encontra-se o problema, deveria deletar tudo, o objeto, marker e blip. as variáveis que criam os elementos (objeto, marker, blip) estão em uma função diferente de onde eu mando deletar. Segue o script: SERVER: local Gaimo = { -- Minutos time = { 5, 10, 15, 20}, pos = { -- x,y,z {1468.21350, -1738.90234, 13.54688}, {1473.89673, -1725.94067, 13.54688} }, money = { 1000, 2000, 3000 } } --(Gaimo.time[math.random(#Gaimo.time)] * 60000) function initialFunction() setTimer(function() mainFunction() end, 2000, 1) end addEventHandler("onResourceStart", resourceRoot, initialFunction) function mainFunction() local rndPos = Gaimo.pos[math.random(#Gaimo.pos)] local rndMoney = Gaimo.money[math.random(#Gaimo.money)] local marker = createMarker(rndPos[1], rndPos[2], (rndPos[3] - 0.6), "cylinder", 1.5, 0, 0, 0, 0) local blip = createBlipAttachedTo(marker, 0, 2, 255, 255, 255, 255, 0, 250) local object = createObject(1550, rndPos[1], rndPos[2], (rndPos[3] - 0.5), 0, 0, 0, true) outputChatBox("#00ff00[SERVER]: #ffffffUma bolsa com dinheiro foi perdida no mapa.", _,255, 255, 255, true) addEventHandler("onPlayerMarkerHit", getRootElement(), function(m) if m == marker and not isPedInVehicle(source) then --destroyElement(marker) --destroyElement(rndPos) --destroyElement(blip) --destroyElement(object) givePlayerMoney(source, rndMoney) outputChatBox("#00ff00[SERVER]: #ffffffParabéns #00ffe1" .. getPlayerName(source) .." #ffffffvocê encontrou: #00ff00R$" .. rndMoney, source, 255, 255, 255, true) initialFunction() end end) end Olhando o script percebi que não vai adiantar destroyElement, na verdade eu preciso arrumar tudo isso em um loop para que toda vez que o loop inicie faça tudo de novo certo? DEBUGSCRIPT > bad argument @ 'destroyElement' [Expected element at argument 1, got table]
  14. Algo parecido com isso eu vi no servidor de pubg, lá você consegue colocar roupas e outros acessórios em vários personagens, incluindo personagens femininos.
  15. Desculpa falta de atenção minha, agora está funcionando o login e register, só falta adicionar uma notificação para o jogador e desativar o painel quando o jogador entra.
  16. Client: local thePlayer = getLocalPlayer() -- O que acontece quando um botão é pressionado addEventHandler ("onClientGUIClick", guiRoot, function() -- Quando clica no botão "login" if source == CEGUI.button["ML_login"] then local g_login = guiGetText(CEGUI.edit["ML_input_login"]) local g_password = guiGetText(CEGUI.edit["ML_input_password"]) -- Se o login for menor que 4 caracteres if ( #g_login >= 4 ) then -- Se a senha é menor que 6 caracteres if ( #g_password >= 6 ) then triggerServerEvent("loginEvent", resourceRoot, thePlayer, g_login, g_password) else outputChatBox("A senha precisa ter no mínimo 6 caracteres!") end else outputChatBox("O login precisa ter no mínimo 4 caracteres!") end -- Quando clica no botão "criar conta" vai para a área de registro elseif source == CEGUI.button["create_account"] then guiSetText(CEGUI.edit["MR_input_login"], guiGetText(CEGUI.edit["ML_input_login"])) guiSetVisible(CEGUI.image["background_login"], false) guiSetVisible(CEGUI.image["background_register"], true) -- Quando clica no botão "voltar" elseif source == CEGUI.button["back"] then guiSetText(CEGUI.edit["ML_input_login"], guiGetText(CEGUI.edit["MR_input_login"])) guiSetVisible(CEGUI.image["background_register"], false) guiSetVisible(CEGUI.image["background_login"], true) -- Quando clica no botão "criar conta" tenta criar a conta elseif source == CEGUI.button["MR_register"] then local g_login = guiGetText(CEGUI.edit["MR_input_login"]) local g_password = guiGetText(CEGUI.edit["MR_input_password"]) local g_password1 = guiGetText(CEGUI.edit["MR_input_password1"]) -- Se o login for menor que 4 caracteres if ( #g_login >= 4 ) then -- Se as senhas forem diferentes if ( g_password == g_password1 ) then -- Se a senha é menor que 6 caracteres if ( #g_password >= 6 ) then triggerServerEvent("createAccountEvent", resourceRoot, g_login, g_password) else outputChatBox("A senha precisa ter no mínimo 6 caracteres!") end else outputChatBox("As senhas não coincidem") end else outputChatBox("O login precisa ter no mínimo 4 caracteres!") end end end) Server: function createAccount(username, password) local account = getAccount ( username, password ) if not account then addAccount(username, password) outputChatBox("Sucess") else outputChatBox("Error") end end addEvent("createAccountEvent", true) addEventHandler("createAccountEvent", resourceRoot, createAccount) function login(thePlayer, username, password) outputChatBox(thePlayer) outputChatBox(username) outputChatBox(password) local account = getAccount ( username, password ) if account then logIn(thePlayer, username, password) outputChatBox("Sucess") else outputChatBox("Error") end end addEvent("loginEvent", true) addEventHandler("loginEvent", resourceRoot, login) Problema: local thePlayer = getLocalPlayer() triggerServerEvent("loginEvent", resourceRoot, thePlayer, g_login, g_password) ---------------------------------------------------------------------------------------------------------------- -- Testei isso também triggerServerEvent("loginEvent", resourceRoot, getLocalPlayer(), g_login, g_password) Como eu passo o jogador que clicou em login para o triggerServerEvent? Aparentemente tudo está funcionando só não consigo enviar o jogador que clicou no botão para o server.
  17. local screenW, screenH = guiGetScreenSize() local x, y = ( screenW/2 ), ( screenH/2 ) local CEGUI = { window = { }, button = { }, edit = { }, label = { }, image = { } } function panel_login() showCursor(true) -- MAIN LOGIN --------------------------------------------------------------------------------------------------------- CEGUI.image["background_login"] = guiCreateStaticImage( 0, 0, screenW, screenH, "files/background.jpg", false ) -- Login CEGUI.button["ML_login"] = guiCreateButton(x-110, y+300, 100, 40, "ENTRAR", false, CEGUI.image["background_login"]) CEGUI.label["ML_login"] = guiCreateLabel(x-109, y+185, 50, 50, "USUÁRIO", false, CEGUI.image["background_login"]) CEGUI.edit["ML_input_login"] = guiCreateEdit(x-110, y+200, 210, 30, "", false, CEGUI.image["background_login"]) guiEditSetMaxLength ( CEGUI.edit["ML_input_login"], 32 ) -- Senha CEGUI.label["ML_password"] = guiCreateLabel(x-109, y+235, 50 , 50, "SENHA", false, CEGUI.image["background_login"]) CEGUI.label["ML_input_password"] = guiCreateEdit(x-110, y+250, 210, 30, "", false, CEGUI.image["background_login"]) guiEditSetMaxLength ( CEGUI.label["ML_input_password"], 32 ) -- Registrar CEGUI.button["create_account"] = guiCreateButton( x, y+300, 100, 40, "CRIAR CONTA", false, CEGUI.image["background_login"]) -- MAIN REGISTER --------------------------------------------------------------------------------------------------------- CEGUI.image["background_register"] = guiCreateStaticImage( 0, 0, screenW, screenH, "files/background.jpg", false ) -- Register CEGUI.button["MR_register"] = guiCreateButton(x-110, y+300, 100, 40, "CRIAR CONTA", false, CEGUI.image["background_register"]) -- Login CEGUI.label["MR_login"] = guiCreateLabel(x-109, y+135, 50, 50, "USUÁRIO", false, CEGUI.image["background_register"]) CEGUI.edit["MR_input_login"] = guiCreateEdit(x-110, y+150, 210, 30, guiGetText(CEGUI.edit["ML_input_login"]), false, CEGUI.image["background_register"]) guiEditSetMaxLength ( CEGUI.edit["MR_input_login"], 32 ) -- Senha CEGUI.label["MR_password"] = guiCreateLabel(x-109, y+185, 50 , 50, "SENHA", false, CEGUI.image["background_register"]) CEGUI.edit["MR_input_password"] = guiCreateEdit(x-110, y+200, 210, 30, "", false, CEGUI.image["background_register"]) guiEditSetMaxLength ( CEGUI.edit["MR_input_password"], 32 ) CEGUI.label["MR_password1"] = guiCreateLabel(x-109, y+235, 150 , 50, "CONFIRMAR SENHA", false, CEGUI.image["background_register"]) CEGUI.edit["MR_input_password1"] = guiCreateEdit(x-110, y+250, 210, 30, "", false, CEGUI.image["background_register"]) guiEditSetMaxLength ( CEGUI.edit["MR_input_password1"], 32 ) -- Voltar CEGUI.button["back"] = guiCreateButton( x, y+300, 100, 40, "VOLTAR", false, CEGUI.image["background_register"]) guiSetVisible(CEGUI.image["background_register"], false) -- O que acontece quando um botão é pressionado addEventHandler ("onClientGUIClick", guiRoot, function() if source == CEGUI.button["create_account"] then guiSetVisible(CEGUI.image["background_login"], false) guiSetVisible(CEGUI.image["background_register"], true) elseif source == CEGUI.button["back"] then guiSetVisible(CEGUI.image["background_register"], false) guiSetVisible(CEGUI.image["background_login"], true) end end) end addEventHandler("onClientResourceStart", root, panel_login) Imagino que o problema de nomes repetidos foi resolvido agora kkkkkkk Posso usar o mesmo em tabelas diferentes né ? CEGUI.button["ML_login"] = guiCreateButton(x-110, y+300, 100, 40, "ENTRAR", false, CEGUI.image["background_login"]) CEGUI.label["ML_login"] = guiCreateLabel(x-109, y+185, 50, 50, "USUÁRIO", false, CEGUI.image["background_login"]) Uma é CEGUI.button a outra CEGUI.label. Testei pegar o que o usuário digitou no login para passar para o login do register mas não funcionou, ele só pega o que está dentro das aspas: CEGUI.edit["ML_input_login"] = guiCreateEdit(x-110, y+200, 210, 30, "", false, CEGUI.image["background_login"]) CEGUI.edit["MR_input_login"] = guiCreateEdit(x-110, y+150, 210, 30, guiGetText(CEGUI.edit["ML_input_login"]), false, CEGUI.image["background_register"]) Mas ele já cria o edit com o que tem dentro das aspas antes de o usuário digitar qualquer coisa. Existe uma maneira de só editar o CEGUI.edit["ML_input_login"] em vez de criar ele novamente? Ou eu teria que deletar e criar ele? Pra ele "atualizar".
  18. Imaginei que isso estava acontecendo, para resolver fiz diferente, coloquei tudo em uma única função. Já que é pra fazer altamente otimizado, AMO OTIMIZAÇÃO! Quando o jogador logar eu preciso deletar todos os elementos criados né? script atual: local screenW, screenH = guiGetScreenSize() local x, y = ( screenW/2 ), ( screenH/2 ) local CEGUI = { window = { }, button = { }, edit = { }, label = { }, image = { } } function panel_login() showCursor(true) -- MAIN LOGIN --------------------------------------------------------------------------------------------------------- CEGUI.image["background_login"] = guiCreateStaticImage( 0, 0, screenW, screenH, "files/background.jpg", false ) -- Login CEGUI.button["login"] = guiCreateButton(x-110, y+300, 100, 40, "ENTRAR", false, CEGUI.image["background_login"]) CEGUI.label["login"] = guiCreateLabel(x-109, y+185, 50, 50, "USUÁRIO", false, CEGUI.image["background_login"]) CEGUI.edit["input_login"] = guiCreateEdit(x-110, y+200, 210, 30, "", false, CEGUI.image["background_login"]) guiEditSetMaxLength ( CEGUI.edit["input_login"], 32 ) -- Senha CEGUI.label["password"] = guiCreateLabel(x-109, y+235, 50 , 50, "SENHA", false, CEGUI.image["background_login"]) CEGUI.label["input_password"] = guiCreateEdit(x-110, y+250, 210, 30, "", false, CEGUI.image["background_login"]) guiEditSetMaxLength ( CEGUI.label["input_password"], 32 ) -- Registrar CEGUI.button["create_account"] = guiCreateButton( x, y+300, 100, 40, "CRIAR CONTA", false, CEGUI.image["background_login"]) -- MAIN REGISTER --------------------------------------------------------------------------------------------------------- CEGUI.image["background_register"] = guiCreateStaticImage( 0, 0, screenW, screenH, "files/background.jpg", false ) -- Register CEGUI.button["register"] = guiCreateButton(x-110, y+300, 100, 40, "CRIAR CONTA", false, CEGUI.image["background_register"]) -- Login CEGUI.label["login"] = guiCreateLabel(x-109, y+135, 50, 50, "USUÁRIO", false, CEGUI.image["background_register"]) CEGUI.edit["input_login"] = guiCreateEdit(x-110, y+150, 210, 30, "", false, CEGUI.image["background_register"]) guiEditSetMaxLength ( CEGUI.edit["input_login"], 32 ) -- Senha CEGUI.label["password"] = guiCreateLabel(x-109, y+185, 50 , 50, "SENHA", false, CEGUI.image["background_register"]) CEGUI.edit["input_password"] = guiCreateEdit(x-110, y+200, 210, 30, "", false, CEGUI.image["background_register"]) guiEditSetMaxLength ( CEGUI.edit["input_password"], 32 ) CEGUI.label["password1"] = guiCreateLabel(x-109, y+235, 150 , 50, "CONFIRMAR SENHA", false, CEGUI.image["background_register"]) CEGUI.edit["input_password1"] = guiCreateEdit(x-110, y+250, 210, 30, "", false, CEGUI.image["background_register"]) guiEditSetMaxLength ( CEGUI.edit["input_password1"], 32 ) -- Voltar CEGUI.button["back"] = guiCreateButton( x, y+300, 100, 40, "VOLTAR", false, CEGUI.image["background_register"]) guiSetVisible(CEGUI.image["background_register"], false) -- O que acontece quando um botão é pressionado addEventHandler ("onClientGUIClick", guiRoot, function() if source == CEGUI.button["create_account"] then guiSetVisible(CEGUI.image["background_login"], false) guiSetVisible(CEGUI.image["background_register"], true) elseif source == CEGUI.button["back"] then guiSetVisible(CEGUI.image["background_register"], false) guiSetVisible(CEGUI.image["background_login"], true) end end) end addEventHandler("onClientResourceStart", root, panel_login) Agora ficou MUITO RÁPIDO, a troca do login para o register!! Preciso aprender a criar um sistema de notificação, vou procurar uns aqui para ver como eles funcionam. Ou aprender a usar o interpolateBetween como o Lord Henry sugeriu.
  19. Código atual: local screenW, screenH = guiGetScreenSize() local x, y = ( screenW/2 ), ( screenH/2 ) local CEGUI = { window = { }, button = { }, edit = { }, label = { }, image = { } } function login() --showChat(not isChatVisible()) showCursor(true)-- Mostre o cursor se ele não está aparecendo CEGUI.image["background"] = guiCreateStaticImage( 0, 0, screenW, screenH, "files/background.jpg", false ) -- Login CEGUI.button["login"] = guiCreateButton(x-110, y+300, 100, 40, "ENTRAR", false, CEGUI.image["background"]) CEGUI.label["login"] = guiCreateLabel(x-109, y+185, 50, 50, "USUÁRIO", false, CEGUI.image["background"]) CEGUI.edit["input_login"] = guiCreateEdit(x-110, y+200, 210, 30, "", false, CEGUI.image["background"]) guiEditSetMaxLength ( CEGUI.edit["input_login"], 32 ) -- Senha CEGUI.label["password"] = guiCreateLabel(x-109, y+235, 50 , 50, "SENHA", false, CEGUI.image["background"]) CEGUI.label["input_password"] = guiCreateEdit(x-110, y+250, 210, 30, "", false, CEGUI.image["background"]) guiEditSetMaxLength ( CEGUI.label["input_password"], 32 ) -- Registrar CEGUI.button["create_account"] = guiCreateButton( x, y+300, 100, 40, "CRIAR CONTA", false, CEGUI.image["background"]) addEventHandler ("onClientGUIClick", guiRoot, function() if (source == CEGUI.button["create_account"]) then createAccount() end end) end addEventHandler("onClientResourceStart", root, login) function createAccount() showCursor(true) CEGUI.image["background"] = guiCreateStaticImage( 0, 0, screenW, screenH, "files/background.jpg", false ) -- Register CEGUI.button["register"] = guiCreateButton(x-110, y+300, 100, 40, "CRIAR CONTA", false, CEGUI.image["background"]) -- Login CEGUI.label["login"] = guiCreateLabel(x-109, y+135, 50, 50, "USUÁRIO", false, CEGUI.image["background"]) CEGUI.edit["input_login"] = guiCreateEdit(x-110, y+150, 210, 30, "", false, CEGUI.image["background"]) guiEditSetMaxLength ( CEGUI.edit["input_login"], 32 ) -- Senha CEGUI.label["password"] = guiCreateLabel(x-109, y+185, 50 , 50, "SENHA", false, CEGUI.image["background"]) CEGUI.edit["input_password"] = guiCreateEdit(x-110, y+200, 210, 30, "", false, CEGUI.image["background"]) guiEditSetMaxLength ( CEGUI.edit["input_password"], 32 ) CEGUI.label["password1"] = guiCreateLabel(x-109, y+235, 150 , 50, "CONFIRMAR SENHA", false, CEGUI.image["background"]) CEGUI.edit["input_password1"] = guiCreateEdit(x-110, y+250, 210, 30, "", false, CEGUI.image["background"]) guiEditSetMaxLength ( CEGUI.edit["input_password1"], 32 ) -- Voltar CEGUI.button["back"] = guiCreateButton( x, y+300, 100, 40, "VOLTAR", false, CEGUI.image["background"]) addEventHandler ("onClientGUIClick", guiRoot, function() if (source == CEGUI.button["back"]) then login() end end) end Qual a maneira correta de fazer para trocar do login para o register? Porque assim está travando muito, se ir do login para o register e voltar umas duas vezes começa um baita lag. Muito bom essa de usar tabela, gostei!! Eu usei porque tu me passou em um outro script hahaha, mas agora aprendi a diferença de cada um. No começo eu não entendia muito bem o source, agora já peguei bem o que é, já o root eu ainda estou com dificuldade, só root trata-se do jogador?
  20. Como é para estudo, por que não começar pelo mais fácil né?! Então passei para CEGUI, até fiz tudo na mão, sem usar o guieditor!! Aqui está o código: Como ficou o login: Como ficou o register: Agora vem o meu problema, como eu verifico se o usuário digitou alguma coisa no login e senha? Testei isso: addEventHandler ("onClientGUIClick", guiRoot, function() if (source == bLogin) then if login == nil then outputChatBox("LOGIN NIL") else outputChatBox("ERROR") end end end) Mas retorna ERROR, testei no lugar de nil > "" e também retorna ERROR Outro problema é, vou precisar criar um sistema de notificação, já que o chat vai ser desativado, mas isso eu aprendo depois haha. Por enquanto o problema principal é detectar se o usuário digitou algo ou não.
  21. Bateu uma vontade de criar um painel de login, ̶E̶U̶ ̶T̶E̶N̶H̶O̶ ̶Q̶U̶E̶ ̶C̶O̶N̶S̶E̶G̶U̶I̶R̶ ̶C̶R̶I̶A̶R̶ ̶U̶M̶ ̶P̶A̶I̶N̶E̶L̶ ̶D̶E̶ ̶L̶O̶G̶I̶N̶ Estou louco para conseguir criar tudo o que eu penso, mas ainda me falta conhecimento e pratica, então aqui estou para pedir ajuda. Por eu estar começando seria melhor eu fazer em CEGUI ou posso continuar com o DX que é o que eu estou usando? Não sei exatamente como começar e nem quais funções usar. Por enquanto está assim: local screenW, screenH = guiGetScreenSize() local x, y = ( screenW/2 ), ( screenH/2 ) -- Janela principal do painel de login function mainLogin() showCursor(true) local background = dxDrawImage(0, 0, screenW, screenH, "files/background.jpg") local mainWindow = dxDrawImage(x - 166, y - 220, 332, 440, "files/main.png") local bLogin = dxDrawImage(x - 166, y + 60, 332, 45, "files/button.png", 0, 0, 0, tocolor(255,81,81,255)) local tLogin = dxDrawText("LOGIN",x - 40, y + 65, _, _, _, 2, "clear") local tText = dxDrawText("Não tem uma conta?",x - 45, y + 115, _, _, _, _, "clear") local tRegister = dxDrawText("Registre-se",x + 90, y + 115, _, _, tocolor(0,0,0,255), _, "deafault-bold") end addEventHandler("onClientRender", root, mainLogin) Imagino que eu tenho que usar no server onPlayerJoin ou "onPlayerConnect" e usar um triggerClientEvent, para chamar o Painel de login certo? Mas temporariamente até construir o painel vou deixar assim.... Funções que eu não achei: GuiCreateEdit só que em DX, se eu entendi certo o usuário digita ali e eu posso usar o que ele digitou né? Então eu crio duas variáveis, no caso login e senha. e uso no getAccount(login,senha) Vou ter que criar mais uma na parte do register, no caso senha e senha1 e verificar se as duas estão igual. Deixar a imagem de fundo embaçada. Como eu pensei em fazer: Criar duas function, login e register A login eu chamo no onPlayerJoin/Connect não sei qual das duas, e a register quando aperta no texto registre-se. Então vem a parte que pode ser difícil, é complicado fazer uma animação?? Tipo um flip do login para o register? Aceito sugestões!!
  22. Funcionou!! Agora está 100% o script. OBRIGADO a todos que enviaram suas respostas. ?
  23. Não funcionou, e não entendi nada do script, tipo por que tem veh e tableVeh? Se só tem a tableVeh? veh = createVehicle(tableVeh[1], tableVeh[2], tableVeh[3], tableVeh[4]) Não marquei todos os erros, mas o primeiro foi que tem umas bolinhas vermelhas no código, sim!!! Se tu copiar seu código e colocar de novo em uma caixa de código vai ver umas bolinhas vermelhas, da bug aquilo no mta, depois de um tempo fui entender o erro no mta, só aparecia que faltava um "=" mas era porque tinha uma bolinha vermelha. ESSAS BOLINHAS ↓ Clique para abrir o código. end   Depois deu uns outros erros, mas como eu não estava entendendo o código, resolvi aproveitar umas partes e tentar fazer o meu... table = {} -- armazena os jogadores que tem acesso as bikes marker = createMarker(1505.57727, -1750.79688, 12.6, "cylinder", 1, 255, 100, 0, 100) addEventHandler("onPlayerMarkerHit", root, function(m) if m == marker and not isPedInVehicle(source) then -- se o jogador entrar no marker exports.dxmsgs:outputDx(source, "Use o comando /alugarbike para ter acesso as uma bikes, custo R$50.", "info") end end) addCommandHandler ("alugarbike", function(thePlayer) if not table.thePlayer and isElementWithinMarker(thePlayer, marker) then --se o jogador não está na tabela então... if getPlayerMoney(thePlayer) >= 50 then takePlayerMoney(thePlayer, 50) table.thePlayer = setTimer(function() removeTempOwner() end, 10000, 1) exports.dxmsgs:outputDx(thePlayer, "Você pode usar as bikes por dez SEGUNDOS.", "success") else exports.dxmsgs:outputDx(thePlayer, "Você não tem dinheiro suficiente.", "error") end end end) function isTempOwner(thePlayer) if not table.thePlayer then -- se o jogador não está na tabela não pode usar as bikes exports.dxmsgs:outputDx(thePlayer, "Você precisa alugar uma bike para poder usá-la", "error") cancelEvent() end end veh = { createVehicle(481, 1505.42102, -1753.69446, 13.54688), createVehicle(481, 1505.42102 +1, -1753.69446, 13.54688), createVehicle(481, 1505.42102 +2, -1753.69446, 13.54688), createVehicle(481, 1505.42102 +3, -1753.69446, 13.54688), createVehicle(481, 1505.42102 +4, -1753.69446, 13.54688), createVehicle(481, 1505.42102 +5, -1753.69446, 13.54688), createVehicle(481, 1505.42102 +6, -1753.69446, 13.54688), createVehicle(481, 1505.42102 +7, -1753.69446, 13.54688), createVehicle(481, 1505.42102 +8, -1753.69446, 13.54688), createVehicle(481, 1505.42102 +9, -1753.69446, 13.54688), } for i, v in ipairs(veh) do addEventHandler("onVehicleStartEnter", v, isTempOwner) local px, py, pz = getElementPosition(v) local rx, ry, rz = getElementRotation(v) setVehicleRespawnPosition(v, px, py, pz, rx, ry, rz) end function respawnVehicles() for i, v in ipairs(veh) do if not getVehicleOccupant(v, 0) then respawnVehicle(v) setElementHealth(v, 1000) end end end setTimer(respawnVehicles, 60000, 0) function removeTempOwner(thePlayer) if table.thePlayer then table.thePlayer = nil end end addEventHandler( "onPlayerQuit", root, removeTempOwner) Mas faltou enviar a mensagem para o jogador que o tempo dele acabou e retirar ele do veículo se é da tabela veh ={} Então pensei nisso: addCommandHandler ("alugarbike", function(thePlayer) if not table.thePlayer and isElementWithinMarker(thePlayer, marker) then --se o jogador não está na tabela então... if getPlayerMoney(thePlayer) >= 50 then takePlayerMoney(thePlayer, 50) ------------------------------------------------------------------------------------------------------------------------------ local tempPlayer = thePlayer table.thePlayer = setTimer( function(tempPlayer) removeTempOwner(tempPlayer) exports.dxmsgs:outputDx(tempPlayer, "Seu tempo para usar as bikes acabou.", "warning") end, 10000, 1) ------------------------------------------------------------------------------------------------------------------------------ exports.dxmsgs:outputDx(thePlayer, "Você pode usar as bikes por dez minutos.", "success") else exports.dxmsgs:outputDx(thePlayer, "Você não tem dinheiro suficiente.", "error") end end end) Não consigo mandar o player para dentro do timer. Mas eu perco acesso as bikes depois dos 10 segundos do timer. function removeTempOwner(thePlayer) if table.thePlayer then table.thePlayer = nil local tempVeh = getPedOccupiedVehicle(thePlayer) if tempVeh then --and tempVeh == Como eu detecto se o veículo pertence a tabela veh? removePedFromVehicle(thePlayer) end end end Como eu faço para detectar se o veículo é da tabela veh? if tempVeh and tempVeh == Como eu detecto se o veículo pertence a tabela veh? then Script completo table = {} -- armazena os jogadores que tem acesso as bikes marker = createMarker(1505.57727, -1750.79688, 12.6, "cylinder", 1, 255, 100, 0, 100) addEventHandler("onPlayerMarkerHit", root, function(m) if m == marker and not isPedInVehicle(source) then -- se o jogador entrar no marker exports.dxmsgs:outputDx(source, "Use o comando /alugarbike para ter acesso as uma bikes, custo R$50.", "info") end end) addCommandHandler ("alugarbike", function(thePlayer) if not table.thePlayer and isElementWithinMarker(thePlayer, marker) then --se o jogador não está na tabela então... if getPlayerMoney(thePlayer) >= 50 then takePlayerMoney(thePlayer, 50) local tempPlayer = thePlayer table.thePlayer = setTimer( function(tempPlayer) removeTempOwner(tempPlayer) exports.dxmsgs:outputDx(tempPlayer, "Seu tempo para usar as bikes acabou.", "warning") end, 10000, 1) exports.dxmsgs:outputDx(thePlayer, "Você pode usar as bikes por dez minutos.", "success") else exports.dxmsgs:outputDx(thePlayer, "Você não tem dinheiro suficiente.", "error") end end end) function isTempOwner(thePlayer) if not table.thePlayer then -- se o jogador não está na tabela não pode usar as bikes exports.dxmsgs:outputDx(thePlayer, "Você precisa alugar uma bike para poder usá-la", "error") cancelEvent() end end veh = { createVehicle(481, 1505.42102, -1753.69446, 13.54688), createVehicle(481, 1505.42102 +1, -1753.69446, 13.54688), createVehicle(481, 1505.42102 +2, -1753.69446, 13.54688), createVehicle(481, 1505.42102 +3, -1753.69446, 13.54688), createVehicle(481, 1505.42102 +4, -1753.69446, 13.54688), createVehicle(481, 1505.42102 +5, -1753.69446, 13.54688), createVehicle(481, 1505.42102 +6, -1753.69446, 13.54688), createVehicle(481, 1505.42102 +7, -1753.69446, 13.54688), createVehicle(481, 1505.42102 +8, -1753.69446, 13.54688), createVehicle(481, 1505.42102 +9, -1753.69446, 13.54688), } for i, v in ipairs(veh) do addEventHandler("onVehicleStartEnter", v, isTempOwner) local px, py, pz = getElementPosition(v) local rx, ry, rz = getElementRotation(v) setVehicleRespawnPosition(v, px, py, pz, rx, ry, rz) end function respawnVehicles() for i, v in ipairs(veh) do if not getVehicleOccupant(v, 0) then respawnVehicle(v) setElementHealth(v, 1000) end end end setTimer(respawnVehicles, 60000, 0) function removeTempOwner(thePlayer) if table.thePlayer then table.thePlayer = nil local tempVeh = getPedOccupiedVehicle(thePlayer) if tempVeh then --and tempVeh == Como eu detecto se o veículo pertence a tabela veh? removePedFromVehicle(thePlayer) end end end addEventHandler( "onPlayerQuit", root, function(thePlayer) if table.thePlayer then table.thePlayer = nil end end)
×
×
  • Create New...