Jump to content

Upload locals with c-side to s-side


Dzemous

Recommended Posts

Hello guys! I doing panel registration. How I can upload text with EditBox with c-side to s-side?  When player click button "Registration" then script must take Login and Password with EditBox and s-side must does function addAccount .

This is snippet code c-side:

				local DaneR_Login = guiGetText (GUIREGISTER.Places_R_Register[1])        --Getting login with editbox
				local DaneR_Passy = guiGetText (GUIREGISTER.Places_R_Register[2])       --Getting  password with edibot
	

				local StworzKonto = triggerServerEvent ("StworzKonto", getLocalPlayer ())  --trigger (addaccount)
					if StworzKonto then
					outputChatBox ("Pomyślnie utworzono konto o nazwie: "..DaneR_Login)   --If s-side addAccount 
					else 
					outputChatBox ("Nie udało się utworzyć konta") --if not addAccount
					end
			end
		end
	end
end
addEventHandler ("onClientGUIClick", root, CreateAccountPlayer)

S-side

function StworzKontoWBazieDanych()
addAccount ('DaneR_Login', 'DaneR_Passy')  --DaneR_Login and DaneR_Passy this are local with c-side. They getting login and password with editbox.
end
addEvent("StworzKonto",true)
addEventHandler("StworzKonto", getRootElement(), StworzKontoWBazieDanych)

0 db. How I can upload this locals? :/

Link to comment
14 hours ago, Dzemous said:

Hello guys! I doing panel registration. How I can upload text with EditBox with c-side to s-side?  When player click button "Registration" then script must take Login and Password with EditBox and s-side must does function addAccount .

This is snippet code c-side:


				local DaneR_Login = guiGetText (GUIREGISTER.Places_R_Register[1])        --Getting login with editbox
				local DaneR_Passy = guiGetText (GUIREGISTER.Places_R_Register[2])       --Getting  password with edibot
	

				local StworzKonto = triggerServerEvent ("StworzKonto", getLocalPlayer ())  --trigger (addaccount)
					if StworzKonto then
					outputChatBox ("Pomyślnie utworzono konto o nazwie: "..DaneR_Login)   --If s-side addAccount 
					else 
					outputChatBox ("Nie udało się utworzyć konta") --if not addAccount
					end
			end
		end
	end
end
addEventHandler ("onClientGUIClick", root, CreateAccountPlayer)

S-side


function StworzKontoWBazieDanych()
addAccount ('DaneR_Login', 'DaneR_Passy')  --DaneR_Login and DaneR_Passy this are local with c-side. They getting login and password with editbox.
end
addEvent("StworzKonto",true)
addEventHandler("StworzKonto", getRootElement(), StworzKontoWBazieDanych)

0 db. How I can upload this locals? :/

Try this 

 

  1. function onLogin()
    	showChat(true) -You can show or not with changing (true) to (false)
    	showCursor(false)
    	removeEventHandler("onClientRender", root, paint)
    	removeEventHandler("onClientClick",root,onClientClick)
    	removeEventHandler("onClientCharacter",root,onClientCharacter)
                    local DaneR_Login = guiGetText (GUIREGISTER.Places_R_Register[1])        --Getting login with editbox
    				local DaneR_Passy = guiGetText (GUIREGISTER.Places_R_Register[2])       --Getting  password with edibot
    	
    
    				local StworzKonto = triggerServerEvent ("StworzKonto", getLocalPlayer ())  --trigger (addaccount)
    					if StworzKonto then
    					outputChatBox ("Pomyślnie utworzono konto o nazwie: ""..name..")   --If s-side addAccount 
    					else
                        setElementGetAccount = "(_)("acc")"
                        triggerServerEvent("onRequestLogin",localPlayer,g.user.text,g.pass.text)
    					outputChatBox ("Nie udało się utworzyć konta") --if not Player get registered
    				end
    			end
    		end
    	end
    end
    addEvent("onLogin", true)
    addEventHandler("onLogin", localPlayer, onLogin)

     

 

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