• How can i check if,
    4 replies, posted
a certian player has a certian steam id using if ply [highlight](User was banned for this post ("1 thread with cliffhanger title, and another thread with undescriptive title" - Orkel))[/highlight]
[lua]if (player:SteamID() == "insert ID here") then -- do stuff end[/lua]
If you'd like to check if a player's steamid matches multiple steamID's, you'd do something like this: [CODE] local steam_ids = { "STEAM:0:0:4874892", "STEAM:0:1:32130", "add_more_ids" } if table.HasValue( steam_ids, ply:SteamID() ) then --do stuff end [/CODE]
[QUOTE=CallMePyro;43590657]If you'd like to check if a player's steamid matches multiple steamID's, you'd do something like this: [CODE] local steam_ids = { "STEAM:0:0:4874892", "STEAM:0:1:32130", "add_more_ids" } if table.HasValue( steam_ids, ply:SteamID() ) then --do stuff end [/CODE][/QUOTE] My suggestion would be to only use table.HasValue when you really have to. [lua] local steamIds = { ["id1"] = true, ["id2"] = true } local function PlyCanUse(steamID) return steamIds[steamID] end [/lua]
[QUOTE=brandonj4;43590888]My suggestion would be to only use table.HasValue when you really have to. [lua] local steamIds = { ["id1"] = true, ["id2"] = true } local function PlyCanUse(steamID) return steamIds[steamID] end [/lua][/QUOTE] Never thought about doing it that way. It makes sense though, I'll do it that way from now on.
Sorry, you need to Log In to post a reply to this thread.