• Demote menu error
    1 replies, posted
Hey, im creating a demote menu in darkrp so the mayor can fire people, here is the code: local DemoteTeams = {TEAM_SWAT, TEAM_POLICE, TEAM_MEDIC, TEAM_SWATS} -- Teams the mayor can demote local MayorTeam = TEAM_MAYOR -- The name of the mayor team if CLIENT then • • function DemotePlayer(ply) • • • • net.Start("MayorDemote") • • • • net.WriteString(ply:SteamID()) • • • • net.SendToServer() • • end • • function OpenDemoteMenu() • • • • local frame = vgui.Create("DFrame") • • • • frame:SetSize(620,600) • • • • frame:Center(700,600) • • • • frame:MakePopup() • • • • frame:SetTitle("Demote Menu") • • • • function frame:Paint(w,h) • • • • • • • • • • draw.RoundedBox(0,0,0,w,h,Color(80,80,80)) • • • • • • draw.RoundedBox(0,2,2,w-4,h-4,Color(150,150,150)) • • • • • • draw.RoundedBox(0,0,0,w,24,Color(80,80,80)) • • • • end • • • • • • • • local listpnl • = vgui.Create( "DIconLayout", frame ) • • • • listpnl:SetSize(600,600) • • • • //List:SetPos( 0, 0 ) • • • • listpnl:SetPos( 20,28 ) • • • • listpnl:CenterHorizontal() • • • • listpnl:SetSpaceY( 5 ) • • • • listpnl:SetSpaceX( 5 ) • • • • listpnl.Paint = function(s,w,h) • • • • • • //draw.RoundedBox(0,0,0,w,h,Color(110,110,110)) • • • • end • • • • listpnl:LayoutIcons_TOP(true) • • • • • • • • • for _,ply in pairs(player.GetAll()) do • • • • • • if table.HasValue(DemoteTeams,ply:Team()) then • • • • • • • • local row = vgui.Create("DPanel",listpnl) • • • • • • • • row:SetSize(600,20) • • • • • • • • row.player = ply • • • • • • • • row.Paint = function(s,w,h) • • • • • • • • • • draw.RoundedBox(8,0,0,w,h,Color(100,100,100)) • • • • • • • • end • • • • • • • • row.text = vgui.Create("DLabel",row) • • • • • • • • row.text:Dock(LEFT) • • • • • • • • row.text:DockMargin(10,0,0,0) • • • • • • • • row.text:SetFont("Trebuchet18") • • • • • • • • row.text:SetText(ply:Nick().." : "..ply:getJobTable().name) • • • • • • • • row.text:SizeToContents() • • • • • • • • row.demote = vgui.Create("DButton",row) • • • • • • • • row.demote:Dock(RIGHT) • • • • • • • • row.demote:SetText("Demote") • • • • • • • • row.demote:SetFont("Trebuchet18") • • • • • • • • row.demote.Paint = function(s,w,h) • • • • • • • • • • draw.RoundedBox(0,0,0,w,h,Color(255,0,0)) • • • • • • • • end • • • • • • • • row.demote:SetSize(60,20) • • • • • • • • row.demote:SetTextColor(Color(255,255,255)) • • • • • • • • row.demote.DoClick = function(s) • • • • • • • • • • DemotePlayer(s:GetParent().player) • • • • • • • • • • s:GetParent():Remove() • • • • • • • • end • • • • • • end • • • • end • • end • else • • util.AddNetworkString("MayorDemote") • • net.Receive("MayorDemote",function(l,ply) • • • • if ply:Team() == MayorTeam then • • • • • • local ent = player.GetBySteamID(net.ReadString()) • • • • • • ent:changeTeam(TEAM_CITIZEN) • • • • end • • end) • • hook.Add("PlayerSay","check",function(ply,txt) • • • • if txt == "!Fire" and ply:Team() == MayorTeam then • • • • • • ply:SendLua('OpenDemoteMenu()') • • • • end • • end) end Im gettin this error [ERROR] addons/demotemenu/lua/autorun/sh_init.lua:4: '=' expected near ' ' 1. unknown - addons/demotemenu/lua/autorun/sh_init.lua:0 What do I do (im very new to lua)
I don't know what you're doing in the OP, but here it is without a ton of bullets for anyone who wants to help. [lua]local DemoteTeams = {TEAM_SWAT, TEAM_POLICE, TEAM_MEDIC, TEAM_SWATS} -- Teams the mayor can demote local MayorTeam = TEAM_MAYOR -- The name of the mayor team if CLIENT then function DemotePlayer(ply) net.Start("MayorDemote") net.WriteString(ply:SteamID()) net.SendToServer() end function OpenDemoteMenu() local frame = vgui.Create("DFrame") frame:SetSize(620,600) frame:Center(700,600) frame:MakePopup() frame:SetTitle("Demote Menu") function frame:Paint(w,h) draw.RoundedBox(0,0,0,w,h,Color(80,80,80)) draw.RoundedBox(0,2,2,w-4,h-4,Color(150,150,150)) draw.RoundedBox(0,0,0,w,24,Color(80,80,80)) end local listpnl = vgui.Create( "DIconLayout", frame ) listpnl:SetSize(600,600) //List:SetPos( 0, 0 ) listpnl:SetPos( 20,28 ) listpnl:CenterHorizontal() listpnl:SetSpaceY( 5 ) listpnl:SetSpaceX( 5 ) listpnl.Paint = function(s,w,h) //draw.RoundedBox(0,0,0,w,h,Color(110,110,110)) end listpnl:LayoutIcons_TOP(true) for _,ply in pairs(player.GetAll()) do if table.HasValue(DemoteTeams,ply:Team()) then local row = vgui.Create("DPanel",listpnl) row:SetSize(600,20) row.player = ply row.Paint = function(s,w,h) draw.RoundedBox(8,0,0,w,h,Color(100,100,100)) end row.text = vgui.Create("DLabel",row) row.text:Dock(LEFT) row.text:DockMargin(10,0,0,0) row.text:SetFont("Trebuchet18") row.text:SetText(ply:Nick().." : "..ply:getJobTable().name) row.text:SizeToContents() row.demote = vgui.Create("DButton",row) row.demote:Dock(RIGHT) row.demote:SetText("Demote") row.demote:SetFont("Trebuchet18") row.demote.Paint = function(s,w,h) draw.RoundedBox(0,0,0,w,h,Color(255,0,0)) end row.demote:SetSize(60,20) row.demote:SetTextColor(Color(255,255,255)) row.demote.DoClick = function(s) DemotePlayer(s:GetParent().player) s:GetParent():Remove() end end end end else util.AddNetworkString("MayorDemote") net.Receive("MayorDemote",function(l,ply) if ply:Team() == MayorTeam then local ent = player.GetBySteamID(net.ReadString()) ent:changeTeam(TEAM_CITIZEN) end end) hook.Add("PlayerSay","check",function(ply,txt) if txt == "!Fire" and ply:Team() == MayorTeam then ply:SendLua('OpenDemoteMenu()') end end) end [/lua]
Sorry, you need to Log In to post a reply to this thread.