Improve radar for donators

Hello,
I tried to improve the TTT Radar for traitor, make it faster when you donated, 15sec instead of 30sec for regulars.

This is my radar.lua edited, but nothing works :confused:


-- Traitor radar functionality


-- should mirror client
local chargetime = 30

local chargetimedonor = 15

local math = math

local function RadarScan(ply, cmd, args)
   if IsValid(ply) and ply:IsTerror() then
      if ply:HasEquipmentItem(EQUIP_RADAR) then

         if ply.radar_charge > CurTime() then
            LANG.Msg(ply, "radar_charging")
            return
         end
	 if ply:GetNWBool("donor") or ply:IsUserGroup("admin") or ply:IsUserGroup("superadmin") or ply:IsUserGroup("specialgroup") then
         	ply.radar_charge =  CurTime() + chargetimedonor
	 else
		ply.radar_charge =  CurTime() + chargetime
	 end
         local scan_ents = player.GetAll()
         table.Add(scan_ents, ents.FindByClass("ttt_decoy"))


Thanks if anyone have an issue :3

You could try this: (I cant test this right now, sorry.)
[LUA]
– should mirror client
local time = 30
local math = math
local function RadarScan(ply, cmd, args)
if IsValid(ply) and ply:IsTerror() then
if ply:HasEquipmentItem(EQUIP_RADAR) then

     if ply.radar_charge > CurTime() then
        LANG.Msg(ply, "radar_charging")
        return
     end
if ply:GetNWBool("donor") or ply:IsUserGroup("admin") or ply:IsUserGroup("superadmin") or ply:IsUserGroup("specialgroup") then
	time = 15
end
ply.radar_charge =  CurTime() + time
     local scan_ents = player.GetAll()
     table.Add(scan_ents, ents.FindByClass("ttt_decoy"))[/LUA]

I will test it and let you know if it works, thanks :3

Sorry for doublepost but it still not work, have you another idea? I didn’t try to code it again.
Thanks for your help.

how about instead of doing



else
		ply.radar_charge =  CurTime() + chargetime
	 end


you replace the else with



else if ply:IsUserGroup("user")


and add the rest of your non donor+ groups.

Also, why do you have ply:GetNWBool(“donor”) instead of ply:IsUserGroup(“donor”) ? Just pointing out something I could see as making it not work.

Hope this helps.

Do you mind posting the entire code inside LUA tags?

@MONGLER
I’m trying with "IsUserGroup(“donor”) we will see. If it still won’t work I will use my code again with your edit.

Atm Loki it’s :


-- Traitor radar functionality


-- should mirror client
local time = 30
local math = math
local function RadarScan(ply, cmd, args)
   if IsValid(ply) and ply:IsTerror() then
      if ply:HasEquipmentItem(EQUIP_RADAR) then

         if ply.radar_charge > CurTime() then
            LANG.Msg(ply, "radar_charging")
            return
         end
	if ply:IsUserGroup("donor") or ply:IsUserGroup("admin") or ply:IsUserGroup("superadmin") or ply:IsUserGroup("specialgroup") then
		time = 15
	end
	ply.radar_charge =  CurTime() + time
         local scan_ents = player.GetAll()
         table.Add(scan_ents, ents.FindByClass("ttt_decoy"))
[...]