BorderLine Posted March 21, 2012 Share Posted March 21, 2012 there is any way to detect if the player join for first time to the server? Link to comment
Castillo Posted March 21, 2012 Share Posted March 21, 2012 No, there isn't, but you can add serials to a My(SQL) table and check every time a player joins. Link to comment
TwiX! Posted March 21, 2012 Share Posted March 21, 2012 yes local firstTime = 0 function onLogin() if getElementData(source, "firstTime") == 1 then firstTime = 0 else setElementData ( source, "firstTime", 1 ) firstTime = 1 asd(source) end end addEventHandler("onPlayerJoin", getRootElement(), onLogin) function asd(source) if firstTime == 1 then outputChatBox("Player "..getPlayerName(source).."Joined first time!", getRootElement()) else outputChatBox("Player "..getPlayerName(source).."Just join on the server", getRootElement()) end end Link to comment
CapY Posted March 21, 2012 Share Posted March 21, 2012 there is any way to detect if the player join for first time to the server? You can use account data also(If you're going to use accounts even). Link to comment
TwiX! Posted March 21, 2012 Share Posted March 21, 2012 there is any way to detect if the player join for first time to the server? You can use account data also(If you're going to use accounts even). he can't use account if player not logged. to detect if the player join Link to comment
CapY Posted March 21, 2012 Share Posted March 21, 2012 Because I wrote: (If you're going to use accounts even). (duh) Link to comment
Castillo Posted March 21, 2012 Share Posted March 21, 2012 yes local firstTime = 0 function onLogin() if getElementData(source, "firstTime") == 1 then firstTime = 0 else setElementData ( source, "firstTime", 1 ) firstTime = 1 asd(source) end end addEventHandler("onPlayerJoin", getRootElement(), onLogin) function asd(source) if firstTime == 1 then outputChatBox("Player "..getPlayerName(source).."Joined first time!", getRootElement()) else outputChatBox("Player "..getPlayerName(source).."Just join on the server", getRootElement()) end end This will just work temporary, he can just store player serials on a SQLite table. Link to comment
BorderLine Posted March 21, 2012 Author Share Posted March 21, 2012 Well, im dont know nothing about sql, so i did the @Qwerty~ ide. And i have this. I want show a panel for select skin when player join for first time. client function selectskin() GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} select = guiCreateWindow(150,126,306,198,"Welcome to Biohazard Serer",false) GUIEditor_Label[1] = guiCreateLabel(102,24,111,19,"Select your gender",false,select) GUIEditor_Button[1] = guiCreateButton(29,74,88,41,"Male",false,select) GUIEditor_Button[2] = guiCreateButton(188,74,88,41,"Female",false,select) GUIEditor_Label[2] = guiCreateLabel(18,139,230,22,"This will select your skin",false,select) GUIEditor_Label[3] = guiCreateLabel(17,162,244,26,"Only can chose when you join on first time",false,select) end addEvent( "onSelect", true ) addEventHandler( "onSelect", getLocalPlayer(), selectskin ) server local firstTime = 0 function onLogin() if getElementData(source, "firstTime") == 1 then firstTime = 0 else setElementData ( source, "firstTime", 1 ) firstTime = 1 asd(source) end end addEventHandler("onPlayerJoin", getRootElement(), onLogin) function asd(source) if firstTime == 1 then triggerClientEvent(source,"onSelect",source) else outputChatBox("*"..getPlayerName(source).." welcome to Biohazard server", source) end end The problem is, the gui show all time before to login, and i changed the onPlayerJoin to onPlayerLogin and when im login with new accounts or old accounts, still showing. I mean dont show gui to FIrst login Link to comment
mjau Posted March 21, 2012 Share Posted March 21, 2012 Thats because elementdata is not permanent use account data instead setAccountData getAccountData Link to comment
TwiX! Posted March 21, 2012 Share Posted March 21, 2012 (edited) local firstTime = 0 function onLogin() if getElementData(source, "firstTime") == 1 then firstTime = 0 else setElementData ( source, "firstTime", 1 ) firstTime = 1 asd(source) end end addEventHandler("onPlayerJoin", getRootElement(), onLogin) function asd(source) if firstTime == 1 then triggerServerEvent(source,"onSelect1",source) else outputChatBox("*"..getPlayerName(source).." welcome to Biohazard server", source) end end function selectskin() GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} select = guiCreateWindow(150,126,306,198,"Welcome to Biohazard Serer",false) GUIEditor_Label[1] = guiCreateLabel(102,24,111,19,"Select your gender",false,select) GUIEditor_Button[1] = guiCreateButton(29,74,88,41,"Male",false,select) GUIEditor_Button[2] = guiCreateButton(188,74,88,41,"Female",false,select) GUIEditor_Label[2] = guiCreateLabel(18,139,230,22,"This will select your skin",false,select) GUIEditor_Label[3] = guiCreateLabel(17,162,244,26,"Only can chose when you join on first time",false,select) end addEvent( "onSelect", true ) addEventHandler( "onSelect", getLocalPlayer(), selectskin ) --server function TriGfor1Player ( source ) triggerClientEvent ( source, "onSelect", source ) end addEvent( "onSelect1", true ) addEventHandler( "onSelect1", getRootElement(), TriGfor1Player ) Client CAN'T CALL Client if u not want trigger just remove it and use local firstTime = 0 function onLogin() if getElementData(source, "firstTime") == 1 then firstTime = 0 else setElementData ( source, "firstTime", 1 ) firstTime = 1 asd(source) end end addEventHandler("onPlayerJoin", getRootElement(), onLogin) function asd(source) if firstTime == 1 then makeWindow() else outputChatBox("*"..getPlayerName(source).." welcome to Biohazard server", source) end end function makeWindow() GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} select = guiCreateWindow(150,126,306,198,"Welcome to Biohazard Serer",false) GUIEditor_Label[1] = guiCreateLabel(102,24,111,19,"Select your gender",false,select) GUIEditor_Button[1] = guiCreateButton(29,74,88,41,"Male",false,select) GUIEditor_Button[2] = guiCreateButton(188,74,88,41,"Female",false,select) GUIEditor_Label[2] = guiCreateLabel(18,139,230,22,"This will select your skin",false,select) GUIEditor_Label[3] = guiCreateLabel(17,162,244,26,"Only can chose when you join on first time",false,select) end Edited March 21, 2012 by Guest Link to comment
Castillo Posted March 21, 2012 Share Posted March 21, 2012 @Qwerty: Don't you get that he want's a script which will save on his/her account if he first joined or not? your script will just save temporary element data. He doesn't want to check if he's the first player that joined the server. Link to comment
TwiX! Posted March 21, 2012 Share Posted March 21, 2012 @Qwerty: Don't you get that he want's a script which will save on his/her account if he first joined or not? your script will just save temporary element data. He doesn't want to check if he's the first player that joined the server. he can call server and save in root (but if server will restarted , this will not work) so he can save it in xml or sql/msql or just make a check accounts.. but xml not good idea, if saved all on server and xml file > 3mb server will supre sloooow, Link to comment
BorderLine Posted March 22, 2012 Author Share Posted March 22, 2012 If you add the event "onPlayerJoin" i supose this was a serverside .. Well ill test it 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