Advertisement
Sasino97

[ENGLISH]Sasinosoft Teleport Maker

Jul 3rd, 2011
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 16.27 KB | None | 0 0
  1. #pragma once
  2.  
  3. namespace TeleportMaker {
  4.  
  5.     using namespace System;
  6.     using namespace System::ComponentModel;
  7.     using namespace System::Collections;
  8.     using namespace System::Windows::Forms;
  9.     using namespace System::Data;
  10.     using namespace System::Drawing;
  11.  
  12.     /// <summary>
  13.     /// Riepilogo per Form1
  14.     /// </summary>
  15.     public ref class Form1 : public System::Windows::Forms::Form
  16.     {
  17.     public:
  18.         Form1(void)
  19.         {
  20.             InitializeComponent();
  21.             //
  22.             //TODO: aggiungere qui il codice del costruttore.
  23.             //
  24.         }
  25.  
  26.     protected:
  27.         /// <summary>
  28.         /// Liberare le risorse in uso.
  29.         /// </summary>
  30.         ~Form1()
  31.         {
  32.             if (components)
  33.             {
  34.                 delete components;
  35.             }
  36.         }
  37.     private: System::Windows::Forms::TextBox^  X_BOX;
  38.     protected:
  39.  
  40.     protected:
  41.     private: System::Windows::Forms::Label^  label1;
  42.     private: System::Windows::Forms::Label^  label2;
  43.     private: System::Windows::Forms::TextBox^  Y_BOX;
  44.  
  45.     private: System::Windows::Forms::Label^  label3;
  46.     private: System::Windows::Forms::TextBox^  Z_BOX;
  47.     private: System::Windows::Forms::TextBox^  COMMAND_BOX;
  48.     private: System::Windows::Forms::Label^  label4;
  49.     private: System::Windows::Forms::Label^  label5;
  50.     private: System::Windows::Forms::TextBox^  INTERIOR_BOX;
  51.     private: System::Windows::Forms::Label^  label6;
  52.     private: System::Windows::Forms::TextBox^  WORLD_BOX;
  53.     private: System::Windows::Forms::CheckBox^  CHECK_CAR;
  54.     private: System::Windows::Forms::Label^  label7;
  55.     private: System::Windows::Forms::TextBox^  SOUND_BOX;
  56.     private: System::Windows::Forms::TextBox^  RESULT_BOX;
  57.     private: System::Windows::Forms::Button^  Bottone;
  58.     private: System::Windows::Forms::Label^  label8;
  59.     private: System::Windows::Forms::TextBox^  MESSAGE_BOX;
  60.     private: System::Windows::Forms::ColorDialog^  colorDialog1;
  61.     private: System::Windows::Forms::ListBox^  ListaColori;
  62.     private: System::Windows::Forms::RadioButton^  radioButton1;
  63.     private: System::Windows::Forms::RadioButton^  radioButton2;
  64.     private: System::Windows::Forms::ProgressBar^  Barra;
  65.     private: System::Windows::Forms::Timer^  Timer;
  66.     private: System::ComponentModel::IContainer^  components;
  67.  
  68.  
  69.  
  70.  
  71.     private:
  72.         /// <summary>
  73.         /// Variabile di progettazione necessaria.
  74.         /// </summary>
  75.  
  76.  
  77. #pragma region Windows Form Designer generated code
  78.         /// <summary>
  79.         /// Metodo necessario per il supporto della finestra di progettazione. Non modificare
  80.         /// il contenuto del metodo con l'editor di codice.
  81.         /// </summary>
  82.         void InitializeComponent(void)
  83.         {
  84.             this->components = (gcnew System::ComponentModel::Container());
  85.             this->X_BOX = (gcnew System::Windows::Forms::TextBox());
  86.             this->label1 = (gcnew System::Windows::Forms::Label());
  87.             this->label2 = (gcnew System::Windows::Forms::Label());
  88.             this->Y_BOX = (gcnew System::Windows::Forms::TextBox());
  89.             this->label3 = (gcnew System::Windows::Forms::Label());
  90.             this->Z_BOX = (gcnew System::Windows::Forms::TextBox());
  91.             this->COMMAND_BOX = (gcnew System::Windows::Forms::TextBox());
  92.             this->label4 = (gcnew System::Windows::Forms::Label());
  93.             this->label5 = (gcnew System::Windows::Forms::Label());
  94.             this->INTERIOR_BOX = (gcnew System::Windows::Forms::TextBox());
  95.             this->label6 = (gcnew System::Windows::Forms::Label());
  96.             this->WORLD_BOX = (gcnew System::Windows::Forms::TextBox());
  97.             this->CHECK_CAR = (gcnew System::Windows::Forms::CheckBox());
  98.             this->label7 = (gcnew System::Windows::Forms::Label());
  99.             this->SOUND_BOX = (gcnew System::Windows::Forms::TextBox());
  100.             this->RESULT_BOX = (gcnew System::Windows::Forms::TextBox());
  101.             this->Bottone = (gcnew System::Windows::Forms::Button());
  102.             this->label8 = (gcnew System::Windows::Forms::Label());
  103.             this->MESSAGE_BOX = (gcnew System::Windows::Forms::TextBox());
  104.             this->colorDialog1 = (gcnew System::Windows::Forms::ColorDialog());
  105.             this->ListaColori = (gcnew System::Windows::Forms::ListBox());
  106.             this->radioButton1 = (gcnew System::Windows::Forms::RadioButton());
  107.             this->radioButton2 = (gcnew System::Windows::Forms::RadioButton());
  108.             this->Barra = (gcnew System::Windows::Forms::ProgressBar());
  109.             this->Timer = (gcnew System::Windows::Forms::Timer(this->components));
  110.             this->SuspendLayout();
  111.             //
  112.             // X_BOX
  113.             //
  114.             this->X_BOX->Location = System::Drawing::Point(32, 46);
  115.             this->X_BOX->Name = L"X_BOX";
  116.             this->X_BOX->Size = System::Drawing::Size(60, 20);
  117.             this->X_BOX->TabIndex = 0;
  118.             this->X_BOX->Text = L"0.0000";
  119.             //
  120.             // label1
  121.             //
  122.             this->label1->AutoSize = true;
  123.             this->label1->Location = System::Drawing::Point(12, 49);
  124.             this->label1->Name = L"label1";
  125.             this->label1->Size = System::Drawing::Size(14, 13);
  126.             this->label1->TabIndex = 1;
  127.             this->label1->Text = L"X";
  128.             //
  129.             // label2
  130.             //
  131.             this->label2->AutoSize = true;
  132.             this->label2->Location = System::Drawing::Point(115, 49);
  133.             this->label2->Name = L"label2";
  134.             this->label2->Size = System::Drawing::Size(14, 13);
  135.             this->label2->TabIndex = 2;
  136.             this->label2->Text = L"Y";
  137.             //
  138.             // Y_BOX
  139.             //
  140.             this->Y_BOX->Location = System::Drawing::Point(135, 46);
  141.             this->Y_BOX->Name = L"Y_BOX";
  142.             this->Y_BOX->Size = System::Drawing::Size(60, 20);
  143.             this->Y_BOX->TabIndex = 3;
  144.             this->Y_BOX->Text = L"0.0000";
  145.             //
  146.             // label3
  147.             //
  148.             this->label3->AutoSize = true;
  149.             this->label3->Location = System::Drawing::Point(219, 49);
  150.             this->label3->Name = L"label3";
  151.             this->label3->Size = System::Drawing::Size(14, 13);
  152.             this->label3->TabIndex = 4;
  153.             this->label3->Text = L"Z";
  154.             //
  155.             // Z_BOX
  156.             //
  157.             this->Z_BOX->Location = System::Drawing::Point(239, 46);
  158.             this->Z_BOX->Name = L"Z_BOX";
  159.             this->Z_BOX->Size = System::Drawing::Size(60, 20);
  160.             this->Z_BOX->TabIndex = 5;
  161.             this->Z_BOX->Text = L"0.0000";
  162.             //
  163.             // COMMAND_BOX
  164.             //
  165.             this->COMMAND_BOX->Location = System::Drawing::Point(145, 10);
  166.             this->COMMAND_BOX->Name = L"COMMAND_BOX";
  167.             this->COMMAND_BOX->Size = System::Drawing::Size(77, 20);
  168.             this->COMMAND_BOX->TabIndex = 6;
  169.             this->COMMAND_BOX->Text = L"commandname";
  170.             //
  171.             // label4
  172.             //
  173.             this->label4->AutoSize = true;
  174.             this->label4->Location = System::Drawing::Point(9, 13);
  175.             this->label4->Name = L"label4";
  176.             this->label4->Size = System::Drawing::Size(132, 13);
  177.             this->label4->TabIndex = 7;
  178.             this->label4->Text = L"Command text (With no \'/\')";
  179.             //
  180.             // label5
  181.             //
  182.             this->label5->AutoSize = true;
  183.             this->label5->Location = System::Drawing::Point(12, 84);
  184.             this->label5->Name = L"label5";
  185.             this->label5->Size = System::Drawing::Size(39, 13);
  186.             this->label5->TabIndex = 8;
  187.             this->label5->Text = L"Interior";
  188.             //
  189.             // INTERIOR_BOX
  190.             //
  191.             this->INTERIOR_BOX->Location = System::Drawing::Point(57, 81);
  192.             this->INTERIOR_BOX->Name = L"INTERIOR_BOX";
  193.             this->INTERIOR_BOX->Size = System::Drawing::Size(35, 20);
  194.             this->INTERIOR_BOX->TabIndex = 9;
  195.             this->INTERIOR_BOX->Text = L"0";
  196.             //
  197.             // label6
  198.             //
  199.             this->label6->AutoSize = true;
  200.             this->label6->Location = System::Drawing::Point(106, 84);
  201.             this->label6->Name = L"label6";
  202.             this->label6->Size = System::Drawing::Size(67, 13);
  203.             this->label6->TabIndex = 10;
  204.             this->label6->Text = L"Virtual World";
  205.             //
  206.             // WORLD_BOX
  207.             //
  208.             this->WORLD_BOX->Location = System::Drawing::Point(179, 81);
  209.             this->WORLD_BOX->Name = L"WORLD_BOX";
  210.             this->WORLD_BOX->Size = System::Drawing::Size(35, 20);
  211.             this->WORLD_BOX->TabIndex = 11;
  212.             this->WORLD_BOX->Text = L"0";
  213.             //
  214.             // CHECK_CAR
  215.             //
  216.             this->CHECK_CAR->AutoSize = true;
  217.             this->CHECK_CAR->Checked = true;
  218.             this->CHECK_CAR->CheckState = System::Windows::Forms::CheckState::Checked;
  219.             this->CHECK_CAR->Location = System::Drawing::Point(12, 119);
  220.             this->CHECK_CAR->Name = L"CHECK_CAR";
  221.             this->CHECK_CAR->Size = System::Drawing::Size(159, 17);
  222.             this->CHECK_CAR->TabIndex = 12;
  223.             this->CHECK_CAR->Text = L"Also teleport player\'s vehicle";
  224.             this->CHECK_CAR->UseVisualStyleBackColor = true;
  225.             //
  226.             // label7
  227.             //
  228.             this->label7->AutoSize = true;
  229.             this->label7->Location = System::Drawing::Point(220, 84);
  230.             this->label7->Name = L"label7";
  231.             this->label7->Size = System::Drawing::Size(38, 13);
  232.             this->label7->TabIndex = 13;
  233.             this->label7->Text = L"Sound";
  234.             //
  235.             // SOUND_BOX
  236.             //
  237.             this->SOUND_BOX->Location = System::Drawing::Point(264, 81);
  238.             this->SOUND_BOX->Name = L"SOUND_BOX";
  239.             this->SOUND_BOX->Size = System::Drawing::Size(35, 20);
  240.             this->SOUND_BOX->TabIndex = 14;
  241.             this->SOUND_BOX->Text = L"-1";
  242.             //
  243.             // RESULT_BOX
  244.             //
  245.             this->RESULT_BOX->BackColor = System::Drawing::SystemColors::ButtonHighlight;
  246.             this->RESULT_BOX->Location = System::Drawing::Point(12, 241);
  247.             this->RESULT_BOX->Multiline = true;
  248.             this->RESULT_BOX->Name = L"RESULT_BOX";
  249.             this->RESULT_BOX->ReadOnly = true;
  250.             this->RESULT_BOX->Size = System::Drawing::Size(287, 234);
  251.             this->RESULT_BOX->TabIndex = 15;
  252.             //
  253.             // Bottone
  254.             //
  255.             this->Bottone->Location = System::Drawing::Point(12, 212);
  256.             this->Bottone->Name = L"Bottone";
  257.             this->Bottone->Size = System::Drawing::Size(287, 23);
  258.             this->Bottone->TabIndex = 16;
  259.             this->Bottone->Text = L"Generate!";
  260.             this->Bottone->UseVisualStyleBackColor = true;
  261.             this->Bottone->Click += gcnew System::EventHandler(this, &Form1::Bottone_Click);
  262.             //
  263.             // label8
  264.             //
  265.             this->label8->AutoSize = true;
  266.             this->label8->Location = System::Drawing::Point(9, 152);
  267.             this->label8->Name = L"label8";
  268.             this->label8->Size = System::Drawing::Size(50, 13);
  269.             this->label8->TabIndex = 17;
  270.             this->label8->Text = L"Message";
  271.             //
  272.             // MESSAGE_BOX
  273.             //
  274.             this->MESSAGE_BOX->Location = System::Drawing::Point(73, 149);
  275.             this->MESSAGE_BOX->Name = L"MESSAGE_BOX";
  276.             this->MESSAGE_BOX->Size = System::Drawing::Size(97, 20);
  277.             this->MESSAGE_BOX->TabIndex = 18;
  278.             this->MESSAGE_BOX->Text = L"NO_MSG";
  279.             //
  280.             // ListaColori
  281.             //
  282.             this->ListaColori->FormattingEnabled = true;
  283.             this->ListaColori->Items->AddRange(gcnew cli::array< System::Object^  >(8) {L"White (FFFFFF)", L"Red (FF0000)", L"Blue (0000FF)",
  284.                 L"Yellow (FFFF00)", L"Green (00FF00)", L"Orange (FFAA00)", L"Purple (AA00FF)", L"Pink (FF00FF)"});
  285.             this->ListaColori->Location = System::Drawing::Point(179, 139);
  286.             this->ListaColori->Name = L"ListaColori";
  287.             this->ListaColori->ScrollAlwaysVisible = true;
  288.             this->ListaColori->Size = System::Drawing::Size(120, 30);
  289.             this->ListaColori->TabIndex = 19;
  290.             this->ListaColori->SelectedIndexChanged += gcnew System::EventHandler(this, &Form1::ListaColori_SelectedIndexChanged);
  291.             //
  292.             // radioButton1
  293.             //
  294.             this->radioButton1->AutoSize = true;
  295.             this->radioButton1->Checked = true;
  296.             this->radioButton1->Location = System::Drawing::Point(15, 181);
  297.             this->radioButton1->Name = L"radioButton1";
  298.             this->radioButton1->Size = System::Drawing::Size(119, 17);
  299.             this->radioButton1->TabIndex = 20;
  300.             this->radioButton1->TabStop = true;
  301.             this->radioButton1->Text = L"SendClientMessage";
  302.             this->radioButton1->UseVisualStyleBackColor = true;
  303.             //
  304.             // radioButton2
  305.             //
  306.             this->radioButton2->AutoSize = true;
  307.             this->radioButton2->Location = System::Drawing::Point(179, 181);
  308.             this->radioButton2->Name = L"radioButton2";
  309.             this->radioButton2->Size = System::Drawing::Size(118, 17);
  310.             this->radioButton2->TabIndex = 21;
  311.             this->radioButton2->Text = L"GameTextForPlayer";
  312.             this->radioButton2->UseVisualStyleBackColor = true;
  313.             //
  314.             // Barra
  315.             //
  316.             this->Barra->Location = System::Drawing::Point(15, 481);
  317.             this->Barra->Name = L"Barra";
  318.             this->Barra->Size = System::Drawing::Size(285, 23);
  319.             this->Barra->Step = 100;
  320.             this->Barra->TabIndex = 22;
  321.             //
  322.             // Timer
  323.             //
  324.             this->Timer->Interval = 1000;
  325.             this->Timer->Tick += gcnew System::EventHandler(this, &Form1::Timer_Tick);
  326.             //
  327.             // Form1
  328.             //
  329.             this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
  330.             this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
  331.             this->AutoSize = true;
  332.             this->ClientSize = System::Drawing::Size(311, 507);
  333.             this->Controls->Add(this->Barra);
  334.             this->Controls->Add(this->radioButton2);
  335.             this->Controls->Add(this->radioButton1);
  336.             this->Controls->Add(this->ListaColori);
  337.             this->Controls->Add(this->MESSAGE_BOX);
  338.             this->Controls->Add(this->label8);
  339.             this->Controls->Add(this->Bottone);
  340.             this->Controls->Add(this->RESULT_BOX);
  341.             this->Controls->Add(this->SOUND_BOX);
  342.             this->Controls->Add(this->label7);
  343.             this->Controls->Add(this->CHECK_CAR);
  344.             this->Controls->Add(this->WORLD_BOX);
  345.             this->Controls->Add(this->label6);
  346.             this->Controls->Add(this->INTERIOR_BOX);
  347.             this->Controls->Add(this->label5);
  348.             this->Controls->Add(this->label4);
  349.             this->Controls->Add(this->COMMAND_BOX);
  350.             this->Controls->Add(this->Z_BOX);
  351.             this->Controls->Add(this->label3);
  352.             this->Controls->Add(this->Y_BOX);
  353.             this->Controls->Add(this->label2);
  354.             this->Controls->Add(this->label1);
  355.             this->Controls->Add(this->X_BOX);
  356.             this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedDialog;
  357.             this->Name = L"Form1";
  358.             this->Text = L"Sasino\'s Teleport Maker";
  359.             this->ResumeLayout(false);
  360.             this->PerformLayout();
  361.  
  362.         }
  363. #pragma endregion
  364.  
  365.         System::String ^ Color;
  366.  
  367. private: System::Void Bottone_Click(System::Object^  sender, System::EventArgs^  e)
  368.          {
  369.              Barra->PerformStep();
  370.              RESULT_BOX->Text = L"Generating PAWN code...";
  371.              this->Timer->Enabled = true;
  372.          }
  373. private: System::Void ListaColori_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e)
  374.          {
  375.              if(ListaColori->SelectedIndex == 0) Color = "0xFFFFFFFF";
  376.              else if(ListaColori->SelectedIndex == 1) Color = "0xFF0000FF";
  377.              else if(ListaColori->SelectedIndex == 2) Color = "0x0000FFFF";
  378.              else if(ListaColori->SelectedIndex == 3) Color = "0xFFFF00FF";
  379.              else if(ListaColori->SelectedIndex == 4) Color = "0x00FF00FF";
  380.              else if(ListaColori->SelectedIndex == 5) Color = "0xFFAA00FF";
  381.              else if(ListaColori->SelectedIndex == 6) Color = "0xAA00FFFF";
  382.              else if(ListaColori->SelectedIndex == 7) Color = "0xFF00FFFF";
  383.              else Color = "0xFFFFFFFF";
  384.          }
  385. private: System::Void Timer_Tick(System::Object^  sender, System::EventArgs^  e)
  386.          {
  387.              Barra->Value = 0;
  388.              this->Timer->Enabled = false;
  389.  
  390.              RESULT_BOX->Text = L"if(strcmp(cmdtext, \"/";
  391.              RESULT_BOX->Text +=  COMMAND_BOX->Text;
  392.              RESULT_BOX->Text += "\", true) == 0)\r\n{\r\n    SetPlayerPos(playerid, ";
  393.              RESULT_BOX->Text += X_BOX->Text;
  394.              RESULT_BOX->Text += ", ";
  395.              RESULT_BOX->Text += Y_BOX->Text;
  396.              RESULT_BOX->Text += ", ";
  397.              RESULT_BOX->Text += Z_BOX->Text;
  398.              RESULT_BOX->Text += ");\r\n    SetPlayerInterior(playerid, ";
  399.              RESULT_BOX->Text += INTERIOR_BOX->Text;
  400.              RESULT_BOX->Text += ");\r\n    SetPlayerVirtualWorld(playerid, ";
  401.              RESULT_BOX->Text += WORLD_BOX->Text;
  402.              RESULT_BOX->Text += ");\r\n";
  403.  
  404.              if(SOUND_BOX->Text != "-1")
  405.              {
  406.                  RESULT_BOX->Text += "    new Float:X, Float:Y, Float:Z;\r\n    PlayerPlaySound(playerid, ";
  407.                  RESULT_BOX->Text += SOUND_BOX->Text;
  408.                  RESULT_BOX->Text += ", X, Y, Z);\r\n";
  409.              }
  410.              if(MESSAGE_BOX->Text != "NO_MSG")
  411.              {
  412.                  if(radioButton1->Checked)
  413.                  {
  414.                     RESULT_BOX->Text += "    SendClientMessage(playerid, ";
  415.                     RESULT_BOX->Text += Color;
  416.                     RESULT_BOX->Text += ", \"";
  417.                     RESULT_BOX->Text += MESSAGE_BOX->Text;
  418.                     RESULT_BOX->Text += "\");\r\n";
  419.                  }
  420.                  else
  421.                  {
  422.                     RESULT_BOX->Text += "    GameTextForPlayer(playerid, \"";
  423.                     RESULT_BOX->Text += MESSAGE_BOX->Text;
  424.                     RESULT_BOX->Text += "\", 2000, 5);\r\n";
  425.                  }
  426.              }
  427.  
  428.              if(CHECK_CAR->Checked)
  429.              {
  430.                  RESULT_BOX->Text += "    if(IsPlayerInAnyVehicle(playerid))\r\n    {\r\n        new vehicleid = GetPlayerVehicleID(playerid);\r\n        SetVehiclePos(vehicleid, ";
  431.                  RESULT_BOX->Text += X_BOX->Text;
  432.                  RESULT_BOX->Text += ", ";
  433.                  RESULT_BOX->Text += Y_BOX->Text;
  434.                  RESULT_BOX->Text += ", ";
  435.                  RESULT_BOX->Text += Z_BOX->Text;
  436.                  RESULT_BOX->Text += ");\r\n        LinkVehicleToInterior(vehicleid, ";
  437.                  RESULT_BOX->Text += INTERIOR_BOX->Text;
  438.                  RESULT_BOX->Text += ");\r\n        SetVehicleVirtualWorld(vehicleid, ";
  439.                  RESULT_BOX->Text += WORLD_BOX->Text;
  440.                  RESULT_BOX->Text += ");\r\n        PutPlayerInVehicle(playerid, vehicleid, 0);\r\n    }\r\n";
  441.              }
  442.  
  443.              RESULT_BOX->Text += "    return 1;\r\n}";
  444.  
  445.          }
  446.     };
  447. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement