banimod / etpro / ettv forums Forum Index banimod / etpro / ettv forums
Bani's Discussion Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Reading File

 
Post new topic   Reply to topic    banimod / etpro / ettv forums Forum Index -> ET Modding
View previous topic :: View next topic  
Author Message
Zelly



Joined: 11 Sep 2010
Posts: 1

PostPosted: Wed Nov 10, 2010 7:34 pm    Post subject: Reading File Reply with quote

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:
  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
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    banimod / etpro / ettv forums Forum Index -> ET Modding All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group