Scripts:ReadingClanmembers: Difference between revisions

From BF2 Technical Information Wiki
Jump to navigation Jump to search
(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...")
 
(No difference)

Latest revision as of 15:35, 22 June 2018

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)