• Class CustomCheck (and something else)
    2 replies, posted
So, on my DarkRP server, I want to add the ULX Ranks vip, vipoperator, vipdeputy, vipadmin, revered, and superadmin to a custom check for all my VIP classes. Sadly, I cannot figure out how to add multiple ranks to one check, and multiple checks just break. Is there any way I could do this without having to duplicate the class 5 times making a different check for each one? Also, i've just started getting into to lua, and I was wondering about this. so I currently have the code [code] hook.Add( "PreDrawHalos", "xXx_WallHacks_xXx", function() halo.Add( player.GetAll(), Color(255,255,255), 0, 0, 2, true, true ) halo.Add( ents.FindByClass( "money_printer" ), Color( 255, 0, 0 ), 0, 0, 2, true, true ) end) [/end][/code] This allows me to draw a white outline around the players and printers on the server through the walls. Like wallhacks. I was wondering how to make it for certain ulx ranks or how to impliment the IfAdmin part. I tried this, but it didn't work: [code] hook.Add( "PreDrawHalos", "xXx_WallHacks_xXx", function() if ply:IsAdmin then halo.Add( player.GetAll(), Color(255,255,255), 0, 0, 2, true, true ) halo.Add( ents.FindByClass( "money_printer" ), Color( 255, 0, 0 ), 0, 0, 2, true, true ) else then return end end)[/code]
ply is invalid since that's a clientside hook. LocalPlayer() will give you the clientsided player. As for your first problem, create a table at the top of your file that looks like this: [code]local ranks = { -- Keep all rank names lowercase [ "admin" ] = true, [ "moderator" ] = true, [ "etc" ] = true, }[/code] Then, for your customCheck, do this: [code]customCheck = function( ply ) if ( ranks[ string.lower( ply:GetNWString( "UserGroup" ) ) ] ) then return true else return false end[/code]
Thanks! Can I add you on steam if I have any other small questions while I start learning lua?
Sorry, you need to Log In to post a reply to this thread.