micheal1230 Posted June 20, 2012 Posted June 20, 2012 Well I have To Bring Some Args. From Clientside But I Also Need The thePlayer Arg So How Would I Do This The Args Are guiGetText(register_Edit[1]), guiGetText(register_Edit[2]) server: addEvent("account:register", true) function registeraccount(user, pass) local addedTheAccount = addAccount(user, pass) if ( addedTheAccount ) then outputChatBox("Thank You For Registering!", player,0,255,0) outputChatBox("Your Username Is ".. user .."", player, 255,150,0) outputChatBox("Your Password Is ".. pass .."", player, 255,150,0) else outputChatBox("Failed To Register!", player, 255, 0, 0) end end addEventHandler("account:register", getRootElement(), registeraccount) addEvent("account:login", true) function loginaccount(user, pass) local logged = setElementData(player, "logged", 1) local loggingin = logIn(player ,user, pass) if ( loggingin ) then outputChatBox("You Have Sucessfully Logged In!", player,0,255,0) end end addEventHandler("account:login", getRootElement(), loginaccount) client: addEventHandler('onClientGUIClick',login_Button[1], function() triggerServerEvent('account:login',localPlayer,guiGetText(register_Edit[1]), guiGetText(register_Edit[2])) guiSetVisible( register_Window[1], false ) guiSetVisible( login_Window[1], false ) showCursor( false ) end )
DiSaMe Posted June 20, 2012 Posted June 20, 2012 Second argument in triggerServerEvent is the source of event, so you need to replace "player" with "source" in the server-side script.
micheal1230 Posted June 20, 2012 Author Posted June 20, 2012 Second argument in triggerServerEvent is the source of event, so you need to replace "player" with "source" in the server-side script. Same thing expected player @ arg 1 got nil
Guest Guest4401 Posted June 20, 2012 Posted June 20, 2012 server addEvent("account:register", true) function registeraccount(user, pass) local addedTheAccount = addAccount(user, pass) if ( addedTheAccount ) then outputChatBox("Thank You For Registering!", source,0,255,0) outputChatBox("Your Username Is ".. user .."", source, 255,150,0) outputChatBox("Your Password Is ".. pass .."", source, 255,150,0) else outputChatBox("Failed To Register!", source, 255, 0, 0) end end addEventHandler("account:register", getRootElement(), registeraccount) addEvent("account:login", true) function loginaccount(user, pass) local logged = setElementData(source, "logged", 1) local loggingin = logIn(source ,user, pass) if ( loggingin ) then outputChatBox("You Have Sucessfully Logged In!", source,0,255,0) end end addEventHandler("account:login", getRootElement(), loginaccount) client addEventHandler('onClientGUIClick',login_Button[1], function() triggerServerEvent('account:login',localPlayer,guiGetText(register_Edit[1]), guiGetText(register_Edit[2])) guiSetVisible( register_Window[1], false ) guiSetVisible( login_Window[1], false ) showCursor( false ) end )
TwiX! Posted June 20, 2012 Posted June 20, 2012 function registeraccount(user, pass) local addedTheAccount = addAccount(user, pass) if ( addedTheAccount ) then outputChatBox("Thank You For Registering!",source,0,255,0) outputChatBox("Your Username Is ".. user .."",source, 255,150,0) outputChatBox("Your Password Is ".. pass .."",source, 255,150,0) else outputChatBox("Failed To Register!", source, 255, 0, 0) end end addEvent("account:register", true) addEventHandler("account:register", getRootElement(), registeraccount) function loginaccount(user, pass) local logged = setElementData(source, "logged", 1) local loggingin = logIn(source ,user, pass) if ( loggingin ) then outputChatBox("You Have Sucessfully Logged In!", source,0,255,0) end end addEvent("account:login", true) addEventHandler("account:login", getRootElement(), loginaccount) addEventHandler('onClientGUIClick',login_Button[1], function() triggerServerEvent('account:login',localPlayer,guiGetText(register_Edit[1]), guiGetText(register_Edit[2])) guiSetVisible( register_Window[1], false ) guiSetVisible( login_Window[1], false ) showCursor( false ) end )
micheal1230 Posted June 20, 2012 Author Posted June 20, 2012 server addEvent("account:register", true) function registeraccount(user, pass) local addedTheAccount = addAccount(user, pass) if ( addedTheAccount ) then outputChatBox("Thank You For Registering!", source,0,255,0) outputChatBox("Your Username Is ".. user .."", source, 255,150,0) outputChatBox("Your Password Is ".. pass .."", source, 255,150,0) else outputChatBox("Failed To Register!", source, 255, 0, 0) end end addEventHandler("account:register", getRootElement(), registeraccount) addEvent("account:login", true) function loginaccount(user, pass) local logged = setElementData(source, "logged", 1) local loggingin = logIn(source ,user, pass) if ( loggingin ) then outputChatBox("You Have Sucessfully Logged In!", source,0,255,0) end end addEventHandler("account:login", getRootElement(), loginaccount) client addEventHandler('onClientGUIClick',login_Button[1], function() triggerServerEvent('account:login',localPlayer,guiGetText(register_Edit[1]), guiGetText(register_Edit[2])) guiSetVisible( register_Window[1], false ) guiSetVisible( login_Window[1], false ) showCursor( false ) end ) You And Twix Script Give Me Expected Account At Arg 2 But i type in my account yet it doesnt work Edit: LOL You put the wrong GUI element, you put register_edit its Login_Edit
micheal1230 Posted June 20, 2012 Author Posted June 20, 2012 server addEvent("account:register", true) function registeraccount(user, pass) local addedTheAccount = addAccount(user, pass) if ( addedTheAccount ) then outputChatBox("Thank You For Registering!", source,0,255,0) outputChatBox("Your Username Is ".. user .."", source, 255,150,0) outputChatBox("Your Password Is ".. pass .."", source, 255,150,0) else outputChatBox("Failed To Register!", source, 255, 0, 0) end end addEventHandler("account:register", getRootElement(), registeraccount) addEvent("account:login", true) function loginaccount(user, pass) local logged = setElementData(source, "logged", 1) local loggingin = logIn(source ,user, pass) if ( loggingin ) then outputChatBox("You Have Sucessfully Logged In!", source,0,255,0) end end addEventHandler("account:login", getRootElement(), loginaccount) client addEventHandler('onClientGUIClick',login_Button[1], function() triggerServerEvent('account:login',localPlayer,guiGetText(register_Edit[1]), guiGetText(register_Edit[2])) guiSetVisible( register_Window[1], false ) guiSetVisible( login_Window[1], false ) showCursor( false ) end ) Expected Account Got String "haws1290"
Guest Guest4401 Posted June 20, 2012 Posted June 20, 2012 addEvent("account:register", true) function registeraccount(user, pass) local addedTheAccount = addAccount(user, pass) if ( addedTheAccount ) then outputChatBox("Thank You For Registering!", source,0,255,0) outputChatBox("Your Username Is ".. user .."", source, 255,150,0) outputChatBox("Your Password Is ".. pass .."", source, 255,150,0) else outputChatBox("Failed To Register!", source, 255, 0, 0) end end addEventHandler("account:register", getRootElement(), registeraccount) addEvent("account:login", true) function loginaccount(user, pass) local logged = setElementData(source, "logged", 1) local account = getAccount(user,pass) if account then local loggingin = logIn(source ,account, pass) if ( loggingin ) then outputChatBox("You Have Sucessfully Logged In!", source,0,255,0) end else outputChatBox("Login details are wrong!", source,255,0,0) end end addEventHandler("account:login", getRootElement(), loginaccount)
micheal1230 Posted June 20, 2012 Author Posted June 20, 2012 addEvent("account:register", true) function registeraccount(user, pass) local addedTheAccount = addAccount(user, pass) if ( addedTheAccount ) then outputChatBox("Thank You For Registering!", source,0,255,0) outputChatBox("Your Username Is ".. user .."", source, 255,150,0) outputChatBox("Your Password Is ".. pass .."", source, 255,150,0) else outputChatBox("Failed To Register!", source, 255, 0, 0) end end addEventHandler("account:register", getRootElement(), registeraccount) addEvent("account:login", true) function loginaccount(user, pass) local logged = setElementData(source, "logged", 1) local account = getAccount(user,pass) if account then local loggingin = logIn(source ,account, pass) if ( loggingin ) then outputChatBox("You Have Sucessfully Logged In!", source,0,255,0) end else outputChatBox("Login details are wrong!", source,255,0,0) end end addEventHandler("account:login", getRootElement(), loginaccount) <3
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