Hello, I was wondering how I would go about getting the name of a player who interacted with the computer, and the computer ID, I need to get the player name so that I can submit it to my database, that way it may determine is a certain account is authorized to access certain functions of the program, or certain areas of the game. Thanks!
Getting Player + Computer Name
Started by NullSchritt, May 16 2013 03:38 AM
5 replies to this topic
#1
Posted 16 May 2013 - 03:38 AM
#2
Posted 16 May 2013 - 05:26 AM
You cannot get a player name without other peripheral mods unless you ask them to type it in using read().
And to get the computer ID, use os.getComputerID() or os.computerID()
And to get the computer ID, use os.getComputerID() or os.computerID()
#3
Posted 16 May 2013 - 06:23 AM
if you want to get player name and have miscperipherals installed use the player detector.
use this code
use this code
while true do
event, user = os.pullEvent("player")
print("user: " .. user)
end
then just write it to your database file:while true do
event, user = os.pullEvent("player")
if event == "player" then
print("user: " .. user)
myFile = fs.open("database", a)
myFile.write(user .. "\n")
myFile.close
end
end
then you can access the database for whatever you want by typing edit database.
#4
Posted 17 May 2013 - 06:40 PM
jllllloyd, on 16 May 2013 - 06:23 AM, said:
if you want to get player name and have miscperipherals installed use the player detector.
use this code
use this code
while true do
event, user = os.pullEvent("player")
print("user: " .. user)
end
then just write it to your database file:while true do
event, user = os.pullEvent("player")
if event == "player" then
print("user: " .. user)
myFile = fs.open("database", a)
myFile.write(user .. "\n")
myFile.close
end
end
then you can access the database for whatever you want by typing edit database.#5
Posted 17 May 2013 - 07:37 PM
#6
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











