Advertisement
Guest User

Untitled

a guest
Jun 29th, 2014
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.80 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using System.IO;
  11.  
  12. namespace WindowsFormsApplication7
  13. {
  14. public partial class Form1 : Form
  15. {
  16. public Form1()
  17. {
  18. InitializeComponent();
  19. textBox4.Hide();
  20. textBox6.Hide();
  21. label1.Hide();
  22. textBox5.Hide();
  23. checkBox1.Hide();
  24. label2.Hide();
  25. listBox2.Hide();
  26. listBox3.Hide();
  27. }
  28.  
  29.  
  30. private void textBox1_TextChanged(object sender, EventArgs e)
  31. {
  32.  
  33. }
  34.  
  35. private void label1_Click(object sender, EventArgs e)
  36. {
  37.  
  38. }
  39.  
  40. private void textBox4_TextChanged(object sender, EventArgs e)
  41. {
  42.  
  43. }
  44.  
  45. private void button1_Click(object sender, EventArgs e)
  46. {
  47. string name = textBox2.Text.Replace(" ", string.Empty); ;
  48. name = name.ToLower();
  49. var file = File.Create( textBox1.Text + "\\" + name + ".lua" );
  50. file.Close();
  51. string code = "";
  52. if (listBox1.SelectedIndex == 2) {
  53. code =
  54.  
  55. @"ITEM.Name = '" + textBox2.Text + @"'
  56. ITEM.Price = " + textBox3.Text + @"
  57. ITEM.Model = '" + textBox4.Text + @"'
  58. ITEM.AdminOnly = " + (checkBox2.Checked ? "true" : "false") + @"
  59. function ITEM:OnEquip(ply, modifications)
  60. if not ply._OldModel then
  61. ply._OldModel = ply:GetModel()
  62. end
  63.  
  64. timer.Simple(1, function() ply:SetModel(self.Model) end)
  65. end
  66.  
  67. function ITEM:OnHolster(ply)
  68. if ply._OldModel then
  69. ply:SetModel(ply._OldModel)
  70. end
  71. end
  72.  
  73. function ITEM:PlayerSetModel(ply)
  74. ply:SetModel(self.Model)
  75. end
  76. ";
  77. }
  78. if (listBox1.SelectedIndex == 4)
  79. {
  80. code =
  81.  
  82. @"ITEM.Name = '" + textBox2.Text + @"'
  83. ITEM.Price = " + textBox3.Text + @"
  84. ITEM.Material = '" + textBox6.Text + @"'
  85. ITEM.AdminOnly = " + (checkBox2.Checked ? "true" : "false") + @"
  86. function ITEM:OnEquip(ply, modifications)
  87. ply." + name + @" = util.SpriteTrail(ply, 0, modifications.color, false, 15, 1, 4, 0.125, self.Material)
  88. end
  89.  
  90. function ITEM:OnHolster(ply)
  91. SafeRemoveEntity(ply." + name + @")
  92. end
  93.  
  94. function ITEM:Modify(modifications)
  95. PS:ShowColorChooser(self, modifications)
  96. end
  97.  
  98. function ITEM:OnModify(ply, modifications)
  99. SafeRemoveEntity(ply." + name + @")
  100. self:OnEquip(ply, modifications)
  101. end
  102. ";
  103. }
  104.  
  105. if (listBox1.SelectedIndex == 5)
  106. {
  107. code =
  108.  
  109. @"
  110. ITEM.Name = '" + textBox2.Text + @"'
  111. ITEM.Price = " + textBox3.Text + @"
  112. ITEM.Model = '"+ textBox4.Text + @"'
  113. ITEM.WeaponClass = '" + textBox5.Text + @"'
  114. ITEM.SingleUse = " + (checkBox1.Checked ? "true" : "false") + @"
  115. ITEM.AdminOnly = " + (checkBox2.Checked ? "true" : "false") + @"
  116.  
  117. function ITEM:OnBuy(ply)
  118. ply:Give(self.WeaponClass)
  119. ply:SelectWeapon(self.WeaponClass)
  120. end
  121.  
  122. function ITEM:OnSell(ply)
  123. ply:StripWeapon(self.WeaponClass)
  124. end
  125. ";
  126. }
  127.  
  128. File.WriteAllText(textBox1.Text + "\\" + name + ".lua", code);
  129. }
  130.  
  131. private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
  132. {
  133. textBox4.Hide();
  134. textBox6.Hide();
  135. textBox5.Hide();
  136. checkBox1.Hide();
  137. label1.Hide();
  138. label2.Hide();
  139. listBox2.Hide();
  140. listBox3.Hide();
  141. switch (listBox1.SelectedIndex){
  142. case 0:
  143. textBox4.Show();
  144. textBox4.Text = "Model path";
  145. listBox2.Show();
  146. label1.Show();
  147. break;
  148. case 1:
  149. textBox4.Show();
  150. textBox4.Text = "Model path";
  151. label2.Show();
  152. listBox3.Show();
  153. break;
  154. case 2:
  155. textBox4.Show();
  156. textBox4.Text = "Model path";
  157. break;
  158. case 3:
  159. textBox4.Show();
  160. textBox4.Text = "Model path";
  161. break;
  162. case 4:
  163. textBox6.Show();
  164. textBox6.Text = "Material path";
  165. break;
  166. case 5:
  167. textBox4.Show();
  168. textBox5.Show();
  169. checkBox1.Show();
  170. break;
  171. }
  172. }
  173.  
  174. private void label1_Click_1(object sender, EventArgs e)
  175. {
  176.  
  177. }
  178.  
  179. private void listBox2_SelectedIndexChanged(object sender, EventArgs e)
  180. {
  181.  
  182. }
  183. }
  184. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement