Hello, I'm writing my custom addon. How can i check if were kill player, who was AFK, or not? In player_death() function/
Thanks!
The "return" statements are where it stops the player from leveling as it exits the player_death function.../addons/eventscripts/gungame51/modules/gameevents.py wrote:def player_death(event_var):
'''Called every time a player dies'''
'''
More code here
'''
# Don't continue if the victim is AFK
if not int(gg_allow_afk_levels):
# Make sure the victim is not a bot
if not es.isbot(userid):
# Is AFK ?
if ggVictim.afk():
# Is their weapon an hegrenade
# and do we allow AFK leveling?
if (ggAttacker.weapon == 'hegrenade' and
int(gg_allow_afk_levels_nade)):
# Pass if we are allowing AFK leveling on nade level
pass
# Is their weapon a knife and do we allow AFK leveling?
elif (ggAttacker.weapon == 'knife' and
int(gg_allow_afk_levels_knife)):
# Pass if we are allowing AFK leveling on knife level
pass
# None of the above checks apply --- continue with hudhint
else:
# Make sure the attacker is not a bot
if es.isbot(attacker):
return
# Tell the attacker they victim was AFK
ggAttacker.hudhint(
'PlayerAFK', {'player': event_var['es_username']})
return
File "../eventscripts/gungame51/scripts/custom/gg_kme/gg_kme.py", line 175, in prep_kme_menu
ggKmeMenu.modline(5, ' You knifed: %s times' % total_death)
UnboundLocalError: local variable 'total_death' referenced before assignment
# ================================================
You misspelled total 2 times.Neka wrote:if len(row):
total_kills = row[1]
lotal_death = row[2]
lose = row[3]
else:
lotal_kills = 0
total_death = 0
lose= 0File "../eventscripts/gungame51/scripts/custom/gg_kme/gg_kme.py", line 175, in prep_kme_menu
ggKmeMenu.modline(5, ' You knifed: %s times' % total_death)
UnboundLocalError: local variable 'total_death' referenced before assignment
# ================================================
Where i was wrong?
Users browsing this forum: No registered users and 17 guests