General > Developers Corner
Banid and kickid don't check can target
MrPresident:
I'm going to work on this. I'll post once I have an update for you.
Aaron113:
Just my opinion, if someone is abusing banid on your server(s), I wouldn't even have them on your staff (I might even just ban them for it).
MrPresident:
I agree Aaron113, but if it can be done, might as well.
Although, this is a bit harder than I expected it to be. There's not really a good way to get the allowed targets in ULib that I've been able to find.
BigBrainAFK:
I don't know if this works but i guess it is a good way to check unless you can set more then 1 can_target group in the can target field.
--- Code: ---function IsAllowedToTarget( ply, target_id )
-- Negate switch if can_target has !% infront of the group
-- Get the player that has the given SteamID
local target_ply = ULib.getPlyByID( tagert_id )
-- Check if can target of ply group has a !%
local can_target = ucl.getGroupCanTarget( ply:GetUserGroup )
if string.sub( can_target, 1, 2 ) == "!%" then
negate = true
can_target = string.Replace( can_target, "!%", "" )
end
-- Check if player can target all or nobody
if can_target == "*" then
return true
elseif can_target == "!%*" then
return false
end
-- Get the can target without the !%
if target_ply:CheckGroup( groupchain ) and negate = true then
return false
elseif target_ply:CheckGroup( groupchain ) and negate = false then
return true
end
end
--- End code ---
MrPresident:
You can set more than one, also this would only check if you have a blanket can_target set for a group. This wouldn't work for checking if you've blocked a certain command from being targeted on another player or group.
For instance, ulx groupallow member "ulx banid" "!%admin"
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version