Advertisement
Guest User

Untitled

a guest
Jan 4th, 2020
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 15.44 KB | None | 0 0
  1. -- mgui by QBER
  2. local mgui={}local c={}local d={}local e={{}}mgui.bind_field=function(f,h,width,caption,mgui_id,i)if c[mgui_id][1]==null then c[mgui_id]={"",false,0,0}e_text=""e_code=0;c[mgui_id][4]=e_code;c[mgui_id][1]=e_text else e_text=c[mgui_id][1]e_code=c[mgui_id][4]end;results=null;height=18;n_left=f+d[i][1]n_top=h+d[i][2]n_width=100;if mgui.mouse_mov(n_left,n_top,28,width)and e[1][7]~=true then mgui.color_aw("gui_controls3")else mgui.color_aw("gui_groupbox_background")end;drawing.block(n_left,n_top,28,width)mgui.color_aw("gui_text2")draw.Text(n_left+7,n_top+7,caption)n_left=f+d[i][1]+width-110;mgui.color_aw("gui_controls1")drawing.block_round(n_left+4,n_top+5,height,n_width)if mgui.mouse_mov(n_left+4,n_top+5,height,n_width)and c[mgui_id][2]==false and e[1][7]~=true then mgui.color_aw("gui_controls2")if input.IsButtonPressed(1)then if c[mgui_id][2]==false then c[mgui_id][2]=true;c[mgui_id][3]=0 end end else mgui.color_aw("gui_controls3")end;if mgui.mouse_mov(n_left+4,n_top+5,height,n_width)and e[1][7]~=true and c[mgui_id][2]==false then else if e_code~=0 then if input.IsButtonPressed(e_code)then results=true end end end;if input.IsButtonPressed(27)then c[mgui_id][2]=false;c[mgui_id][1]=""c[mgui_id][3]=0;c[mgui_id][4]=0 end;if c[mgui_id][2]==true and c[mgui_id][3]==1 then s_text="< SELECT KEY >"mgui.color_aw("gui_controls2")in_text,in_key=mgui.input_to_key()if in_text~=""then e_text=in_text;c[mgui_id][1]=e_text;c[mgui_id][2]=false;c[mgui_id][4]=in_key end else c[mgui_id][3]=1;s_text=e_text end;drawing.encircle_round(n_left+4,n_top+5,height,n_width)c_w,c_h=draw.GetTextSize(e_text)n_button_left=n_left+12;n_button_top=n_top+5+height/2-c_h/2;mgui.color_aw("gui_text2")draw.Text(n_button_left,n_button_top,s_text)if result~=null then return results end end;mgui.input_to_key=function()t_key={{112,"f1"},{113,"f2"},{114,"f3"},{115,"f4"},{116,"f5"},{117,"f6"},{118,"f7"},{119,"f8"},{120,"f9"},{121,"f10"},{122,"f11"},{123,"f12"},{96,"num0"},{97,"num1"},{98,"num2"},{99,"num3"},{100,"num4"},{101,"num5"},{102,"num6"},{103,"num7"},{104,"num8"},{105,"num9"},{192,"`"},{189,"-"},{187,"="},{219,"["},{221,"]"},{186,":"},{222,'"'},{220,"|"},{188,","},{190,"."},{191,"/"},{1,"mouse1"},{2,"mouse2"},{4,"mouse3"},{5,"mouse4"},{6,"mouse5"},{32,"space"},{40,"down"},{46,"delete"},{44,"printscreen"},{145,"scrolllock"}}result="",0;for j=1,26 do if input.IsButtonPressed(j+64)then return string.lower(string.char(j+64)),j+64 end end;for j=1,10 do if input.IsButtonPressed(j+47)then return string.char(j+47),j+47 end end;for j=1,#t_key do if input.IsButtonPressed(t_key[j][1])then return t_key[j][2],t_key[j][1]end end;return result end;mgui.itembox=function(f,h,width,text,item_text,k,mgui_id,i)if c[mgui_id][1]==null then c[mgui_id]={k,false}else k=c[mgui_id][1]act_item=c[mgui_id][2]end;height=18;n_left=f+d[i][1]n_top=h+d[i][2]if mgui.mouse_mov(n_left,n_top,45,width)and e[1][7]~=true then mgui.color_aw("gui_controls3")else mgui.color_aw("gui_groupbox_background")end;drawing.block(n_left,n_top,45,width)mgui.color_aw("gui_text2")draw.Text(n_left+7,n_top+3,text)n_top=n_top+20;n_left=n_left+5;n_width=width-10;mgui.color_aw("gui_controls1")drawing.block_round(n_left,n_top,height,n_width)if mgui.mouse_mov(n_left,n_top,height,width)and e[1][7]~=true then mgui.color_aw("gui_controls2")if input.IsButtonPressed(1)then if c[mgui_id][2]==false then c[mgui_id][2]=true end end else if c[mgui_id][2]==true then mgui.color_aw("gui_controls2")else mgui.color_aw("gui_controls3")end end;drawing.encircle_round(n_left,n_top,height,n_width)mgui.color_aw("gui_text2")draw.Text(n_left+8,n_top+2,item_text[k])if c[mgui_id][2]==true then mgui.item(n_left,n_top,height,n_width,item_text,mgui_id)end;return c[mgui_id][1],item_text[c[mgui_id][1]]end;mgui.slider=function(f,h,width,l,text,m,n,mgui_id,i)if c[mgui_id][1]==null then n_width=width-10;step=n_width/l;current_pos=step*n;c[mgui_id]={n,false,current_pos}n_current=c[mgui_id][1]w_current=c[mgui_id][3]else n_current=c[mgui_id][1]n_activ=c[mgui_id][2]w_current=c[mgui_id][3]end;n_left=f+d[i][1]n_top=h+d[i][2]n_height=45;if mgui.mouse_mov(n_left,n_top,n_height,width)and e[1][7]~=true then mgui.color_aw("gui_controls3")else mgui.color_aw("gui_groupbox_background")end;drawing.block(n_left,n_top,n_height,width)mgui.color_aw("gui_slider_bar1")drawing.block(n_left+5,n_top+20,4,width-10)mgui.color_aw("gui_text2")draw.Text(n_left+5,n_top+3,text)mgui.color_aw("gui_controls2")drawing.block(n_left+5,n_top+20,4,w_current)if mgui.mouse_mov(n_left,n_top,n_height,width-10)and e[1][7]~=true then mgui.color_aw("gui_slider_bar2")else mgui.color_aw("gui_slider_bar3")end;drawing.block(n_left+3+w_current,n_top+18,8,4)if mgui.mouse_mov(n_left,n_top,n_height,width-10)and e[1][7]~=true then if input.IsButtonDown(1)then m_x,m_y=input.GetMousePos()n_width=width-10;step=n_width/l;pos=m_x-n_left;pos_line=math.floor(pos/step)n_current=pos_line;w_current=pos;current_pos=step*pos_line;c[mgui_id][1]=n_current;c[mgui_id][3]=current_pos end end;mgui.color_aw("gui_text2")c_w,c_h=draw.GetTextSize(n_current..m)draw.Text(n_left+width/2-c_w/2,n_top+28,n_current..m)return n_current end;mgui.edit=function(f,h,width,caption,text,mgui_id,i)if c[mgui_id][1]==null then c[mgui_id]={"",false}e_text=text;c[mgui_id][1]=text else e_text=c[mgui_id][1]end;height=18;n_left=f+d[i][1]n_top=h+d[i][2]if mgui.mouse_mov(n_left,n_top,40,width)and e[1][7]~=true then mgui.color_aw("gui_controls3")else mgui.color_aw("gui_groupbox_background")end;drawing.block(n_left,n_top,n_height,width)mgui.color_aw("gui_controls1")drawing.block_round(n_left+5,n_top+20,height,width-10)if mgui.mouse_mov(n_left+5,n_top+20,height,width-10)and e[1][7]~=true then mgui.color_aw("gui_controls2")if input.IsButtonDown(1)then mgui.color_aw("gui_controls2")if c[mgui_id][2]==false then c[mgui_id][2]=true end end else if input.IsButtonDown(1)then if c[mgui_id][2]==true then c[mgui_id][2]=false end end;mgui.color_aw("gui_controls3")end;if c[mgui_id][2]==true then mgui.color_aw("gui_controls1")s_text=e_text.."_"else s_text=e_text end;if c[mgui_id][2]==true then if input.IsButtonPressed(8)then e_text=string.sub(e_text,1,string.len(e_text)-1)c[mgui_id][1]=e_text end;in_text=mgui.input_to_text()c_w,c_h=draw.GetTextSize(e_text)if in_text~=""and c_w<width-20 then e_text=e_text..in_text;c[mgui_id][1]=e_text end end;if c[mgui_id][2]==true then mgui.color_aw("gui_controls2")end;drawing.encircle_round(n_left+5,n_top+20,height,width-10)c_w,c_h=draw.GetTextSize(e_text)n_button_left=n_left+8;n_button_top=n_top+height/2-c_h/2;mgui.color_aw("gui_text2")draw.Text(n_button_left,n_button_top+20,s_text)draw.Text(n_left+6,n_top+3,caption)return e_text end;mgui.input_to_text=function()result=""for j=1,26 do if input.IsButtonPressed(j+64)then if input.IsButtonDown(16)then result=string.char(j+64)else result=string.lower(string.char(j+64))end end end;for j=1,10 do if input.IsButtonPressed(j+47)then result=string.char(j+47)end end;if input.IsButtonPressed(32)then result=" "end;return result end;mgui.checkbox=function(a,b,c,f,g,h,i)local j=g;local k=a+d[i][1]local l=b+d[i][2]if mgui.mouse_mov(k,l,16,c)and e[1][7]~=true then mgui.color_aw("gui_controls3")else mgui.color_aw("gui_groupbox_background")end;drawing.block(k,l,21,c)if mgui.mouse_mov(k,l,16,c)and e[1][7]~=true then if j then mgui.color_aw("gui_checkbox_on_hover")else mgui.color_aw("gui_checkbox_off_hover")end;if input.IsButtonPressed(1)then mgui.color_aw("gui_checkbox_on_hover")if j==false then j=true else j=false end end else if j then mgui.color_aw("gui_checkbox_on")else mgui.color_aw("gui_checkbox_off")end end;drawing.block_round(k+4,l+5,12,12)if j then mgui.color_aw("gui_controls2")else mgui.color_aw("gui_controls3")end;if mgui.mouse_mov(k,l,16,c)and e[1][7]~=true then mgui.color_aw("gui_controls2")end;drawing.encircle_round(k+4,l+5,12,12)local m=k+17;local n=l-1;mgui.color_aw("gui_text2")draw.Text(m+4,n+5,f)return j end mgui.button=function(f,h,height,width,caption,mgui_id,i)if c[mgui_id][1]then else c[mgui_id]={false}end;if i==0 then n_left=f;n_top=h else n_left=f+d[i][1]n_top=h+d[i][2]end;result=false;if mgui.mouse_mov(n_left,n_top,height,width)and e[1][7]~=true then mgui.color_aw("gui_button_hover")if input.IsButtonDown(1)then mgui.color_aw("gui_button_clicked")end;if input.IsButtonPressed(1)then result=true end else mgui.color_aw("gui_button_idle")end;drawing.block_round(n_left,n_top,height,width)c_w,c_h=draw.GetTextSize(caption)n_button_left=n_left+width/2-c_w/2;n_button_top=n_top+height/2-c_h/2;mgui.color_aw("gui_text1")draw.Text(n_button_left,n_button_top,caption)return result end;mgui.panel=function(f,h,height,width,caption,mgui_id,i)mgui.color_aw("gui_groupbox_background")n_left=f+d[i][1]n_top=h+d[i][2]drawing.block(n_left,n_top,height,width)mgui.color_aw("gui_groupbox_outline")drawing.shadow(n_left,n_top,height,width)if caption then c_w,c_h=draw.GetTextSize(caption)mgui.color_aw("gui_groupbox_background")drawing.block(n_left+10,n_top-4,c_h+2,c_w+8)mgui.color_aw("gui_text2")draw.Text(n_left+14,n_top-5,caption)end end;mgui.label=function(f,h,caption,mgui_id,i)mgui.color_aw("gui_text2")n_left=f+d[i][1]n_top=h+d[i][2]draw.Text(n_left,n_top,caption)end;mgui.menu=function(f,h,height,width,caption,mgui_id)if d[mgui_id][1]then m_left=d[mgui_id][1]m_top=d[mgui_id][2]else m_left=f;m_top=h;d[mgui_id]={f,h,false,width}end;mgui.color_aw("gui_window_background")drawing.block(m_left,m_top,height,width)mgui.color_aw("gui_window_header")drawing.block(m_left,m_top-25,25,width)mgui.color_aw("gui_window_header_tab2")drawing.block(m_left,m_top,4,width)mgui.color_aw("gui_text1")draw.TextShadow(m_left+8,m_top-18,caption)end;mgui.item=function(f,h,height,width,item_text,mgui_id)e[1]={f,h,height,width,item_text,mgui_id,true}end;mgui.item_show=function()if e[1][7]then n_left=e[1][1]n_top=e[1][2]height=e[1][3]width=e[1][4]item_text=e[1][5]mgui_id=e[1][6]s_top=n_top+20;s_height=#item_text*15;mgui.color_aw("gui_combobox_drop1")drawing.block(n_left,s_top,s_height,width)drawing.shadow(n_left,s_top,s_height,width)for j=1,#item_text do if mgui.mouse_mov(n_left,s_top+15*j-14,14,width)then if input.IsButtonDown(1)then c[mgui_id][1]=j;c[mgui_id][2]=false;e[1][7]=false end;mgui.color_aw("gui_combobox_drop3")drawing.block(n_left,s_top+15*j-15,15,width)end;mgui.color_aw("gui_text2")draw.Text(n_left+8,s_top+15*j+1-15,item_text[j])end;if mgui.mouse_mov(n_left,n_top,height,width)then else if input.IsButtonDown(1)then if c[mgui_id][2]==true then c[mgui_id][2]=false;e[1][7]=false end end end end end;local p={{}}mgui.msg=function(caption,text)p[1]={caption,text,true}end;mgui.msg_show=function()if p[1][3]==true then s_w,s_h=draw.GetScreenSize()msg_height=90;msg_width=350;m_left=s_w/2-msg_width/2;m_top=s_h/2-msg_height/2;caption=p[1][1]text=p[1][2]draw.Color(237,237,237,255)drawing.block(m_left,m_top,msg_height,msg_width)draw.Color(194,33,33,150)drawing.block(m_left,m_top-25,25,msg_width)draw.Color(255,71,71,255)drawing.block(m_left,m_top,4,msg_width)draw.Color(38,38,38,180)drawing.block(m_left,m_top+msg_height,5,msg_width)draw.Color(247,247,247,255)draw.TextShadow(m_left+8,m_top-18,caption)draw.Color(41,41,41,255)draw.Text(m_left+10,m_top+20,text)draw.Color(186,186,186,255)drawing.shadow(m_left,m_top-25,msg_height+30,msg_width)if mgui.button(m_left+45,m_top+50,28,250,"OK",#c,0)then p[1]={"","",false}end end end;mgui.menu_mouse=function(mgui_id)m_left=d[mgui_id][1]m_top=d[mgui_id][2]if input.IsButtonDown(1)then m_x,m_y=input.GetMousePos()if d[mgui_id][3]then d[mgui_id][1]=m_x-c_m_x;d[mgui_id][2]=m_y-c_m_y+25 end;if m_x>=m_left and m_x<=m_left+d[mgui_id][4]and m_y>=m_top-25 and m_y<=m_top and d[mgui_id][3]==false then d[mgui_id][3]=true;c_m_x=m_x-m_left;c_m_y=m_y-m_top+25 end else d[mgui_id][3]=false end end;mgui.mouse_mov=function(f,h,height,width)m_x,m_y=input.GetMousePos()if m_x>=f and m_x<=f+width and m_y>=h and m_y<=h+height then return true end end;mgui.color_aw=function(q)r,g,b,a=gui.GetValue("clr_"..q)draw.Color(r,g,b,a)end;mgui.max_component=function(s,t)if c[1]==null then for j=1,t do table.insert(c,{})end;for j=1,s do table.insert(d,{})end end end;drawing={}drawing.block=function(f,h,height,width)draw.FilledRect(f,h,f+width,h+height)end;drawing.block_round=function(f,h,height,width)draw.RoundedRectFill(f,h,f+width,h+height)end;drawing.encircle=function(f,h,height,width)draw.OutlinedRect(f,h,f+width,h+height)end;drawing.encircle_round=function(f,h,height,width)draw.RoundedRect(f,h,f+width,h+height)end;drawing.triangle=function(u,v,height,w)height_t=height;left_l=u;left_r=u;top_l=v;top_r=v;if w==1 then draw.Line(u,v,u,v-height)end;if w==2 then draw.Line(u,v,u,v+height)end;if w==3 then draw.Line(u,v,u+height,v)end;if w==4 then draw.Line(u,v,u-height,v)end;for j=1,1000 do height_t=height_t-1;left_l=left_l-1;left_r=left_r+1;top_l=top_l-1;top_r=top_r+1;if height_t<0 then break end;if w==1 then draw.Line(left_l,v-height_t,left_l,v)draw.Line(left_r,v-height_t,left_r,v)end;if w==2 then draw.Line(left_l,v,left_l,v+height_t)draw.Line(left_r,v,left_r,v+height_t)end;if w==3 then draw.Line(u,top_l,u+height_t,top_l)draw.Line(u,top_r,u+height_t,top_r)end;if w==4 then draw.Line(u-height_t,top_l,u,top_l)draw.Line(u-height_t,top_r,u,top_r)end end end;drawing.shadow=function(f,h,height,width)alpha=100;left_s=f;top_s=h;height_s=height;width_s=width;for j=1,1 do alpha=alpha-20;left_s=left_s-1;top_s=top_s-1;height_s=height_s+2;width_s=width_s+2;draw.Color(10,10,10,alpha)drawing.encircle(left_s,top_s,height_s,width_s)end;alpha=20;for j=1,10 do alpha=alpha-2;if alpha<0 then break end;left_s=left_s-1;top_s=top_s-1;height_s=height_s+2;width_s=width_s+2;draw.Color(10,10,10,alpha)drawing.encircle(left_s,top_s,height_s,width_s)end end; mgui.label=function(left, top, text, menu_id) local n_left=left+d[menu_id][1];local n_top=top+d[menu_id][2];mgui.color_aw("gui_text2");draw.Text(n_left,n_top,text)end;
  3.  
  4. local ui_ref = gui.Reference("MISC", "ENHANCEMENT", "Appearance");
  5. local ui_enable = gui.Checkbox(ui_ref, "msc_sc", "Enable Score Changer", 0);
  6.  
  7. local function GetPlayers(); local p = {};
  8.     for i = globals.MaxClients(), 1, -1 do;        
  9.         if (client.GetPlayerNameByIndex(i) ~= nil) then; if (client.GetPlayerInfo(i)["IsGOTV"] == false and entities.GetPlayerResources():GetPropInt("m_iTeam", math.floor(i)) ~= 1) then;
  10.             table.insert(p, {["index"] = i, ["name"] = client.GetPlayerNameByIndex(i)});
  11. end; end; end; return p; end;
  12.  
  13. callbacks.Register("Draw", function();
  14.     if not ui_enable:GetValue() or not gui.Reference("MENU"):IsActive() then; return; end;
  15.  
  16.     mgui.max_component(1, 10);
  17.     mgui.menu(25, 25, 275, 280, "Score Changer", 1);
  18.     mgui.menu_mouse(1);
  19.  
  20.     local players = GetPlayers();
  21.     if (next(players) == nil) then; draw.SetFont(draw.CreateFont("Tahoma", 14));
  22.     mgui.label(95, 135, "No player found.", 1); return; end;
  23.    
  24.     local names = {}; for i = 1, #players do
  25.     table.insert(names, players[i]["name"]); end;
  26.    
  27.     local selected_ui_index = mgui.itembox(15, 15, 250, "Player", names, 1, 2, 1);
  28.     if(players[selected_ui_index] == nil) then; return; end;
  29.     local selected_player_index = math.floor(players[selected_ui_index]["index"]);
  30.  
  31.     ui_slider_kill = mgui.slider(15, 70, 250, 150,"Kills","", 1, 3, 1)
  32.     ui_slider_assist = mgui.slider(15, 125, 250, 150,"Assists","", 1, 4, 1)
  33.     ui_slider_death = mgui.slider(15, 180, 250, 150,"Deaths","", 1, 5, 1)
  34.     ui_apply = mgui.button(15, 235, 25, 250, "Apply", 6, 1)
  35.  
  36.     if ui_apply == true then;
  37.         entities.GetPlayerResources():SetPropInt(ui_slider_kill, "m_iKills", selected_player_index);
  38.         entities.GetPlayerResources():SetPropInt(ui_slider_assist, "m_iAssists", selected_player_index);
  39.     entities.GetPlayerResources():SetPropInt(ui_slider_death, "m_iDeaths", selected_player_index); end;
  40. mgui.item_show(); end);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement