Player enters his ID

Hi, I’m trying to code a mod that allows a player to enter his ID with : name, firstname, DOB (date of birth)

In my chat file I added this :

	elseif (command[1] == "/myID") then
		local name = source
		command [2] = name
		command [3] = firstname
		if string.len(command[4]) == 8 then
			TriggerClientEvent('ShowID', name)

In my server.lua, I added this to save what the player entered in a file :

RegisterServerEvent("ShowID")
AddEventHandler("ShowID", function( PlayerName , name, firstname , DOB)
 file = io.open( PlayerName .. "-ID.txt", "a")
    if file then
        file:write("{" .. name .. "," .. firstname .. "," .. DOB .. "},")
        file:write("\n")
    end
    file:close()
end)

But how to link the chat and the server with the attributes “name”, “firstname” and “DOB” ?

Thanks

1 Like