Scripts:ReadingClanmembers

From BF2 Technical Information Wiki
Revision as of 15:35, 22 June 2018 by Pireax (talk | contribs) (Created page with "For some scripts you need to add all your Clanmembers in an array.(for ex. Clan TK Protection) So I made a little Scriptpart which you can use to...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

For some scripts you need to add all your Clanmembers in an array.(for ex. Clan TK Protection) So I made a little Scriptpart which you can use to read all your Clanmembers from a file to an array.


paste this code anywhere you would read the Members out of a File:

#######################################
#   Memberfilereader by Nexus2k       #
#                                     #
# Credits to Nexus2kSwiss and Net.BS| #
#       BlackSkorpions BF2 Clan       #
#            www.bs-dc.com            #
#######################################
#Open members.cfg in readmode
f=open('members.cfg','r')
#Each line become a Arrayitem in Array "clanmembers"
clanmembers=f.readlines()
#Close File
f.close()
#This deletes the "\n" after each member
clanmembers=[row.replace('\n','') for row in clanmembers]

members.cfg:

Net.BS|Nexus2kSwiss
Net.BS|BlackSkull

Just make a new Line after each Clanmember

--Nexus2k 05:09, 8 Jul 2005 (MDT)