
could some1 tell me why the following does not work?
it always print not allowed...
Syntax: Select all
from path import Path
from players.entity import PlayerEntity
from players.helpers import index_from_userid
from filters.players import PlayerIter
from events import Event
from messages import SayText2
allowed_list = []
def load():
base_path = Path(__file__).parent
with open(base_path + '/allowed.txt', 'r') as open_allowed_file:
for line in open_allowed_file:
allowed_list.append(line.rstrip())
@Event
def player_spawn(game_event):
userid = game_event.get_int('userid')
index = index_from_userid(userid)
player = PlayerEntity(index)
if player.team == 3:
if not check_player(player.steamid):
player.set_team(2)
SayText2(message="You are not allowed on CT!").send()
else:
if not check_ratio():
player.set_team(2)
SayText2(message="Too many CT!").send()
def check_player(steamid):
if steamid in allowed_list:
return 1
return 0
def check_ratio():
ct = len(PlayerIter('ct'))
t = len(PlayerIter('t'))
ct_allowed = int(t/3)
if ct > ct_allowed:
return 0
else:
return 1
allowed.txt
Code: Select all
STEAM_1:0:16817999
also one question about steamid
steamid from http://steamidfinder.com/ is different from the steamid from csgo..
why??