• Help with admin mod
    8 replies, posted
My friend is creating a small admin mod but having problem kicking people There are no Errors just doesnt do anything The server side is fine and he doesnt want me uploading that part Client Side [CODE]local PlayerList = vgui.Create("DComboBox", MenuPanel) PlayerList:SetPos(5, 220) PlayerList:SetSize(MenuPanel:GetWide()-10, 210) PlayerList:SetMultiple( false ) for k,v in pairs(player.GetAll()) do PlayerList:AddItem(v:Nick()) end local KickButton = vgui.Create("DButton", MenuPanel) KickButton:SetWidth(MapMenu:GetSize()/2-25) KickButton:SetHeight(25) KickButton:SetPos(5, 440) KickButton:SetText("Kick") KickButton.DoClick = function( KickButton ) RunConsoleCommand( "kickid", PlayerList:GetSelectedItems()[1]:GetValue()) MapMenu:Remove() end[/CODE]
it's kick not kickid.
What if you wanna kick someone using their name with a reason
[lua]local PlayerList = vgui.Create("DComboBox", MenuPanel) PlayerList:SetPos(5, 220) PlayerList:SetSize(MenuPanel:GetWide()-10, 210) PlayerList:SetMultiple( false ) for k,v in pairs(player.GetAll()) do PlayerList:AddItem(v:Nick()) end local KickButton = vgui.Create("DButton", MenuPanel) KickButton:SetWidth(MapMenu:GetSize()/2-25) KickButton:SetHeight(25) KickButton:SetPos(5, 440) KickButton:SetText("Kick") KickButton.DoClick = function( KickButton ) RunConsoleCommand( "kick", PlayerList:GetSelectedItems()[1]:GetValue()) MapMenu:Remove() end[/lua] This should work.
[lua] local PlayerList = vgui.Create("DComboBox", MenuPanel) PlayerList:SetPos(5, 220) PlayerList:SetSize(MenuPanel:GetWide()-10, 210) PlayerList:SetMultiple( false ) for k,v in pairs(player.GetAll()) do PlayerList:AddItem(v:Nick()) end local KickButton = vgui.Create("DButton", MenuPanel) KickButton:SetWidth(MapMenu:GetSize()/2-25) KickButton:SetHeight(25) KickButton:SetPos(5, 440) KickButton:SetText("Kick") KickButton.DoClick = function( KickButton ) Derma_StringRequest("Kicking: "..PlayerList:GetSelectedItems()[1]:GetValue(), "Kick Reason", "", function(Text) RunConsoleCommand("kickid", PlayerList:GetSelectedItems()[1]:GetValue(), Text) end, function(Text) end, "Kick", "Cancel") MapMenu:Remove() end [/lua] Error: GetSelectedItems (A nil value) Line: RunConsoleCommand("kickid", PlayerList:GetSelectedItems()[1]:GetValue(), Text) [editline]08:54PM[/editline] I'm trying to make it so it kicks you with a reason.
[QUOTE][lua] end, function(Text) end, "Kick", "Cancel") MapMenu:Remove() end [/lua][/QUOTE] What is this for?
Kick and Cancel button
I noticed that when selecting a player then pressing kick it will say the name then name not found
Yeah it will display on top of the derma "Kicking jaythorpe" and then a reason box.
Sorry, you need to Log In to post a reply to this thread.