Guest User

p90 options.lua

a guest
Aug 16th, 2021
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.21 KB | None | 0 0
  1. function init()
  2.     unlimitedammo = GetBool("savegame.mod.unlimitedammo")
  3.     unlimitedclip = GetBool("savegame.mod.unlimitedclip")
  4.     input_mode = GetString("savegame.mod.mode_input")
  5.     input_type = GetString("savegame.mod.type_input")
  6.     input_scope = GetString("savegame.mod.scope_input")
  7.     smoke_firing = GetFloat("savegame.mod.smoke_firing")
  8.     smoke_impact = GetFloat("savegame.mod.smoke_impact")
  9.     bullet_spread = GetFloat("savegame.mod.bullet_spread")
  10.     if input_mode == "" then input_mode = "C" end
  11.     if input_type == "" then input_type = "V" end
  12.     if input_scope == "" then input_scope = "T" end
  13.     if smoke_firing == 0 then smoke_firing = 5 end
  14.     if smoke_impact == 0 then smoke_impact = 20 end
  15.     changing_mode = 0
  16.     smoke_amount_changed = false
  17.     bullet_spread_changed = false
  18. end
  19.  
  20. function draw()
  21.     UiTranslate(UiCenter(), 350)
  22.     UiAlign("center middle")
  23.  
  24.     UiFont("bold.ttf", 48)
  25.     UiText("P90 by gs_115")
  26.     UiFont("regular.ttf", 26)
  27.     UiTranslate(0, 150)
  28.     UiPush()
  29.         UiTranslate(95, -100)
  30.         UiButtonImageBox("ui/common/box-outline-6.png", 6, 6)
  31.         last_input = InputLastPressedKey()
  32.         if last_input ~= "" then
  33.             if changing_mode == 1 then input_mode = last_input
  34.             elseif changing_mode == 2 then input_type = last_input
  35.             else input_scope = last_input end
  36.             SetString("savegame.mod.mode_input", input_mode)
  37.             SetString("savegame.mod.type_input", input_type)
  38.             SetString("savegame.mod.scope_input", input_scope)
  39.             SetString("savegame.mod.bullet_spread", bullet_spread)
  40.             changing_mode = 0
  41.         end
  42.         if UiTextButton(input_mode, 50, 30) and changing_mode == 0 then --Mode Input
  43.             input_mode = "..."
  44.             changing_mode = 1
  45.         end
  46.         UiTranslate(-110, 0)
  47.         UiText("Auto/Semi-Auto:", 150, 30)
  48.         UiTranslate(110, 20)
  49.         if UiTextButton(input_type, 50, 30) and changing_mode == 0 then --Type Input
  50.             input_type = "..."
  51.             changing_mode = 2
  52.         end
  53.         UiTranslate(-128, 0)
  54.         UiText("Change Ammo Type:", 150, 30)
  55.         UiTranslate(128, 20)
  56.         if UiTextButton(input_scope, 50, 30) and changing_mode == 0 then --Scope Input
  57.             input_scope = "..."
  58.             changing_mode = 3
  59.         end
  60.         UiTranslate(-97, 0)
  61.         UiText("Change Sight:", 150, 30)
  62.         UiTranslate(97, 0)
  63.     UiPop()
  64.     UiTranslate(0, 50)
  65.     UiPush()
  66.         UiTranslate(-50, -10)
  67.         UiText("Shooting: Smoke Amount:" ,150, 30)
  68.         UiTranslate(-22, 15)
  69.         UiText("Bullet Impact: Smoke Amount:" ,150, 30)
  70.         UiTranslate(-12, 15)
  71.         UiText("Bullet spread" ,150, 30)
  72.         UiTranslate(190, -110)
  73.         UiButtonImageBox("ui/common/box-outline-6.png", 6, 6)
  74.         if UiTextButton("<", 40 ,30) then smoke_amount_changed, smoke_firing = true, math.max(math.floor(smoke_firing-1), 0.1)  end
  75.         UiTranslate(45, 0)
  76.         UiText(math.floor(smoke_firing), 40 ,30)
  77.         UiTranslate(45, -26)
  78.         if UiTextButton(">", 40 ,30) then smoke_amount_changed, smoke_firing = true, math.min(math.floor(smoke_firing+1), 20)  end
  79.        
  80.         UiTranslate(-90, 40)
  81.         if UiTextButton("<", 40 ,30) then smoke_amount_changed, smoke_impact = true, math.max(math.floor(smoke_impact-1), 0.1) end
  82.         UiTranslate(45, 0)
  83.         UiText(math.floor(smoke_impact), 40 ,30)
  84.         UiTranslate(45, -26)
  85.         if UiTextButton(">", 40 ,30) then smoke_amount_changed, smoke_impact = true, math.min(math.floor(smoke_impact+1), 20) end
  86.         if smoke_amount_changed then
  87.             smoke_amount_changed = false
  88.             SetFloat("savegame.mod.smoke_firing", smoke_firing)
  89.             SetFloat("savegame.mod.smoke_impact", smoke_impact)
  90.         end
  91.        
  92.         UiTranslate(-90, 40)
  93.         if UiTextButton("<", 40 ,30) then bullet_spread_changed, bullet_spread = true, math.max(math.floor(bullet_spread-1), 0) end
  94.         UiTranslate(45, 0)
  95.         UiText(math.floor(bullet_spread), 40 ,30)
  96.         UiTranslate(45, -26)
  97.         if UiTextButton(">", 40 ,30) then bullet_spread_changed, bullet_spread = true, math.min(math.floor(bullet_spread+1), 20) end
  98.         if bullet_spread_changed then
  99.             bullet_spread_changed = false
  100.             SetFloat("savegame.mod.bullet_spread", bullet_spread)
  101.         end
  102.        
  103.     UiPop()
  104.     UiTranslate(0, 120)
  105.     UiPush()
  106.         UiText("Unlimited Clip")
  107.         UiTranslate(15, 40)
  108.         UiAlign("right")
  109.         UiColor(0.5, 0.8, 1)
  110.         if unlimitedclip then
  111.             if UiTextButton("Yes", 40, 20) then
  112.                 unlimitedclip = false
  113.                 unlimitedammo = false
  114.                 SetBool("savegame.mod.unlimitedclip", unlimitedclip)
  115.                 SetBool("savegame.mod.unlimitedammo", unlimitedammo)
  116.             end
  117.         else
  118.             if UiTextButton("No", 40, 20) then
  119.                 unlimitedclip = true
  120.                 unlimitedammo = false
  121.                 SetBool("savegame.mod.unlimitedclip", unlimitedclip)
  122.                 SetBool("savegame.mod.unlimitedammo", unlimitedammo)
  123.             end
  124.         end
  125.     UiPop()
  126.     if unlimitedclip then
  127.         UiPush()
  128.             UiTranslate(15, 60)
  129.             UiText("Unlimited Ammo")
  130.             UiTranslate(0, 40)
  131.             UiAlign("right")
  132.             UiColor(0.5, 0.8, 1)
  133.             if unlimitedammo then
  134.                 if UiTextButton("Yes", 40, 20) then
  135.                     unlimitedammo = false
  136.                     SetBool("savegame.mod.unlimitedammo", unlimitedammo)
  137.                 end
  138.             else
  139.                 if UiTextButton("No", 40, 20) then
  140.                     unlimitedammo = true
  141.                     SetBool("savegame.mod.unlimitedammo", unlimitedammo)
  142.                 end
  143.         end
  144.          UiPop()
  145.     end
  146.  
  147.     UiButtonImageBox("ui/common/box-outline-6.png", 6, 6)
  148.  
  149.     local pos_y
  150.     if unlimitedclip then pos_y = 140 else pos_y = 80 end
  151.     UiTranslate(0, pos_y)
  152.     if UiTextButton("Close", 80, 40) then
  153.         Menu()
  154.     end
  155. end
Advertisement
Add Comment
Please, Sign In to add comment