Just for fun, I made a group called "punished" on my server to mess with one of my friends, where the chat tag and the rank would be "Dunce." But then this got me thinking, about having an actual punished rank where it would be better than slaying if they've been misbehaving too much. I was thinking of a lua file in autorun that would check for their group, and if they are punished, it would strip them if they have a weapon, gag them if they are ungagged, and the same for mute, so they can only be unpunished by asking through asay. How would I do this though? I don't know how to make the file check for things, I only know how to make it do things on a if then basis, like if punished, then ulx gag, etc. The checking would be so the server doesn't lag from running the code every second. This is where I am so far:
//Autorun for commands on certain groups
--No Weapons for Punished
function No_Weaps( calling_ply, target_plys )
local affected_plys = {}
for i=1, #target_plys do
local v = target_plys[ i ]
(if v:IsUserGroup("punished")) and (if v:) then
v:ulx.strip
ULib.tsayError( calling_ply, v:Nick() .. " is not allowed to hold weapons!", true )
end
end
end
--No talking for Punished
function No_Talk( calling_ply, target_plys )
local affected_plys = {}
for i=1, #target_plys do
local v = target_plys[ i ]
(if v:IsUserGroup("punished")) and (if v:) then
v:ulx.gag
ULib.tsayError( calling_ply, v:Nick() .. " is not allowed to talk!", true )
end
end
end
--No typing for Punished
function No_Type( calling_ply, target_plys )
local affected_plys = {}
for i=1, #target_plys do
local v = target_plys[ i ]
(if v:IsUserGroup("punished")) and (if v:) then
v:ulx.mute
ULib.tsayError( calling_ply, v:Nick() .. " is not allowed to type!", true )
end
end
end
The second if v: in each function is for the checking, so it would check their group and their state.