Is it possible to set cvars for a specific group within ULX, like if I wanted to change ttt_spec_prop_rechargetime to .5 for one group and have everyone else still at the default 1?
You'd have to meddle with lines 130-139 in propspec.lua.
[lua]local propspec_retime = CreateConVar("ttt_spec_prop_rechargetime", "1")
function PROPSPEC.Recharge(ply)
if ply:IsUserGroup( "owner" ) then propspec_retime = 0.5 end
local pr = ply.propspec
if pr.retime < CurTime() then
pr.punches = math.min(pr.punches + 1, pr.max)
ply:SetNWFloat("specpunches", pr.punches / pr.max)
pr.retime = CurTime() + propspec_retime:GetFloat()
end
end[/lua]
It's impossible to let a server console command affect users differently. Do a check for the usergroup of each player.
I tried using this and it changes the cvar when a player in the group specified joins for everyone. Before player joins it will be at 1, after it will be set to .5.
Still searching for a way to do this.
[QUOTE=jaxx2009;43036060]Still searching for a way to do this.[/QUOTE]
He provided the answer, you just don't understand how ConVars work. Go learn, you already have the answer.
Derp. [lua]
local propspec_retime = CreateConVar("ttt_spec_prop_rechargetime", "1")
function PROPSPEC.Recharge(ply)
propspec_retime = ply:IsUserGroup( "owner" ) and 0.5 or 1 end
local pr = ply.propspec
if pr.retime < CurTime() then
pr.punches = math.min(pr.punches + 1, pr.max)
ply:SetNWFloat("specpunches", pr.punches / pr.max)
pr.retime = CurTime() + propspec_retime:GetFloat()
end
end[/lua]
Sorry, you need to Log In to post a reply to this thread.