Jump to content

big triggers problem


Padul

Recommended Posts

Hello, i have big problem with this f**** script. This one is my own script, but i dont understand triggers ;c

I need your help. Could u tell me, whats wrong there?

SERVER-SIDE

----------------------------------- [ WERYFIKACJA KONTA ]  
function weryfikacja(serial) 
    local q=dbQuery(db,"SELECT * FROM users WHERE serial='?'",serial) 
    local r,num_rows=dbPoll(q,-1) 
    if r then 
        if num_rows>0 then 
            triggerClientEvent(client,"onLogin",source) 
        else 
            triggerClientEvent(client,"onRegister",source) 
        end 
    end 
end 
addEvent("weryfikacja",true) 
addEventHandler("weryfikacja",getRootElement(),weryfikacja) 
----------------------------------------------------------------------------------------- 
  
----------------------------------- [ ZAKŁADANIE KONTA ] 
function zarejestrujGracza(pass,serial) 
    if(pass) then  
        local md5pass=md5(pass)  
        if (string.len(pass) >= 5) then 
        local serial=getPlayerSerial(source) 
        playerRegister(serial,md5pass,pass,source) 
                triggerClientEvent(source,"zalogowanyGracz",getRootElement()) 
        else 
                triggerClientEvent(source,"registerShortPass",getRootElement()) 
        end   
    end 
end 
addEvent("zarejestrujGracza",true) 
addEventHandler("zarejestrujGracza",getRootElement(),zarejestrujGracza) 
----------------------------------------------------------------------------------------- 
  
----------------------------------- [ LOGOWANIE GRACZA ] 
function zalogujGracza(pass,serial) 
    if(pass) then  
        local md5pass=md5(pass)  
        local q=dbQuery(db,"SELECT * FROM users WHERE serial='"..serial.."' AND pass='"..md5pass.."'") 
    local r,num_rows=dbPoll(q,-1) 
    if r then 
        if num_rows>0 then 
            playerLogin(serial,source) 
                    triggerClientEvent(source,"zalogowanyGracz",getRootElement()) 
        else 
                    triggerClientEvent(source,"loginBadPass",getRootElement()) 
        end 
    end 
    end 
end 
addEvent("zalogujGracza",true) 
addEventHandler("zalogujGracza",getRootElement(),zalogujGracza) 
----------------------------------------------------------------------------------------- 

CLIENT-SIDE

function wymuszacz() 
    fadeCamera(true,0,0,0,0) 
    showCursor(true) 
    showChat(false) 
    showPlayerHudComponent("all",false) 
    guiSetInputMode("no_binds_when_editing") 
    guiSetVisible(statsWindows,false) 
  
    triggerServerEvent("weryfikacja",getLocalPlayer(),getPlayerSerial(getLocalPlayer())) 
end 
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),wymuszacz) 
  
function panelRegister() 
    guiSetVisible(LogRegWin[1],true) 
    guiSetInputEnabled(true) 
    addEventHandler("onClientGUIClick",LogRegButton[1],wcisnalRegister) 
end 
addEvent("onRegister",true) 
addEventHandler("onRegister",getRootElement(),panelRegister) 
  
function panelLogin() 
    guiSetVisible(LogRegWin[2],true) 
    guiSetInputEnabled(true) 
    addEventHandler("onClientGUIClick",LogRegButton[2],wcisnalLogin) 
end 
addEvent("onLogin",true) 
addEventHandler("onLogin",getRootElement(),panelLogin) 
  
function wcisnalRegister(button,state) 
    if(button == "left" and state == "up") then 
        if (source == LogRegButton[1]) then 
            if(guiCheckBoxGetSelected(LogRegCheckbox[1]))then 
                triggerServerEvent("zarejestrujGracza",getLocalPlayer(),guiGetText(LogRegEdit[1]),getPlayerSerial(getLocalPlayer())) 
            else 
                guiSetText(LogRegLabel[1],"Please, accept conditions and terms!") 
            end 
        end 
    end 
end 
  
function wcisnalLogin(button,state) 
    if(button == "left" and state == "up") then 
        if (source == LogRegButton[2]) then 
            if(guiCheckBoxGetSelected(LogRegCheckbox[1]))then 
                triggerServerEvent("zalogujGracza",getLocalPlayer(),guiGetText(LogRegEdit[1]),getPlayerSerial(getLocalPlayer())) 
            else 
                guiSetText(LogRegLabel[1],"Please, accept conditions and terms!") 
            end 
        end 
    end 
end 
  
addEvent("zalogowanyGracz", true) 
addEventHandler("zalogowanyGracz",getRootElement(), function() 
    showCursor(false) 
    showChat(true) 
    guiSetVisible(LogRegWin[1],false) 
    guiSetVisible(LogRegWin[2],false) 
    guiSetInputEnabled(false) 
    guiSetVisible(statsWindows,true) 
    fadeCamera(true,3.0) 
end) 
  
addEvent("registerShortPass",true) 
addEventHandler("registerShortPass",getRootElement(),function() 
    guiSetText(LogRegLabel[1],"Password length min. 5 letters!") 
    guiSetText(LogRegEdit[1],"") 
end) 
  
addEvent("loginBadPass",true) 
addEventHandler("loginBadPass",getRootElement(),function() 
    guiSetText(LogRegLabel[1],"Wrong password!") 
    guiSetText(LogRegEdit[1],"") 
end) 

Link to comment

in serverside..

do not put "client" . put "source or whatever the element is"

example:

triggerClientEvent(source, "eventname", source) 

and in serverside

try this:

triggerServerEvent("zalogujGracza",getLocalPlayer(),guiGetText(LogRegEdit[1]),getPlayerSerial(getLocalPlayer()),zalogujGracza) 

triggerServerEvent("weryfikacja",getLocalPlayer(),getPlayerSerial(getLocalPlayer()),weryfikacja) 

Link to comment

ok, i changed "client" to "source" and your triggers but still doesnt work

in console

DIAGNOSTIC: RajzeN[t] #1002 HTTP server file mismatch (script) login_c.lua [Got size:0 MD5:00000000000000000000000000000000, wanted MD5:F1CBE4341269F87AC0870C893F5621DB] 

Edited by Guest
Link to comment

try changing

triggerClientEvent(source,"zalogowanyGracz",getRootElement()) 

all getRootElement() with source

example:

triggerClientEvent( source, "zalogowanyGracz", source ) 

anyways if it's still not working i don't know if its the triggers that cause the prob.

Link to comment

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...