Hello hopefully this is a simple problem.
I need to apply attributes to a player when they join the server. I need their steamid to lookup some info about them.
Currently im catching the "player_connect" event since it gives me index and steam id.
Upon connecting though; the server doesnt seem to assign an index until a couple seconds after this event fires. Is there a different event I should catch?
Player connect event missing index?
Re: Player connect event missing index?
You could use the OnClientActive listener:
Syntax: Select all
# ../client_active/client_active.py
# Source.Python
from listeners import OnClientActive
from players.entity import Player
@OnClientActive
def on_client_active(index):
"""Called when a player spawns into the server."""
player = Player(index)
print(index, player.steamid)
Re: Player connect event missing index?
This seems to work for me.
Syntax: Select all
@Event("player_activate")
def on_player_activate(event):
args = event.variables.as_dict()
index = index_from_userid(args['userid'])
player = Player(index)
assign_permissions(player)
Last edited by L'In20Cible on Sun May 23, 2021 3:08 am, edited 1 time in total.
Reason: [code] → [python]
Reason: [code] → [python]
Return to “Plugin Development Support”
Who is online
Users browsing this forum: No registered users and 16 guests