Page 1 of 1

Reading File

Posted: Wed Nov 10, 2010 7:34 pm
by Zelly
Alright been learning lua recently and i think im doin pretty well, however Im not sure how a certain command works

I have been using the advancedref.lua as my template

Code: Select all

  if refGuids[guid] then
    et.G_Print(string.format("GUID %s is already in\n", guid))
    return 1
  end

  if et.trap_Argc() > 2 then
    comment = et.ConcatArgs(2)
  end

  local fd, len = et.trap_FS_FOpenFile(conf['guidfile'], et.FS_APPEND)

  if len == 1 then
    et.G_Print(string.format("Could not open %s\n", conf['guidfile']))
    return 1
  end
  local name = et.Q_CleanStr(et.GetPlayerInfo(client, "name"))
  local data = string.format("%s | %s | %s\n", guid, name, money)

  et.trap_FS_Write(data, string.len(data), fd)
  et.trap_FS_FCloseFile(fd)

  refGuids[guid] = true
  et.G_Print(string.format("GUID %s successfully added\n", guid))

  return 1
end
I already have it so its writing to a file like i want
What im needing is when someone type command it is to get the clients guid and gets the "money" number then prints it to clients console

Some help please? Thanks in advance