I have hosted a multiplayer game which runs on python, and i wanted to edit the script in such a way that when i join a message showing that i am playing is displayed on everyone's screen. i was able to do this but the message is shown in the start of every match, i tried to fix it but i'm getting a problem. This is the python script i'm trying to edit:
def onPlayerJoin(self,player):
'Called for all new bs.Players (including the initial set of them).'
if player.getName(full=True,icon=False) == "AwesomeLogic":
if g == 0:
bs.screenMessage("AwesomeLogic is playing")
g = 1
def onPlayerLeave(self,player):
'Called when a player is leaving the activity.'
g = 0
But this gives me an error:
if g == 0: UnboundLocalError: local variable 'g' referenced before assignment
Can anyone please tell me what i'm doing wrong?