Code: Show/Hide arena.stats_PLAYERACTION_CB = \ asss.reg_callback(asss.CB_PLAYERACTION, \ store_stats, \ arena) def store_stats(p, action, arena): if action == asss.PA_ENTERARENA: for item in arena.stats_saves: if item['name'] == p.name: p.stats = item arena.stats_saves.remove(item) chat.SendMessage(p, 'PA_ENTERARENA stats restored') return p.stats = { 'name' : p.name, \ 'freq' : -1, \ 'kills' : 0, \ 'deaths' : 0, \ 'tks' : 0, \ 'touch' : 0, \ 'kscore' : 0, \ 'fscore' : 0, \ 'bscore' : 0}; chat.SendMessage(p, 'PA_ENTERARENA stats renewed') elif action == asss.PA_LEAVEARENA: arena.stats_saves.append(p.stats) chat.SendMessage(p, 'PA_LEAVEARENA stats saved') |
Code: Show/Hide arena.stats_gamestats_cmd = \ asss.add_command("gamestats", \ gamestats, \ arena) def gamestats(cmd, params, p, arena): chat.SendMessage(p, 'gamestats from this arena') |