two different variables for admins and regular players

How do I make it so that admins and regular players have two separate/different values for the same variable?

[lua] local RegenerateMax = 100 [/lua]

[lua]
pl.RegenerateMax = (pl:IsAdmin() and 100) or 75 – if the player is an admin, the value is 100, else 75
[/lua]

Alright thanks a bunch

[editline]16th February 2011[/editline]

I tried the code and it didn’t work. Perhaps the full code would help you see where the code needs to be.

[lua]local RegenerateAmount = 1
local RegenerateTime = 0.125
local RegenerateMax = 100

local function RegenerateHealth()
for k,v in pairs(player.GetAll()) do
if v:Alive() and v:Crouching() and v:Health() < RegenerateMax then
v:SetHealth(math.min(v:Health()+RegenerateAmount,math.max(100,v:GetMaxHealth())))
end
end
timer.Simple(RegenerateTime,RegenerateHealth)
end
RegenerateHealth()

local function RegenerateArmor()
for k,v in pairs(player.GetAll()) do
if v:Alive() and v:Crouching() and v:Armor() < RegenerateMax then
v:SetArmor(math.min(v:Armor()+RegenerateAmount,math.max(100,v:GetMaxHealth())))
end
end
timer.Simple(0.1,RegenerateArmor)
end
RegenerateArmor()[/lua]

[lua]
local RegenerateAmount = 1
local RegenerateTime = 0.125
local RegenerateMax

local function RegenerateHealth()
for k,v in pairs(player.GetAll()) do
RegenerateMax = (v:IsAdmin() and 100) or 75
if v:Alive() and v:Crouching() and v:Health() < RegenerateMax then
v:SetHealth( math.min( v:Health() + RegenerateAmount, math.max(RegenerateMax, (v:GetMaxHealth()) ) )
end
end
timer.Simple(RegenerateTime,RegenerateHealth)
end
RegenerateHealth()
[/lua]

[editline]16th February 2011[/editline]

This is not the ideal way to do it, though. It’s just an idea to show you how it might work.



if ply:IsAdmin() then ply.RegenerateMax = 100 else ply.RegenerateMax = 75 end


_nonSENSE’s code does just that, except in a better way.

Ohok