I have this for my chat tag system:
[lua]
local filename = "chatranks.lua"
if SERVER then
AddCSLuaFile( "autorun/" .. filename )
else
local function ChatTags( Ply, Txt, ply )
local Msg = {}
-- Console?
if IsValid( Ply ) then
if Ply:IsUserGroup("owner") then
Msg[#Msg+1] = Color(255,0,0)
Msg[#Msg+1] = "(Owner) "
end
Msg[#Msg+1] = "(" .. Ply:GetRank() .. ") "
Msg[#Msg+1] = team.GetColor( Ply:Team() )
Msg[#Msg+1] = Ply:Nick()
end
-- The message
Msg[#Msg+1] = Color(255,255,255)
Msg[#Msg+1] = ": " .. Txt
chat.AddText( unpack(Msg) )
return true
end
hook.Add("OnPlayerChat","Simple chat tags",ChatTags)
end
[/lua]
Now my question here is I want to add something like:
[lua]
if Ply:SteamID("STEAM_0:0:00000000") then
Msg[#Msg+1] = Color(255,0,0)
Msg[#Msg+1] = "(HIS CHAT TAG)"
end
[/lua]
But when I do that it adds the above tag to everyone, even though I specified his Steam ID.
Can someone give me some pointers on what I'm doing wrong?
Also I also tried the: Player:SteamID64() but that doesn't work either.
Thanks for the help :)
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/SteamID]Player:SteamID[/url] returns the players SteamID and [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/SteamID64]Player:SteamID64[/url] return the players SteamID64. So what you're doing isn't ever going to work, try something like the following:
[code]
if Ply:SteamID() == "STEAM_0:0:00000000" || Ply:SteamID64() == "steamid64 goes here" then
Msg[#Msg+1] = Color( 255, 0, 0 )
Msg[#Msg+1] = "( HIS CHAT TAG )"
end
[/code]
[QUOTE=MexicanR;50309862][img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/SteamID]Player:SteamID[/url] returns the players SteamID and [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/SteamID64]Player:SteamID64[/url] return the players SteamID64. So what you're doing isn't ever going to work, try something like the following:
[code]
if Ply:SteamID() == "STEAM_0:0:00000000" || Ply:SteamID64() == "steamid64 goes here" then
Msg[#Msg+1] = Color( 255, 0, 0 )
Msg[#Msg+1] = "( HIS CHAT TAG )"
end
[/code][/QUOTE]
Ill try it and post results :) Thanks
[editline]12th May 2016[/editline]
Everything works :)
Sorry, you need to Log In to post a reply to this thread.