General > Developers Corner
Looking for the wrong value?
zappsmcjack:
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: --------------------------------- 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" )
--- End code ---
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
MrPresident:
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.
zappsmcjack:
it's for TTT
basically all im looking for is so that SetRole is attributed to the name being entered or whatever
Megiddo:
--- Quote from: zappsmcjack 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: --------------------------------- 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" )
--- End code ---
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
--- End quote ---
You probably meant to apply that function per player instead of to the target_plys table.
zappsmcjack:
the problem with it is right here
target_plys:SetRole(ROLE_TRAITOR)
apparently it's looking for some sort of value to be entered
Navigation
[0] Message Index
[#] Next page
Go to full version