I have an argument that a player has to enter either a SteamID or a player's nick but since this is considered a string I can't run [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/SteamID]Player:SteamID[/url] on it. Is there any way to make it so that I can run SteamID() on the argument?
If you mean you want to run SteamID on a player's nickname, then you have to find the player with the nickname, which you do with a simple loop like this:
[CODE]
local function GetSteamIDFromNickname( namestring )
for k,v in pairs( player.GetHumans() ) do -- loop through all players
if v:Nick() == namestring then return v:SteamID() end -- if the name entered was the nickname of the player then return the ID
end
return false -- no player with the nickname provided was found on the server
end
[/CODE]
Then again, it's possible for people on the server to have the same nickname, so you might want to add it to a table and then return it instead
Sorry, you need to Log In to post a reply to this thread.