Hello. I am using this code at the moment to restrict color changing physgun to admins, but I would like to edit the code to restrict it to certain usergroups. I am not sure if customcheck would work here, and if, how.
[CODE]
timer.Create( "PhysColor", 0.001, 0, function()
for id, ply in pairs( player.GetAll() ) do
if ( !ply:IsAdmin() ) then continue end
local col = HSVToColor( CurTime() % 6 * 60, 1, 1 )
ply:SetWeaponColor( Vector( col.r / 255, col.g / 255, col.b / 255 ) )
end
end )
[/CODE]
Thanks for any help.
For your if statement you could use this instead.
[CODE] if ( ply:IsAdmin() ) then
-- do stuff
end[/CODE]
[QUOTE=Winter;51325129]For your if statement you could use this instead.
[CODE] if ( ply:IsAdmin() ) then
-- do stuff
end[/CODE][/QUOTE]
I guess you don't understand what I need. I need to edit this code so the physgun changes colors for VIPs and Admins only.
[lua]
local GroupLookup =
{
[ "vip" ] = true,
--[ "Add more groups like this" ] = true,
}
timer.Create( "PhysColor", 0.001, 0, function()
for id, ply in pairs( player.GetAll() ) do
if ( !ply:IsAdmin() ) and not GroupLookup[ ply:GetUserGroup() ] then continue end
local col = HSVToColor( CurTime() % 6 * 60, 1, 1 )
ply:SetWeaponColor( Vector( col.r / 255, col.g / 255, col.b / 255 ) )
end
end )
[/lua]
oops i didnt refresh the page.
both his and mine works, but I would suggest using mine instead as youre calling this very often and my code has a direct lookup
[QUOTE=Derek_SM;51328513][lua]
local GroupLookup =
{
[ "vip" ] = true,
--[ "Add more groups like this" ] = true,
}
timer.Create( "PhysColor", 0.001, 0, function()
for id, ply in pairs( player.GetAll() ) do
if ( !ply:IsAdmin() ) and not GroupLookup[ ply:GetUserGroup() ] then continue end
local col = HSVToColor( CurTime() % 6 * 60, 1, 1 )
ply:SetWeaponColor( Vector( col.r / 255, col.g / 255, col.b / 255 ) )
end
end )
[/lua]
oops i didnt refresh the page.
both his and mine works, but I would suggest using mine instead as youre calling this very often and my code has a direct lookup[/QUOTE]
Cheers!
Sorry, you need to Log In to post a reply to this thread.