Cannot fetch player name: "the index 'GetScriptScope' does not exist"
olepg opened this issue · comments
Trying to run the following code:
IncludeScript("vs_library");
VS.ListenToGameEvent( "bullet_impact", function( event )
{
local player = VS.GetPlayerByUserid( event );
printl(player)
local scope = player.GetScriptScope();
printl( scope.userid );
printl( scope.networkid );
printl( scope.name );
}, "test" );
But I get the following error in the console:
(null : 0x00000000)
AN ERROR HAS OCCURED [the index 'GetScriptScope' does not exist]
CALLSTACK
*FUNCTION [unknown()] myscript.nut line [8]
LOCALS
[player] NULL
[event] TABLE
[this] TABLE
I assume the Null response from printl(player) is part of the problem, but I cant figure out where I've gone wrong.
You're passing event
instead of event.userid
to get the player.
Thanks. that was the issue. Sorry, I should have noticed that...