I have this command called uservip (Sets a value), and I tried to set an opposite command that will retrieve the value, and for the life of me I have no idea what I'm doing wrong.
uservip works fine.
getuservip as a completely different command (Not as a setOpposite) works fine.
But for some reason, when I use this code, something f***s up
ULib v3.62
ULX v2.52
function ulx.uservip( calling_ply, target_ply, vipvalue, should_get )
local err_msg = "Cannot set VIP value to a bot"
calling_ply:ChatPrint( tostring( should_get ) ) //Debug - returns false when it should be false. Returns nil when it should be true
if should_get then err_msg = "Bots don't have VIP values." end
if target_ply:IsBot() then
ULib.tsayError( calling_ply, err_msg, true )
return
end
if should_get then
if vipvalue > 3 or vipvalue < 1 then
ULib.tsayError( calling_ply, "The VIP value must be between 1 and 3!", true )
return
end
end
// if not target_ply:IsVIP() then ULib.tsayError ( calling_ply, target_ply:Nick() .. " is not a VIP" ) return end
if not should_get then
ulx.fancyLogAdmin( nil, true, "#T's VIP value is set to " .. target_ply:GetVIPValue(), target_ply, vipvalue )
else
target_ply:SetVIPValue( vipvalue )
ulx.fancyLogAdmin( calling_ply, true, "#A set #T" .. "'s VIP value to #s", target_ply, vipvalue )
end
end
local uservip = ulx.command( CATEGORY_NAME, "ulx uservip", ulx.uservip, "!uservip" )
uservip:addParam{ type=ULib.cmds.PlayerArg }
uservip:addParam{ type=ULib.cmds.NumArg, hint="Set a user's VIP value." }
uservip:addParam{ type=ULib.cmds.BoolArg, invisible=true }
uservip:setOpposite( "ulx getuservip", { _, _, _, true }, "!getuservip", true )
uservip:defaultAccess( ULib.ACCESS_SUPERADMIN )
uservip:help( "1 = Minimal donation\n2 = Medium donation\n3 = Big donation" )