I have a game mode mod with the following in a .scar file:
local function MyFunction_OnInit() for i = 1, World_GetPlayerCount() do local player = World_GetPlayerAt(i) local playername = Player_GetDisplayName(player) UI_SystemMessageShow(playername) -- This displays playername correctly if playername=="SomePlayerName" then -- This never evaluates to true... DoStuff() -- ...so, this is never executed ... end end end Scar_AddInit(MyFunction_OnInit)
I'm new to LUA but see that Player_GetDisplayName() returns a LocString while I assume that "somePlayerName" is a regular String. Is there a type issue? I tried
tostring(playername) == "SomePlayerName" but that didn't work either.
What am I missing?