ULX

Author Topic: Looking for the wrong value?  (Read 3069 times)

0 Members and 1 Guest are viewing this topic.

Offline zappsmcjack

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Looking for the wrong value?
« on: January 13, 2013, 09:13:35 PM »
aight so im tired and i really cannot figure out what im doing wrong
i have limited lua knowledge but this isn't exactly something hard to achieve

Code: [Select]
------------------------------ Traitor ------------------------------
function ulx.traitor( calling_ply, target_plys )
for i=1, #target_plys do
target_plys:SetRole(ROLE_TRAITOR)
end
ulx.fancyLogAdmin( calling_ply, "#A set the hp for #T to #i", target_plys )
end
local traitor = ulx.command( CATEGORY_NAME, "ulx traitor", ulx.traitor, "!traitor" )
traitor:addParam{ type=ULib.cmds.PlayersArg }
traitor:defaultAccess( ULib.ACCESS_ADMIN )
traitor:help( "Sets target(s) as a traitor" )

says SetRole is nil or something
and before it was looking for a num value i dont remember why

actually i might have just copy and pasted some code and edited it
i dont really remember
im really tired

all help is appreciated

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Looking for the wrong value?
« Reply #1 on: January 13, 2013, 09:29:59 PM »
SetRole isn't a default garry's mod. You'd be better off getting some help from a DarkRP coder.

saying that it is nil means that that function isn't recognized.

Offline zappsmcjack

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Re: Looking for the wrong value?
« Reply #2 on: January 13, 2013, 09:40:54 PM »
it's for TTT

basically all im looking for is so that SetRole is attributed to the name being entered or whatever

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Looking for the wrong value?
« Reply #3 on: January 14, 2013, 03:31:14 AM »
aight so im tired and i really cannot figure out what im doing wrong
i have limited lua knowledge but this isn't exactly something hard to achieve

Code: [Select]
------------------------------ Traitor ------------------------------
function ulx.traitor( calling_ply, target_plys )
for i=1, #target_plys do
target_plys:SetRole(ROLE_TRAITOR)
end
ulx.fancyLogAdmin( calling_ply, "#A set the hp for #T to #i", target_plys )
end
local traitor = ulx.command( CATEGORY_NAME, "ulx traitor", ulx.traitor, "!traitor" )
traitor:addParam{ type=ULib.cmds.PlayersArg }
traitor:defaultAccess( ULib.ACCESS_ADMIN )
traitor:help( "Sets target(s) as a traitor" )

says SetRole is nil or something
and before it was looking for a num value i dont remember why

actually i might have just copy and pasted some code and edited it
i dont really remember
im really tired

all help is appreciated

You probably meant to apply that function per player instead of to the target_plys table.
Experiencing God's grace one day at a time.

Offline zappsmcjack

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Re: Looking for the wrong value?
« Reply #4 on: January 14, 2013, 05:24:00 AM »
the problem with it is right here

target_plys:SetRole(ROLE_TRAITOR)

apparently it's looking for some sort of value to be entered

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given