Advertisement
Guest User

Untitled

a guest
Jan 17th, 2020
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 16.69 KB | None | 0 0
  1. local ui_slider_max = 150 -- This is the max value of kills, assists (...)
  2.  
  3. 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,"******"},{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(f,h,width,caption,o,mgui_id,i)if c[mgui_id][1]==null then c[mgui_id]={o}else n_checked=c[mgui_id][1]end;result=0;n_left=f+d[i][1]n_top=h+d[i][2]if mgui.mouse_mov(n_left,n_top,16,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,21,width)if mgui.mouse_mov(n_left,n_top,16,width)and e[1][7]~=true then if n_checked 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 c[mgui_id][1]==false then c[mgui_id][1]=true;result=true else c[mgui_id][1]=false;result=false end end else if n_checked then mgui.color_aw("gui_checkbox_on")else mgui.color_aw("gui_checkbox_off")end end;drawing.block_round(n_left+4,n_top+5,12,12)if n_checked then mgui.color_aw("gui_controls2")else mgui.color_aw("gui_controls3")end;if mgui.mouse_mov(n_left,n_top,16,width)and e[1][7]~=true then mgui.color_aw("gui_controls2")end;drawing.encircle_round(n_left+4,n_top+5,12,12)n_button_left=n_left+17;n_button_top=n_top-1;mgui.color_aw("gui_text2")draw.Text(n_button_left+4,n_button_top+5,caption)if result~=0 then return result end 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_window_footer")drawing.block(m_left,m_top+height,20,width)mgui.color_aw("gui_text1")draw.TextShadow(m_left+8,m_top-18,caption)mgui.color_aw("gui_window_footer_text")draw.TextShadow(m_left+8,m_top+height+4,"")drawing.shadow(m_left,m_top-25,height+45,width)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
  4.  
  5. local ui_ref = gui.Reference("MISC", "ENHANCEMENT", "Appearance");
  6. local ui_enable = gui.Checkbox(ui_ref, "msc_sc", "Enable Score Changer", 0);
  7.  
  8. local function GetPlayers(); local p = {};
  9.     for i = globals.MaxClients(), 1, -1 do;        
  10.         if (client.GetPlayerNameByIndex(i) ~= nil) then; if (client.GetPlayerInfo(i)["IsGOTV"] == false and entities.GetPlayerResources():GetPropInt("m_iTeam", math.floor(i)) ~= 1) then;
  11.             table.insert(p, {["index"] = i, ["name"] = client.GetPlayerNameByIndex(i)});
  12. end; end; end; return p; end;
  13.  
  14. local function ui();
  15.     if not ui_enable:GetValue() or not gui.Reference("MENU"):IsActive() then; return; end;
  16.     mgui.max_component(1, 9); mgui.menu(25, 25, 410, 280, "Score Changer", 1); mgui.menu_mouse(1);
  17.  
  18.     local players = GetPlayers();
  19.     if (next(players) == nil) then; draw.SetFont(draw.CreateFont("Tahoma", 14));
  20.     mgui.label(95, 135, "No player found.", 2, 1); return; end;
  21.    
  22.     local names = {}; for i = 1, #players do
  23.     table.insert(names, players[i]["name"]); end;    
  24.     local selected_ui_index = mgui.itembox(15, 15, 250, "Player", names, 1, 2, 1);
  25.     if(players[selected_ui_index] == nil) then; return; end;
  26.     local selected_player_index = math.floor(players[selected_ui_index]["index"]);
  27.  
  28.     ui_slider_kill = mgui.slider(15, 70, 250, ui_slider_max,"Kills","", 1, 3, 1);
  29.     ui_slider_assist = mgui.slider(15, 125, 250, ui_slider_max,"Assists","", 1, 4, 1);
  30.     ui_slider_death = mgui.slider(15, 180, 250, ui_slider_max,"Deaths","", 1, 5, 1);
  31.     ui_slider_mvp = mgui.slider(15, 235, 250, ui_slider_max / 3,"MVPs","", 1, 6, 1);
  32.  
  33.     ui_cb_score = mgui.checkbox(15,290,250,"Automatic Score",false,7,1);  
  34.     if ui_cb_score == true then; ui_score_mode = 0; elseif ui_cb_score == false then; ui_score_mode = 1; end;
  35.     if ui_score_mode == 0 then; ui_slider_score = mgui.slider(15, 320, 250, ui_slider_max,"Extra Score","", 1, 8, 1);
  36.     else; ui_slider_score = mgui.slider(15, 320, 250, ui_slider_max,"Score","", 1, 8, 1); end;
  37.  
  38.     ui_apply = mgui.button(15, 375, 25, 250, "Apply", 9, 1);
  39.     if ui_apply == true then;
  40.         entities.GetPlayerResources():SetPropInt(ui_slider_kill, "m_iKills", selected_player_index);
  41.         entities.GetPlayerResources():SetPropInt(ui_slider_assist, "m_iAssists", selected_player_index);
  42.         entities.GetPlayerResources():SetPropInt(ui_slider_death, "m_iDeaths", selected_player_index);
  43.         if ui_score_mode == 0 then; ui_score = ui_slider_kill * 2 + ui_slider_assist + ui_slider_score; else; ui_score = ui_slider_score; end;
  44.         entities.GetPlayerResources():SetPropInt((ui_score), "m_iScore", selected_player_index);
  45.     entities.GetPlayerResources():SetPropInt(ui_slider_mvp, "m_iMVPs", selected_player_index); end;
  46. mgui.item_show(); end; callbacks.Register("Draw", ui);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement