Padul Posted June 5, 2016 Share Posted June 5, 2016 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
Bonsai Posted June 5, 2016 Share Posted June 5, 2016 You didn't mention what problem you have exactly, Errors etc. Link to comment
Padul Posted June 5, 2016 Author Share Posted June 5, 2016 I havent any errors in console, so i paste my code here to check it. Problem is in triggers i think because when i modified them, script doesnt work good ;c Link to comment
Bean666 Posted June 5, 2016 Share Posted June 5, 2016 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
Padul Posted June 5, 2016 Author Share Posted June 5, 2016 (edited) 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 June 5, 2016 by Guest Link to comment
Bean666 Posted June 5, 2016 Share Posted June 5, 2016 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
Padul Posted June 5, 2016 Author Share Posted June 5, 2016 still not working, i changed all getRootElement() to source and nothing. Im really tired of this code. I tried to repair it all night There is a problem in triggers but i dont know whats wrong... Link to comment
Bean666 Posted June 5, 2016 Share Posted June 5, 2016 i think the problem is in client have you tried to change the current triggerServerEvents to the ones i sent? anyways please use /debugscript 3 and tell us your errors. Link to comment
Padul Posted June 5, 2016 Author Share Posted June 5, 2016 Yes, i changed all triggers in client and nothing. In debugscript i havent any errors Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now