• Alternating SteamID's Or Stupidity
    4 replies, posted
Recently my friend had been creating a map and was going to test it with others, however the rules he asked of them were simply overlooked which resulted in me creating a very quick gamemode to limit what we needed I created a function in shared to only return true if the players SteamID matched that of the ones in the code: [lua]local PMETA = FindMetaTable( "Player" ) function PMETA:HasAdminPower() return self:SteamID() == "STEAM_0:1:26086634" or self:SteamID() == "STEAM_0:0:31884175" end[/lua] However, it seemed this had only been working on the clientside functions and then serverside had no effect So I created a simple code ingame in an attempt to debug the system by doing: [lua]if SERVER then print( "=================RUNNING SERVER STEAMID CHECK=================" ) elseif CLIENT then print( "=================RUNNING CLIENT STEAMID CHECK=================" ) end if ( player.GetByID(1):SteamID() == "STEAM_0:0:31884175" then print( "True" ) else print( "False" ) end[/lua] And when running this shared I got the result in console of: [img]http://filesmelt.com/dl/SteamID_Checking.png[/img] So my SteamID clientside returns true, but it returns false serverside Am I just being stupid now, or has something gone VERY wrong? (Please let it be the last :P)
If you only need it for serverside, try using UniqueID.
You could have solved this out quite easily by making it print the SteamID it's fetching. On singleplayer games, your serverside SteamID will be STEAM_0:0:0. Try on a listen server and you'll see your SteamID fetching correctly.
Are you testing this in [B]Single Player[/B]? player:SteamID() returns [I]STEAM_0:0:0[/I] serverside when run in Single Player. [editline]15th July 2011[/editline] Ah, beat me to it :v:
Ah, it has been done in single player, so thanks for telling me that it was my stupidity that made this fail :P
Sorry, you need to Log In to post a reply to this thread.