Jump to content


Photo

[HELP] Delete Text From A File


  • Please log in to reply
4 replies to this topic

#1 _249138

_249138

    GMC Member

  • New Member
  • 10 posts
  • Version:GM:Studio

Posted 20 July 2012 - 08:08 PM

How can i delete lets say a word from a text file if the word is in the middle of the file,is there any function which does it or i must take the long road and read the file line by line check if the line contains the string and copy it to another file while deleting the word from the checked string and rebuild it in another file.

That is a pretty memory consuming method especially if the file is very large so i`m looking for shorter alternatives.
Please help me :biggrin:
  • 0

#2 satyre

satyre

    GMC Member

  • GMC Member
  • 138 posts
  • Version:GM8

Posted 20 July 2012 - 08:35 PM

If you don't mind me asking, what do you need this for?
This could be potentially devastating to a computer if you target the right registry. Thus, I don't think it's possible. It could essentially make your game/application a virus.
  • 0

#3 _249138

_249138

    GMC Member

  • New Member
  • 10 posts
  • Version:GM:Studio

Posted 20 July 2012 - 08:48 PM

If you don't mind me asking, what do you need this for?
This could be potentially devastating to a computer if you target the right registry. Thus, I don't think it's possible. It could essentially make your game/application a virus.

i`m not making a virus nor any hostile program i`m making an mmo game i writed a script to add users to a ban list now i`m adding a function to unban them that means deleting their username from that file this is what i need it for :)
  • 0

#4 satyre

satyre

    GMC Member

  • GMC Member
  • 138 posts
  • Version:GM8

Posted 20 July 2012 - 08:49 PM

With that, I think your best option would to do it manually and send the updated text files to the server manually on a regular basis.
As an/the administrator of the game, how would you go about doing the unbanning from in-game? Would you put a certain "code" into the chat?
  • 0

#5 _249138

_249138

    GMC Member

  • New Member
  • 10 posts
  • Version:GM:Studio

Posted 20 July 2012 - 09:33 PM

With that, I think your best option would to do it manually and send the updated text files to the server manually on a regular basis.
As an/the administrator of the game, how would you go about doing the unbanning from in-game? Would you put a certain "code" into the chat?

nope the server is only looking in the banned.txt file that is how i named if if a login is made and tests if the username is in the banned list and if yes then it doesnt lets him in

on the other hand the server program ,the administrator can simply ban by writing in (console i made) /ban nr
where the nr is the player index,then it writes a the username of that player in the banned.txt,but now i want to make an unban script and i wish to know if there is any implemented code for deleting straight integer or string from a file simplier than i wrote in the post?
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users