Is there any way to check the Steam Id of a Player? Created 1 year ago2021-03-11 18:36:46 UTC by The Mighty Goglu. The Mighty Goglu.

Created 1 year ago2021-03-11 18:36:46 UTC by The Mighty Goglu. The Mighty Goglu.

Posted 1 year ago2021-03-11 18:36:46 UTC Post #345419
The title say it all.

I tried to use if (GETPLAYERAUTHID(pl->edict()) == "insert_steam_id_here")) do stuff but seem to do nothing.
Posted 1 year ago2021-03-11 19:09:10 UTC Post #345420
You need to use FStrEq and have the two as its parameters:
if ( FStrEq( GETPLAYERAUTHID( pl->edict() ), "my_steamid" ) )
Admer456 Admer456If it ain't broken, don't fox it!
Posted 1 year ago2021-03-11 19:20:48 UTC Post #345421
Thanks a lot it worked :D!
Posted 1 year ago2021-03-12 09:15:08 UTC Post #345422
The reason your code doesn't work, The Mighty Goglu, is that GETPLAYERAUTHID(pl->edict()) and "insert_steam_id_here" are pointers to characters, const char*. Two strings can contain the same text (insert_steam_id_here) but not have the same memory address (pointer value) because they're stored in different locations, and you want to compare the text content, not compare where the content is stored in memory. When you do == on two pointers, you compare memory locations. FStrEq (and C's strcmp and similar functions) compare the actual characters those pointers point to.
You must be logged in to post a response.