LoriYagami

H-Pickup 1.4

Feb 4th, 2017
454
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 10.09 KB | None | 0 0
  1. //===============================================================================
  2. //|                 This Script Originaly Made by Haikal Bintang                |
  3. //===============================================================================
  4.  
  5. #include <a_samp>
  6. #include <zcmd>
  7. #include <mSelection>
  8. #include <sscanf2>
  9.  
  10. #define DIALOG_PICKUP_TEXT 9999
  11. #define DIALOG_PICKUP_ID 10000
  12. #define DIALOG_PICKUP_TEXT_COLOR 10002
  13.  
  14. new pickuptext[256];
  15. new pickupmodel;
  16. new pickuplist = mS_INVALID_LISTID;
  17. new bool:pickupidmode = false;
  18.  
  19. public OnFilterScriptInit()
  20. {
  21.     pickuplist = LoadModelSelectionMenu("pickup.txt");
  22.     print("H-Pickup created by Haikal Bintang.");
  23.     return 1;
  24. }
  25.  
  26. public OnPlayerModelSelection(playerid, response, listid, modelid)
  27. {
  28.     if((listid == pickuplist) && response)
  29.     {
  30.         pickupmodel = modelid;
  31.         ShowPlayerDialog(playerid, DIALOG_PICKUP_TEXT_COLOR, DIALOG_STYLE_LIST, "Pickup Text Color", "Red\nBlue\nGreen\nYellow\nPurple\nGrey\nOrange", "Create", "Cancel");
  32.     }
  33.     return 1;
  34. }
  35.  
  36. public OnPlayerSpawn(playerid)
  37. {
  38.     SendClientMessage(playerid, -1, "{FFFFFF}Ketik /createpickup untuk membuat sebuah pickup.");
  39.     return 1;
  40. }
  41.  
  42. CMD:createpickup(playerid, params[])
  43. {
  44.     new pickupmetode;
  45.     if(sscanf(params, "i", pickupmetode))
  46.     {
  47.         SendClientMessage(playerid, -1, "[USAGE]: /createpickup [metode]");
  48.         SendClientMessage(playerid, -1, "[1] Dengan Model | [2] Dengan ID");
  49.         return 1;
  50.     }
  51.     if(pickupmetode < 1 || pickupmetode > 2) return SendClientMessage(playerid, -1, "Hanya ada 1 dan 2.");
  52.     if(pickupmetode == 1)
  53.     {
  54.         ShowPlayerDialog(playerid, DIALOG_PICKUP_TEXT, DIALOG_STYLE_INPUT, "Pickup Text", "Masukan text pickup di bawah ini :\nContoh di In-Game [Tekan [ENTER] untuk masuk]", "Create", "Cancel");
  55.     }
  56.     else if(pickupmetode == 2)
  57.     {
  58.         ShowPlayerDialog(playerid, DIALOG_PICKUP_TEXT, DIALOG_STYLE_INPUT, "Pickup Text", "Masukan text pickup di bawah ini :\nContoh di In-Game [Tekan [ENTER] untuk masuk]", "Create", "Cancel");
  59.         pickupidmode = true;
  60.     }
  61.     return 1;
  62. }
  63.  
  64. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  65. {
  66.     if(dialogid == DIALOG_PICKUP_TEXT)
  67.     {
  68.         if(response)
  69.         {
  70.             if(pickupidmode == false)
  71.             {
  72.                 format(pickuptext, sizeof(pickuptext), "%s", inputtext);
  73.                 ShowModelSelectionMenu(playerid, pickuplist, "Pilih Jenis Pickup");
  74.             }
  75.             else
  76.             {
  77.                 format(pickuptext, sizeof(pickuptext), "%s", inputtext);
  78.                 ShowPlayerDialog(playerid, DIALOG_PICKUP_ID, DIALOG_STYLE_INPUT, "Pickup ID", "Masukan id pickup di bawan ini :", "Create", "Cancel");
  79.             }
  80.         }
  81.         else
  82.         {
  83.             pickupidmode = false;
  84.         }
  85.     }
  86.     if(dialogid == DIALOG_PICKUP_ID)
  87.     {
  88.         if(response)
  89.         {
  90.             if(IsNumeric(inputtext))
  91.             {
  92.                 pickupmodel = strval(inputtext);
  93.                 ShowPlayerDialog(playerid, DIALOG_PICKUP_TEXT_COLOR, DIALOG_STYLE_LIST, "Pickup Text Color", "Red\nBlue\nGreen\nYellow\nPurple\nGrey\nOrange", "Create", "Cancel");
  94.             }
  95.             else
  96.             {
  97.                 ShowPlayerDialog(playerid, DIALOG_PICKUP_ID, DIALOG_STYLE_INPUT, "Pickup ID", "Masukan id pickup di bawan ini :", "Create", "Cancel");
  98.                 SendClientMessage(playerid, -1, "ID tidak diketahui.");
  99.             }
  100.         }
  101.         else
  102.         {
  103.             pickupidmode = false;
  104.         }
  105.     }
  106.     if(dialogid == DIALOG_PICKUP_TEXT_COLOR)
  107.     {
  108.         new string[256], Float:X, Float:Y, Float:Z;
  109.         if(response)
  110.         {
  111.             if(listitem == 0)
  112.             {
  113.                 GetPlayerPos(playerid, X, Y, Z);
  114.  
  115.                 new File:pos=fopen("createdpickup.txt", io_append);
  116.                 format(string, 256, "CreatePickup(%i, 23, %f, %f, %f, %i);\r\n",  pickupmodel, X, Y, Z, GetPlayerVirtualWorld(playerid));
  117.                 fwrite(pos, string);
  118.                 format(string, 256, "Create3DTextLabel(%s, 0xAA3333AA, %f, %f, %f, 5.0, %i);\r\n", pickuptext, X, Y, Z+0.50, GetPlayerVirtualWorld(playerid));
  119.                 fwrite(pos, string);
  120.                 fclose(pos);
  121.                 CreatePickup(pickupmodel, 23, X, Y, Z, GetPlayerVirtualWorld(playerid));
  122.                 Create3DTextLabel(pickuptext, 0xAA3333AA, X, Y, Z+0.50, 5.0, GetPlayerVirtualWorld(playerid));
  123.                 SendClientMessage(playerid, -1, "{FFFFFF}Pickup telah dibuat, ketik /createpickup untuk membuat lagi.");
  124.             }
  125.             if(listitem == 1)
  126.             {
  127.                 GetPlayerPos(playerid, X, Y, Z);
  128.  
  129.                 new File:pos=fopen("createdpickup.txt", io_append);
  130.                 format(string, 256, "CreatePickup(%i, 23, %f, %f, %f, %i);\r\n",  pickupmodel, X, Y, Z, GetPlayerVirtualWorld(playerid));
  131.                 fwrite(pos, string);
  132.                 format(string, 256, "Create3DTextLabel(%s, 0x007BD0FF, %f, %f, %f, 5.0, %i);\r\n", pickuptext, X, Y, Z+0.50, GetPlayerVirtualWorld(playerid));
  133.                 fwrite(pos, string);
  134.                 fclose(pos);
  135.                 CreatePickup(pickupmodel, 23, X, Y, Z, GetPlayerVirtualWorld(playerid));
  136.                 Create3DTextLabel(pickuptext, 0x007BD0FF, X, Y, Z+0.50, 5.0, GetPlayerVirtualWorld(playerid));
  137.                 SendClientMessage(playerid, -1, "{FFFFFF}Pickup telah dibuat, ketik /createpickup untuk membuat lagi.");
  138.             }
  139.             if(listitem == 2)
  140.             {
  141.                 GetPlayerPos(playerid, X, Y, Z);
  142.  
  143.                 new File:pos=fopen("createdpickup.txt", io_append);
  144.                 format(string, 256, "CreatePickup(%i, 23, %f, %f, %f, %i);\r\n",  pickupmodel, X, Y, Z, GetPlayerVirtualWorld(playerid));
  145.                 fwrite(pos, string);
  146.                 format(string, 256, "Create3DTextLabel(%s, 0x33AA33AA, %f, %f, %f, 5.0, %i);\r\n", pickuptext, X, Y, Z+0.50, GetPlayerVirtualWorld(playerid));
  147.                 fwrite(pos, string);
  148.                 fclose(pos);
  149.                 CreatePickup(pickupmodel, 23, X, Y, Z, GetPlayerVirtualWorld(playerid));
  150.                 Create3DTextLabel(pickuptext, 0x33AA33AA, X, Y, Z+0.50, 5.0, GetPlayerVirtualWorld(playerid));
  151.                 SendClientMessage(playerid, -1, "{FFFFFF}Pickup telah dibuat, ketik /createpickup untuk membuat lagi.");
  152.             }
  153.             if(listitem == 3)
  154.             {
  155.                 GetPlayerPos(playerid, X, Y, Z);
  156.  
  157.                 new File:pos=fopen("createdpickup.txt", io_append);
  158.                 format(string, 256, "CreatePickup(%i, 23, %f, %f, %f, %i);\r\n",  pickupmodel, X, Y, Z, GetPlayerVirtualWorld(playerid));
  159.                 fwrite(pos, string);
  160.                 format(string, 256, "Create3DTextLabel(%s, 0xFFFF00AA, %f, %f, %f, 5.0, %i);\r\n", pickuptext, X, Y, Z+0.50, GetPlayerVirtualWorld(playerid));
  161.                 fwrite(pos, string);
  162.                 fclose(pos);
  163.                 CreatePickup(pickupmodel, 23, X, Y, Z, GetPlayerVirtualWorld(playerid));
  164.                 Create3DTextLabel(pickuptext, 0xFFFF00AA, X, Y, Z+0.50, 5.0, GetPlayerVirtualWorld(playerid));
  165.                 SendClientMessage(playerid, -1, "{FFFFFF}Pickup telah dibuat, ketik /createpickup untuk membuat lagi.");
  166.             }
  167.             if(listitem == 4)
  168.             {
  169.                 GetPlayerPos(playerid, X, Y, Z);
  170.  
  171.                 new File:pos=fopen("createdpickup.txt", io_append);
  172.                 format(string, 256, "CreatePickup(%i, 23, %f, %f, %f, %i);\r\n",  pickupmodel, X, Y, Z, GetPlayerVirtualWorld(playerid));
  173.                 fwrite(pos, string);
  174.                 format(string, 256, "Create3DTextLabel(%s, 0xC2A2DAAA, %f, %f, %f, 5.0, %i);\r\n", pickuptext, X, Y, Z+0.50, GetPlayerVirtualWorld(playerid));
  175.                 fwrite(pos, string);
  176.                 fclose(pos);
  177.                 CreatePickup(pickupmodel, 23, X, Y, Z, GetPlayerVirtualWorld(playerid));
  178.                 Create3DTextLabel(pickuptext, 0xC2A2DAAA, X, Y, Z+0.50, 5.0, GetPlayerVirtualWorld(playerid));
  179.                 SendClientMessage(playerid, -1, "{FFFFFF}Pickup telah dibuat, ketik /createpickup untuk membuat lagi.");
  180.             }
  181.             if(listitem == 5)
  182.             {
  183.                 GetPlayerPos(playerid, X, Y, Z);
  184.  
  185.                 new File:pos=fopen("createdpickup.txt", io_append);
  186.                 format(string, 256, "CreatePickup(%i, 23, %f, %f, %f, %i);\r\n",  pickupmodel, X, Y, Z, GetPlayerVirtualWorld(playerid));
  187.                 fwrite(pos, string);
  188.                 format(string, 256, "Create3DTextLabel(%s, 0xAFAFAFAA, %f, %f, %f, 5.0, %i);\r\n", pickuptext, X, Y, Z+0.50, GetPlayerVirtualWorld(playerid));
  189.                 fwrite(pos, string);
  190.                 fclose(pos);
  191.                 CreatePickup(pickupmodel, 23, X, Y, Z, GetPlayerVirtualWorld(playerid));
  192.                 Create3DTextLabel(pickuptext, 0xAFAFAFAA, X, Y, Z+0.50, 5.0, GetPlayerVirtualWorld(playerid));
  193.                 SendClientMessage(playerid, -1, "{FFFFFF}Pickup telah dibuat, ketik /createpickup untuk membuat lagi.");
  194.             }
  195.             if(listitem == 6)
  196.             {
  197.                 GetPlayerPos(playerid, X, Y, Z);
  198.  
  199.                 new File:pos=fopen("createdpickup.txt", io_append);
  200.                 format(string, 256, "CreatePickup(%i, 23, %f, %f, %f, %i);\r\n",  pickupmodel, X, Y, Z, GetPlayerVirtualWorld(playerid));
  201.                 fwrite(pos, string);
  202.                 format(string, 256, "Create3DTextLabel(%s, 0xFF8000FF, %f, %f, %f, 5.0, %i);\r\n", pickuptext, X, Y, Z+0.50, GetPlayerVirtualWorld(playerid));
  203.                 fwrite(pos, string);
  204.                 fclose(pos);
  205.                 CreatePickup(pickupmodel, 23, X, Y, Z, GetPlayerVirtualWorld(playerid));
  206.                 Create3DTextLabel(pickuptext, 0xFF8000FF, X, Y, Z+0.50, 5.0, GetPlayerVirtualWorld(playerid));
  207.                 SendClientMessage(playerid, -1, "{FFFFFF}Pickup telah dibuat, ketik /createpickup untuk membuat lagi.");
  208.             }
  209.         }
  210.     }
  211.     return 0;
  212. }
  213.  
  214. stock IsNumeric(const string[])
  215. {
  216.     for (new i = 0, j = strlen(string); i < j; i++)
  217.     {
  218.         if (string[i] > '9' || string[i] < '0') return 0;
  219.     }
  220.     return 1;
  221. }
Advertisement
Add Comment
Please, Sign In to add comment