Jump to content

question


BorderLine

Recommended Posts

Posted

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 

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

Posted
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

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

Posted

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

Posted (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 by Guest
Posted

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

Posted
@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, :D

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