Jump to content




Getting Player + Computer Name


  • You cannot reply to this topic
5 replies to this topic

#1 NullSchritt

  • Members
  • 43 posts

Posted 16 May 2013 - 03:38 AM

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!

#2 Smiley43210

  • Members
  • 204 posts

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()

#3 panicmore

  • Members
  • 26 posts
  • LocationEssex, UK

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

  • Members
  • 43 posts

Posted 17 May 2013 - 06:40 PM

View Postjllllloyd, 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
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.
Thanks, where might I find the 1.5.1 compatible version of misc. peripherals?(also my database is mysql, I want to add access control to the stargate dialing program, that I wrote for a plugin on my server(with some help from people here), by sending their name along with the requested gate to dial to my server(I already got that part handled, I just didn't know how to get the name))

#5 1vannn

  • Members
  • 111 posts
  • LocationOhio, USA

Posted 17 May 2013 - 07:37 PM

It's in the peripherals section of the forums.
http://www.computerc...peripherals-32/

#6 NullSchritt

  • Members
  • 43 posts

Posted 17 May 2013 - 08:07 PM

View Post1vannn, on 17 May 2013 - 07:37 PM, said:

It's in the peripherals section of the forums.
http://www.computerc...peripherals-32/
Thanks, I have however decided to use immibis's peripherals (RFID Reader), along with a private list of codes for access control, for now at least, since I already have it installed.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users