Darkrp custom giverank command

Can someone help me make a ulx command to give a user a rank? I know there’s adduser but I’d like a different one that does the same thing ,but has a CHAT command. !giverank

What have you got so far?

hehe by help I mean… I have nothing heh

People generally don’t spoon feed things here as it doesn’t do any good for anyone, learning it will be best.

Try using the wiki http://wiki.garrysmod.com/page/Main_Page. Also if you find anything similar to look at and play around with is a good start.

If you have any issues post them here and you will be pointed in the right direction.

Just add “!giverank” to the end of the args of where it declares adduser. Should be somewhere in modules/sh.

Where in here do I put !giverank?



function ulx.adduser( calling_ply, target_ply, group_name )
	local userInfo = ULib.ucl.authed[ target_ply:UniqueID() ]

	local id = ULib.ucl.getUserRegisteredID( target_ply )
	if not id then id = target_ply:SteamID() end

	ULib.ucl.addUser( id, userInfo.allow, userInfo.deny, group_name )

	ulx.fancyLogAdmin( calling_ply, "#A added #T to group #s", target_ply, group_name )
end
local adduser = ulx.command( CATEGORY_NAME, "ulx adduser", ulx.adduser )
adduser:addParam{ type=ULib.cmds.PlayerArg }
adduser:addParam{ type=ULib.cmds.StringArg, completes=ulx.group_names_no_user, hint="group", error="invalid group \"%s\" specified", ULib.cmds.restrictToCompletes }
adduser:defaultAccess( ULib.ACCESS_SUPERADMIN )
adduser:help( "Add a user to specified group." )



[lua]function ulx.giverank( calling_ply, target_ply, group_name )
local userInfo = ULib.ucl.authed[ target_ply:UniqueID() ]

local id = ULib.ucl.getUserRegisteredID( target_ply )
if not id then id = target_ply:SteamID() end

ULib.ucl.addUser( id, userInfo.allow, userInfo.deny, group_name )

ulx.fancyLogAdmin( calling_ply, "#A added #T to group #s", target_ply, group_name )

end
local giverank = ulx.command( CATEGORY_NAME, “ulx giverank”, ulx.giverank)
giverank:addParam{ type=ULib.cmds.PlayerArg }
giverank:addParam{ type=ULib.cmds.StringArg, completes=ulx.group_names_no_user, hint=“group”, error=“invalid group “%s” specified”, ULib.cmds.restrictToCompletes }
giverank:defaultAccess( ULib.ACCESS_SUPERADMIN )
giverank:help( “Add a user to specified group.” )[/lua]

I believe you would leave the adduser part that I left to still comply with ulib without breaking shit.

Where exactly?

[editline]30th December 2016[/editline]

Thanks but I meant, where do I add the chat command?


local adduser= ulx.command( CATEGORY_NAME, "ulx giverank", ulx.adduser, "!giverank")
//this is going off of the default ulx.adduser function

If you just added this to adduser, ULX shouldn’t cry. I wouldn’t go around changing a bunch of stuff in the core files seeing as you don’t quite know what you are doing. Just c+p the stuff you want to edit and change the names as Subject had done into another lua file if you want to be safe.

Thanks so much!