Jump to content

ajuda aqui pf (IF)


Recommended Posts

Posted

gostaria de puxar um local ou global sei la .... tipo esse codigo aqui :

client.lua

function testarsenha() 
    senhausada = guiGetText(SenhaUsada, painelsenhadogerenciador) 
    triggerServerEvent("testedogerenciador", getLocalPlayer()) 
end 

server.lua

function teste() 
    if (SenhaDoGerenciador == senhausada) then 
        triggerClientEvent(source, "GuiOkGerenciador", getRootElement()) 
    else 
        outputChatBox("#ff0000Senha Incorreta", source, 255, 0, 0, true) 
    end 
end 
addEvent("testedogerenciador",true) 
addEventHandler("testedogerenciador", getRootElement(), teste) 

o meu objetivo é que if (SenhaDoGerenciador == senhausada) funcione no server.lua

Posted

É só você passar senhausada (tenha certeza que isso retorna o valor correto) no triggerServerEvent, assim:

--Client: 
triggerServerEvent("testedogerenciador", getLocalPlayer(), senhausada) 
  
-- Server: 
function teste(senha) -- o parâmetro é passado para a função definida no addEventHandler. 

Posted
no server coloco function teste(senha) ou function teste(senhausada) ??

Tanto faz, mais se você usar senha (igual no meu exemplo) você terá que fazer a checagem dessa forma:

if (SenhaDoGerenciador == senha) then 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...