• Lua error chapter 2
    3 replies, posted
[IMG]https://pp.userapi.com/c626421/v626421225/6a163/_XGsU4POBvI.jpg[/IMG] Help
Code?
[QUOTE=code_gs;52190184]Code?[/QUOTE] [QUOTE]function OpenContextMenu(ply, argm, cmd) local context = DermaMenu() if ply:isCP() or ply:Team() == TEAM_MAYOR then local submenu, edit = context:AddSubMenu ("Обьявить розыск") edit:SetImage ("icon16/medal_bronze_1.png") for _,v in pairs (player.GetAll()) do if v != LocalPlayer() then submenu:AddOption (v:Name(), function() draw_textbox("Введите причну для розыска", "Объявить в розыск", "", function(a) RunConsoleCommand ("say", "/wanted "..v:Name().." "..tostring(a)) end) end):SetImage("icon16/user.png") end end context:AddOption ("Выдать лицензию", function() RunConsoleCommand ("say", "/givelicense") end):SetImage("icon16/page_add.png") local unwanted, unwanted2 = context:AddSubMenu("Снять Розыск") unwanted2:SetImage ("icon16/medal_bronze_delete.png") for _,v in pairs (player.GetAll()) do if v != LocalPlayer() then unwanted:AddOption (v:Name(), function() RunConsoleCommand ("say", "/unwanted "..v:Name()) end):SetImage ("icon16/user.png") end end local warrnat, warrnaedit = context:AddSubMenu ("Запросить обыск") warrnaedit:SetImage ("icon16/door_in.png") for _,v in pairs (player.GetAll()) do if v != LocalPlayer() then warrnat:AddOption (v:Name(), function() draw_textbox("Введите причну обыска", "Обыскать", "", function(a) RunConsoleCommand ("say", "/warrant "..v:Name().." "..tostring(a)) end) end):SetImage("icon16/user.png") end end end context:AddSpacer() if ply:Team() == TEAM_MAYOR then if (GetGlobalBool("DarkRP_LockDown")) == true then context:AddOption ("Выключить Ком.час", function () RunConsoleCommand ("say", "/unlockdown") end):SetImage("icon16/delete.png") else context:AddOption ("Включить ком.час", function () RunConsoleCommand ("say", "/lockdown") end):SetImage ("icon16/exclamation.png") end context:AddOption ("Добавить закон", function() draw_textbox("Введите закон", "Добавить", "", function(a) RunConsoleCommand ("say", "/addlaw "..tostring(a)) end) end):SetImage ("icon16/tick.png") context:AddOption ("Удалить закон", function() draw_textbox("Введите номер закона", "Убрать", "", function(a) RunConsoleCommand ("say", "/removelaw "..tostring(a)) end) end):SetImage ("icon16/cancel.png") end context:AddSpacer() local demotemenu, edited = context:AddSubMenu("Уволить игрока") edited:SetImage ("icon16/error_delete.png") for _,v in pairs (player.GetAll()) do if v != LocalPlayer() then demotemenu:AddOption (v:Name(), function () draw_textbox("Введите причину увольнения", "Уволить", "", function(a) RunConsoleCommand ("say", "/demote "..v:Name().." "..tostring(a)) end) end):SetImage("icon16/user_delete.png") end end context:AddOption ("Передать деньги тому на кого вы смотрите", function () draw_textbox("Введите кол-во", "Передать", "", function(a) RunConsoleCommand ("say", "/give "..tostring(a)) end) end):SetImage ("icon16/money.png") context:AddOption( "Выбросить оружие", function() RunConsoleCommand ("say", "/dropweapon") end ):SetImage("icon16/attach.png") context:AddOption( "Выбросить деньги", function() draw_textbox("Введите кол-во", "Выбросить", "", function(a) RunConsoleCommand ("say", "/dropmoney "..tostring(a)) end) end ):SetImage("icon16/money.png") context:AddSpacer() context:AddOption("Изменить РП имя", function() draw_textbox("Изменить РП имя", "Изменить", "", function(a) RunConsoleCommand ("say", "/name "..tostring(a)) end) end):SetImage("icon16/page_edit.png") context:AddOption ("Продать все двери", function() RunConsoleCommand ("say", "/unownalldoors") end):SetImage("icon16/door.png") context:Open() context:CenterHorizontal() context.y = ScrH() + 100 context:MoveTo(context.x, ScrH() - context:GetTall() - 8, .0, 0) end end concommand.Add("open_context_menu", OpenContextMenu)[/QUOTE]
In the future, please use code tags. Also, this is not the full code -- the error is on line 137 and the code is only 90 lines. Also, you should be using local functions if you're just going to be sending it into concommand.Add and not use it outside of the file.
Sorry, you need to Log In to post a reply to this thread.