hello i wonder if someone can make a fixe to ass mod
[url]http://www.garrysmod.org/downloads/?a=view&id=123006[/url]
or if anyone know any other adminplugin that workes with perp
penSubMenu' (a nil value)
[ass_client.lua:175] attempt to call method 'OpenSubMenu' (a nil value)
[ass_client.lua:175] attempt to call method 'OpenSubMenu' (a nil value)
[ass_client.lua:175] attempt to call method 'OpenSubMenu' (a nil value)
[ass_client.lua:175] attempt to call method 'OpenSubMenu' (a nil value)
[ass_client.lua:175] attempt to call method 'OpenSubMenu' (a nil value)
[ass_client.lua:175] attempt to call method 'OpenSubMenu' (a nil value)
[ass_client.lua:175] attempt to call method 'OpenSubMenu' (a nil value)
[ass_client.lua:175] attempt to call method 'OpenSubMenu' (a nil value)
[ass_client.lua:175] attempt to call method 'OpenSubMenu' (a nil value)
[ass_client.lua:464] attempt to get length of field 'Panels'
[QUOTE=Chessnut;35016306][url]http://www.facepunch.com/threads/1091514-PERP-ass_client.lua-problem[/url][/QUOTE]
still don't work
You aren't doing it right then. Show the code of your ass_client.lua
[QUOTE=Chessnut;35029410]You aren't doing it right then. Show the code of your ass_client.lua[/QUOTE]
ass_client.lua
[code]include("ass_shared.lua")
ASS_Initialized = false
local PLAYER = FindMetaTable("Player")
function PLAYER:UniqueID() return self:GetNetworkedString("ASS_UniqueID") end
PLAYER = nil
function ASS_BanPlayer( INFO )
if (!ValidEntity(INFO.Player)) then
return true
end
if (#INFO.Reason > 0) then
RunConsoleCommand("ASS_BanPlayer", INFO.Player:UniqueID(), INFO.Time, INFO.Reason)
else
RunConsoleCommand("ASS_BanPlayer", INFO.Player:UniqueID(), INFO.Time)
end
return true
end
function ASS_KickPlayer( INFO )
if (!ValidEntity(INFO.Player)) then
return true
end
if (#INFO.Reason > 0) then
RunConsoleCommand("ASS_KickPlayer", INFO.Player:UniqueID(), INFO.Reason)
else
RunConsoleCommand("ASS_KickPlayer", INFO.Player:UniqueID() )
end
return true
end
function ASS_SetAccess( PLAYER, LEVEL, TIME )
if (!ValidEntity(PLAYER)) then
return true
end
if (TIME) then
RunConsoleCommand("ASS_PromotePlayer", PLAYER:UniqueID(), LEVEL, TIME)
else
RunConsoleCommand("ASS_PromotePlayer", PLAYER:UniqueID(), LEVEL)
end
end
function ASS_CustomReason(INFO)
Derma_StringRequest( "Custom Reason...",
"Why do you want to " .. INFO.Type .. " " .. INFO.Player:Nick() .. "?",
"",
function( strTextOut )
table.insert(ASS_Config["reasons"], { name = strTextOut, reason = strTextOut } )
ASS_WriteConfig()
INFO.Reason = strTextOut
INFO.Function(INFO)
end
)
end
function ASS_KickBanReasonMenu( MENU, INFO )
INFO = INFO or {}
for k, v in pairs(ASS_Config["reasons"]) do
MENU:AddOption( (v.name or ("Unnamed #" .. k)),
function()
INFO.Reason = v.reason or ""
return INFO.Function(INFO)
end
)
end
MENU:AddSpacer()
MENU:AddOption( "Custom...",
function()
ASS_CustomReason(INFO)
end
)
end
function ASS_BanTimeMenu( MENU, PLAYER )
for k, v in pairs(ASS_Config["ban_times"]) do
local txt = v.name or ("Unnamed #" .. k)
MENU:AddSubMenu( txt, nil, function(NEWMENU) ASS_KickBanReasonMenu( NEWMENU, { ["Type"] = "ban", ["Function"] = ASS_BanPlayer, ["Player"] = PLAYER, ["Time"] = v.time } ) end )
end
end
function ASS_KickReasonMenu( MENUITEM, PLAYER, INFO )
INFO = {}
INFO.Function = ASS_KickPlayer
INFO.Type = "kick"
INFO.Player = PLAYER
ASS_KickBanReasonMenu(MENUITEM, INFO)
end
function ASS_TempAdminMenu( MENU, PLAYER )
for k, v in pairs(ASS_Config["temp_admin_times"]) do
MENU:AddOption(v.name, function() ASS_SetAccess(PLAYER, ASS_LVL_TEMPADMIN, v.time) end )
end
end
function ASS_AccessMenu( SUBMENU, PLAYER )
local Items = {}
Items[ASS_LVL_SERVER_OWNER] = SUBMENU:AddOption( "Server Owner", function() ASS_SetAccess(PLAYER, ASS_LVL_SERVER_OWNER) end )
Items[ASS_LVL_SUPER_ADMIN] = SUBMENU:AddOption( "Super Admin", function() ASS_SetAccess(PLAYER, ASS_LVL_SUPER_ADMIN) end )
Items[ASS_LVL_ADMIN] = SUBMENU:AddOption( "Admin", function() ASS_SetAccess(PLAYER, ASS_LVL_ADMIN) end )
Items[ASS_LVL_TEMPADMIN] = SUBMENU:AddSubMenu( "Temp Admin" , nil, function(NEWMENU) ASS_TempAdminMenu( NEWMENU, PLAYER ) end )
Items[ASS_LVL_RESPECTED] = SUBMENU:AddOption( "Respected", function() ASS_SetAccess(PLAYER, ASS_LVL_RESPECTED) end )
Items[ASS_LVL_GUEST] = SUBMENU:AddOption( "Guest", function() ASS_SetAccess(PLAYER, ASS_LVL_GUEST) end )
Items[ASS_LVL_BANNED] = SUBMENU:AddOption( "Previously Banned", function() ASS_SetAccess(PLAYER, ASS_LVL_BANNED) end )
if (Items[ PLAYER:GetLevel() ]) then
Items[PLAYER:GetLevel()]:SetImage("gui/silkicons/check_on_s")
end
end
function ASS_TableContains( TAB, VAR )
if (!TAB) then
return false
end
for k,v in pairs(TAB) do
if (v == VAR) then
return true
end
end
return false
end
// Oh god this is going to be hacky
function ASS_FixMenu( MENU )
// Call the callback when we need to build the menu
// If we're creating the menu now, also register our
// hacked functions with it, so this hack propagates
// virus like among any DMenus spawned from this
// parent DMenu.. muhaha
function DMenuOption_OnCursorEntered(self)
local m = self.SubMenu
if (self.BuildFunction) then
m = DermaMenu( self )
ASS_FixMenu(m)
m:SetVisible( false )
m:SetParent( self:GetParent() )
PCallError( self.BuildFunction, m)
end
self.ParentMenu:OpenSubMenu( self, m )
end
// Menu item images!
function DMenuOption_SetImage(self, img)
self.Image = ASS_Icon(img)
end
// Change the released hook so that if the click function
// returns a non-nil or non-false value then the menus
// get closed (this way menus can stay opened and be clicked
// several time).
function DMenuOption_OnMouseReleased( self, mousecode )
DButton.OnMouseReleased( self, mousecode )
if ( self.m_MenuClicking ) then
self.m_MenuClicking = false
if (!self.ClickReturn) then
CloseDermaMenus()
end
end
end
// Make sure we draw the image, should be done in the skin
// but this is a total hack, so meh.
function DMenuOption_Paint(self)
derma.SkinHook( "Paint", "MenuOption", self )
if (self.Image) then
surface.SetTexture( self.Image )
surface.SetDrawColor( 255, 255, 255, 255 )
surface.DrawTexturedRect( 2, (self:GetTall() - 16) * 0.5, 16, 16)
end
return false
end
// Make DMenuOptions implement our new functions above.
// Returns the new DMenuOption created.
local function DMenu_AddOption( self, strText, funcFunction )
local pnl = vgui.Create( "DMenuOption", self )
pnl.OnCursorEntered = DMenuOption_OnCursorEntered
pnl.OnMouseReleased = DMenuOption_OnMouseReleased
pnl.Paint = DMenuOption_Paint
pnl.SetImage = DMenuOption_SetImage
pnl:SetText( strText )
if ( funcFunction ) then
pnl.DoClick = function(self)
self.ClickReturn = funcFunction(pnl)
end
end
self:AddPanel( pnl )
return pnl
end
// Make DMenuOptions implement our new functions above.
// If we're creating the menu now, also register our
// hacked functions with it, so this hack propagates
// virus like among any DMenus spawned from this
// parent DMenu.. muhaha
// Returns the new DMenu (if it exists), and the DMenuOption
// created.
local function DMenu_AddSubMenu( self, strText, funcFunction, openFunction )
local SubMenu = nil
if (!openFunction) then
SubMenu = DermaMenu( self )
ASS_FixMenu(SubMenu)
SubMenu:SetVisible( false )
SubMenu:SetParent( self )
end
local pnl = vgui.Create( "DMenuOption", self )
pnl.OnCursorEntered = DMenuOption_OnCursorEntered
pnl.OnMouseReleased = DMenuOption_OnMouseReleased
pnl.Paint = DMenuOption_Paint
pnl.SetImage = DMenuOption_SetImage
pnl.BuildFunction = openFunction
pnl:SetSubMenu( SubMenu )
pnl:SetText( strText )
if ( funcFunction ) then
pnl.DoClick = function() pnl.ClickReturn = funcFunction(pnl) end
else
pnl.DoClick = function() pnl.ClickReturn = true end
end
self:AddPanel( pnl )
if (SubMenu) then
return SubMenu, pnl
else
return pnl
end
end
// Register our new hacked function. muhahah
MENU.AddOption = DMenu_AddOption
MENU.AddSubMenu = DMenu_AddSubMenu
end
// See, told you it was hacky, hopefully won't have to do this for much longer
// This function was once fairly neat and tidy... Now it's a big
// mess of anonymous functions and submenus.
// I'd tidy it up, but I think it'd stop working, or break everything...
// It's only the "IncludeAll" options that really screw it up actually,
// but it adds soo much flexability it's totally worth it.
function ASS_PlayerMenu( SUBMENU, OPTIONS, FUNCTION, ... )
if (type(SUBMENU) != "Panel") then Msg("ASS_PlayerMenu: SUBMENU isn't a menu!\n") return end
local others = player.GetAll()
local includeSubMenus = ASS_TableContains(OPTIONS, "HasSubMenu")
local includeSelf = ASS_TableContains(OPTIONS, "IncludeLocalPlayer")
local includeAll = ASS_TableContains(OPTIONS, "IncludeAll")
local includeAllSO = ASS_TableContains(OPTIONS, "IncludeAllSO")
local NumOpti
Replace it with
[code]
include("ass_shared.lua")
ASS_Initialized = false
local PLAYER = FindMetaTable("Player")
function PLAYER:UniqueID() return self:GetNetworkedString("ASS_UniqueID") end
PLAYER = nil
function ASS_KickPlayer( INFO )
if (!ValidEntity(INFO.Player)) then
return true
end
if (#INFO.Reason > 0) then
RunConsoleCommand("ASS_KickPlayer", INFO.Player:UniqueID(), INFO.Reason)
else
RunConsoleCommand("ASS_KickPlayer", INFO.Player:UniqueID() )
end
return true
end
function ASS_SetAccess( PLAYER, LEVEL, TIME )
if (!ValidEntity(PLAYER)) then
return true
end
RunConsoleCommand("ASS_PromotePlayer", PLAYER:UniqueID(), LEVEL)
end
function ASS_CustomReason(INFO)
Derma_StringRequest( "Custom Reason...",
"Why do you want to " .. INFO.Type .. " " .. INFO.Player:Nick() .. "?",
"",
function( strTextOut )
table.insert(ASS_Config["reasons"], { name = strTextOut, reason = strTextOut } )
ASS_WriteConfig()
INFO.Reason = strTextOut
INFO.Function(INFO)
end
)
end
function ASS_KickReasonMenu( MENUITEM, PLAYER, INFO )
INFO = {}
INFO.Function = ASS_KickPlayer
INFO.Type = "kick"
INFO.Player = PLAYER
for k, v in pairs(ASS_Config["reasons"]) do
MENUITEM:AddOption( (v.name or ("Unnamed #" .. k)),
function()
INFO.Reason = v.reason or ""
return INFO.Function(INFO)
end
)
end
MENUITEM:AddSpacer()
MENUITEM:AddOption( "Custom...",
function()
ASS_CustomReason(INFO)
end
)
end
function ASS_TempAdminMenu( MENU, PLAYER )
for k, v in pairs(ASS_Config["temp_admin_times"]) do
MENU:AddOption(v.name, function() ASS_SetAccess(PLAYER, ASS_LVL_TEMPADMIN, v.time) end )
end
end
function ASS_AccessMenu( SUBMENU, PLAYER )
local Items = {}
Items[ASS_LVL_SUPER_ADMIN] = SUBMENU:AddOption( "Super Admin", function() ASS_SetAccess(PLAYER, ASS_LVL_SUPER_ADMIN) end )
Items[ASS_LVL_ADMIN] = SUBMENU:AddOption( "Admin", function() ASS_SetAccess(PLAYER, ASS_LVL_ADMIN) end )
Items[ASS_LVL_TEMPADMIN] = SUBMENU:AddSubMenu( "Temp Admin" , nil, function(NEWMENU) ASS_TempAdminMenu( NEWMENU, PLAYER ) end )
Items[ASS_LVL_GUEST] = SUBMENU:AddOption( "Guest", function() ASS_SetAccess(PLAYER, ASS_LVL_GUEST) end )
if (Items[ PLAYER:GetLevel() ]) then
Items[ PLAYER:GetLevel() ]:SetImage("gui/silkicons/check_on_s")
end
end
function ASS_TableContains( TAB, VAR )
if (!TAB) then
return false
end
for k,v in pairs(TAB) do
if (v == VAR) then
return true
end
end
return false
end
// Oh god this is going to be hacky
// Fixed by SammyServers.com
function ASS_FixMenu( MENU )
// Call the callback when we need to build the menu
// If we're creating the menu now, also register our
// hacked functions with it, so this hack propagates
// virus like among any DMenus spawned from this
// parent DMenu.. muhaha
function DMenuOption_OnCursorEntered(self)
local m = self.SubMenu
if (self.BuildFunction) then
m = DermaMenu( self )
ASS_FixMenu(m)
m:SetVisible( false )
m:SetParent( self:GetParent() )
PCallError( self.BuildFunction, m)
end
self.ParentMenu:OpenSubMenu( self, m )
end
// Menu item images!
function DMenuOption_SetImage(self, img)
self.Image = ASS_Icon(img)
end
// Change the released hook so that if the click function
// returns a non-nil or non-false value then the menus
// get closed (this way menus can stay opened and be clicked
// several time).
function DMenuOption_OnMouseReleased( self, mousecode )
DButton.OnMouseReleased( self, mousecode )
if ( self.m_MenuClicking ) then
self.m_MenuClicking = false
if (!self.ClickReturn) then
CloseDermaMenus()
end
end
end
// Make sure we draw the image, should be done in the skin
// but this is a total hack, so meh.
function DMenuOption_Paint(self)
derma.SkinHook( "Paint", "MenuOption", self )
if (self.Image) then
surface.SetTexture( self.Image )
surface.SetDrawColor( 255, 255, 255, 255 )
surface.DrawTexturedRect( 2, (self:GetTall() - 16) * 0.5, 16, 16)
end
return false
end
// Make DMenuOptions implement our new functions above.
// Returns the new DMenuOption created.
local function DMenu_AddOption( self, strText, funcFunction )
local pnl = vgui.Create( "DMenuOption", self )
pnl.OnCursorEntered = DMenuOption_OnCursorEntered
pnl.OnMouseReleased = DMenuOption_OnMouseReleased
pnl.Paint = DMenuOption_Paint
pnl.SetImage = DMenuOption_SetImage
pnl:SetText( strText )
if ( funcFunction ) then
pnl.DoClick = function(self)
self.ClickReturn = funcFunction(pnl)
end
end
self:AddPanel( pnl )
return pnl
end
// Make DMenuOptions implement our new functions above.
// If we're creating the menu now, also register our
// hacked functions with it, so this hack propagates
// virus like among any DMenus spawned from this
// parent DMenu.. muhaha
// Returns the new DMenu (if it exists), and the DMenuOption
// created.
local function DMenu_AddSubMenu( self, strText, funcFunction, openFunction )
local SubMenu = nil
if (!openFunction) then
SubMenu = DermaMenu( self )
ASS_FixMenu(SubMenu)
SubMenu:SetVisible( false )
SubMenu:SetParent( self )
end
local pnl = vgui.Create( "DMenuOption", self )
pnl.OnCursorEntered = DMenuOption_OnCursorEntered
pnl.OnMouseReleased = DMenuOption_OnMouseReleased
pnl.Paint = DMenuOption_Paint
pnl.SetImage = DMenuOption_SetImage
pnl.BuildFunction = openFunction
pnl:SetSubMenu( SubMenu )
pnl:SetText( strText )
if ( funcFunction ) then
pnl.DoClick = function() pnl.ClickReturn = funcFunction(pnl) end
else
pnl.DoClick = function() pnl.ClickReturn = true end
end
self:AddPanel( pnl )
if (SubMenu) then
return SubMenu, pnl
else
return pnl
end
end
// Register our new hacked function. muhahah
MENU.AddOption = DMenu_AddOption
MENU.AddSubMenu = DMenu_AddSubMenu
end
// See, told you it was hacky, hopefully won't have to do this for much longer
// This function was once fairly neat and tidy... Now it's a big
// mess of anonymous functions and submenus.
// I'd tidy it up, but I think it'd stop working, or break everything...
// It's only the "IncludeAll" options that really screw it up actually,
// but it adds soo much flexability it's totally worth it.
function ASS_PlayerMenu( SUBMENU, OPTIONS, FUNCTION, ... )
if (type(SUBMENU) != "Panel") then Msg("ASS_PlayerMenu: SUBMENU isn't a menu!\n") return end
local others = player.GetAll()
local includeSubMenus = ASS_TableContains(OPTIONS, "HasSubMenu")
local includeSelf = ASS_TableContains(OPTIONS, "IncludeLocalPlayer")
local includeAll = ASS_TableContains(OPTIONS, "IncludeAll")
local includeAllSO = ASS_TableContains(OPTIONS, "IncludeAllSO")
local NumOptions = 0
if (includeAll || includeAllSO) then
/* I love anonymous functions, good luck understanding what this does! */
if (LocalPlayer():HasLevel(ASS_LVL_SERVER_OWNER) || includeAllSO) then
SUBMENU:AddSubMenu( "All", nil,
function(ALLMENU)
Sorry, you need to Log In to post a reply to this thread.