Author Topic: Organizing Scoreboard by Rank  (Read 1381 times)

0 Members and 1 Guest are viewing this topic.

Offline |QIG| Djmuz

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
Organizing Scoreboard by Rank
« on: April 17, 2016, 10:18:39 AM »
My ULib/ULX versions (run "ulx version" in console):
ULib v2.60
ULX v3.70

Game mode(s) I am having this problem on: Murder

Lua errors shown in console, if any:
Code: [Select]
attempt to call method 'immvalue' (a nil value)

The function I am running is:

Code: [Select]
function PANEL:HigherOrLower( row )

if ( !self.Player:IsValid() || self.Player:Team() == TEAM_CONNECTING ) then return false end
if ( !row.Player:IsValid() || row.Player:Team() == TEAM_CONNECTING ) then return true end

if self.Player:IsUserGroup("Council") then immvalue = 8
elseif self.Player:IsUserGroup("Manager") then immvalue = 7
elseif self.Player:IsUserGroup("Super-Admin") then immvalue = 6
elseif self.Player:IsUserGroup("Admin") then immvalue = 5
elseif self.Player:IsUserGroup("Moderator") then immvalue = 4
elseif self.Player:IsUserGroup("respected") then immvalue = 3
else immvalue = 2
end
local plyImmunity = self.Player:immvalue() --Line the error occurs on
local plyImmunity2 = row.Player:immvalue()
return plyImmunity > plyImmunity2
end 

I've been able to do this successfully using Evolve as it has numeric immunity numbers for me to take advantage of, but when I tried to convert my Evolve code for ULX compatibility, it got fried, as the error above says.

Would it be easier to do this with a cantarget check if possible?