LoriYagami

H-Pickup 1.4 English

Feb 4th, 2017
361
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 10.24 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 10001
  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}Type /createpickup to make an pickup.");
  39.     return 1;
  40. }
  41.  
  42. CMD:createpickup(playerid, params[])
  43. {
  44.     ShowPlayerDialog(playerid, DIALOG_PICKUP_TEXT, DIALOG_STYLE_INPUT, "Pickup Text", "Enter the pickup text below :\nFor example In-Game [Press [ENTER] untuk get in]", "Create", "Cancel");
  45.     return 1;
  46. }
  47.  
  48. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  49. {
  50.    
  51.     if(dialogid == DIALOG_PICKUP_TEXT)
  52.     {
  53.         if(response)
  54.         {
  55.             if(pickupidmode == false)
  56.             {
  57.                 format(pickuptext, sizeof(pickuptext), "%s", inputtext);
  58.                 ShowModelSelectionMenu(playerid, pickuplist, "Select the Pickup Models");
  59.             }
  60.             else
  61.             {
  62.                 format(pickuptext, sizeof(pickuptext), "%s", inputtext);
  63.                 ShowPlayerDialog(playerid, DIALOG_PICKUP_ID, DIALOG_STYLE_INPUT, "Pickup ID", "Enter the pickup id below :", "Create", "Cancel");
  64.             }
  65.         }
  66.         else
  67.         {
  68.             pickupidmode = false;
  69.         }
  70.     }
  71.     if(dialogid == DIALOG_PICKUP_ID)
  72.     {
  73.         if(response)
  74.         {
  75.             if(IsNumeric(inputtext))
  76.             {
  77.                 pickupmodel = strval(inputtext);
  78.                 ShowPlayerDialog(playerid, DIALOG_PICKUP_TEXT_COLOR, DIALOG_STYLE_LIST, "Pickup Text Color", "Red\nBlue\nGreen\nYellow\nPurple\nGrey\nOrange", "Create", "Cancel");
  79.             }
  80.             else
  81.             {
  82.                 ShowPlayerDialog(playerid, DIALOG_PICKUP_ID, DIALOG_STYLE_INPUT, "Pickup ID", "Enter the pickup id below :", "Create", "Cancel");
  83.                 SendClientMessage(playerid, -1, "Invalid pickup ID.");
  84.             }
  85.         }
  86.         else
  87.         {
  88.             pickupidmode = false;
  89.         }
  90.     }
  91.     if(dialogid == DIALOG_PICKUP_TEXT_COLOR)
  92.     {
  93.         new string[256], Float:X, Float:Y, Float:Z;
  94.         if(response)
  95.         {
  96.             if(listitem == 0)
  97.             {
  98.                 GetPlayerPos(playerid, X, Y, Z);
  99.  
  100.                 new File:pos=fopen("createdpickup.txt", io_append);
  101.                 format(string, 256, "CreatePickup(%i, 23, %f, %f, %f, %i);\r\n",  pickupmodel, X, Y, Z, GetPlayerVirtualWorld(playerid));
  102.                 fwrite(pos, string);
  103.                 format(string, 256, "Create3DTextLabel(%s, 0xAA3333AA, %f, %f, %f, 5.0, %i);\r\n", pickuptext, X, Y, Z+0.50, GetPlayerVirtualWorld(playerid));
  104.                 fwrite(pos, string);
  105.                 fclose(pos);
  106.                 CreatePickup(pickupmodel, 23, X, Y, Z, GetPlayerVirtualWorld(playerid));
  107.                 Create3DTextLabel(pickuptext, 0xAA3333AA, X, Y, Z+0.50, 5.0, GetPlayerVirtualWorld(playerid));
  108.                 SendClientMessage(playerid, -1, "{FFFFFF}Pickup created, all the pickup will be saved in scriptfiles -> createdpickup.txt.");
  109.                 SendClientMessage(playerid, -1, "{FFFFFF}Type /createpickup to make an pickup.");
  110.             }
  111.             if(listitem == 1)
  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, 0x007BD0FF, %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, 0x007BD0FF, X, Y, Z+0.50, 5.0, GetPlayerVirtualWorld(playerid));
  123.                 SendClientMessage(playerid, -1, "{FFFFFF}Pickup created, all the pickup will be saved in scriptfiles -> createdpickup.txt.");
  124.                 SendClientMessage(playerid, -1, "{FFFFFF}Type /createpickup to make an pickup.");
  125.             }
  126.             if(listitem == 2)
  127.             {
  128.                 GetPlayerPos(playerid, X, Y, Z);
  129.  
  130.                 new File:pos=fopen("createdpickup.txt", io_append);
  131.                 format(string, 256, "CreatePickup(%i, 23, %f, %f, %f, %i);\r\n",  pickupmodel, X, Y, Z, GetPlayerVirtualWorld(playerid));
  132.                 fwrite(pos, string);
  133.                 format(string, 256, "Create3DTextLabel(%s, 0x33AA33AA, %f, %f, %f, 5.0, %i);\r\n", pickuptext, X, Y, Z+0.50, GetPlayerVirtualWorld(playerid));
  134.                 fwrite(pos, string);
  135.                 fclose(pos);
  136.                 CreatePickup(pickupmodel, 23, X, Y, Z, GetPlayerVirtualWorld(playerid));
  137.                 Create3DTextLabel(pickuptext, 0x33AA33AA, X, Y, Z+0.50, 5.0, GetPlayerVirtualWorld(playerid));
  138.                 SendClientMessage(playerid, -1, "{FFFFFF}Pickup created, all the pickup will be saved in scriptfiles -> createdpickup.txt.");
  139.                 SendClientMessage(playerid, -1, "{FFFFFF}Type /createpickup to make an pickup.");
  140.             }
  141.             if(listitem == 3)
  142.             {
  143.                 GetPlayerPos(playerid, X, Y, Z);
  144.  
  145.                 new File:pos=fopen("createdpickup.txt", io_append);
  146.                 format(string, 256, "CreatePickup(%i, 23, %f, %f, %f, %i);\r\n",  pickupmodel, X, Y, Z, GetPlayerVirtualWorld(playerid));
  147.                 fwrite(pos, string);
  148.                 format(string, 256, "Create3DTextLabel(%s, 0xFFFF00AA, %f, %f, %f, 5.0, %i);\r\n", pickuptext, X, Y, Z+0.50, GetPlayerVirtualWorld(playerid));
  149.                 fwrite(pos, string);
  150.                 fclose(pos);
  151.                 CreatePickup(pickupmodel, 23, X, Y, Z, GetPlayerVirtualWorld(playerid));
  152.                 Create3DTextLabel(pickuptext, 0xFFFF00AA, X, Y, Z+0.50, 5.0, GetPlayerVirtualWorld(playerid));
  153.                 SendClientMessage(playerid, -1, "{FFFFFF}Pickup created, all the pickup will be saved in scriptfiles -> createdpickup.txt.");
  154.                 SendClientMessage(playerid, -1, "{FFFFFF}Type /createpickup to make an pickup.");
  155.             }
  156.             if(listitem == 4)
  157.             {
  158.                 GetPlayerPos(playerid, X, Y, Z);
  159.  
  160.                 new File:pos=fopen("createdpickup.txt", io_append);
  161.                 format(string, 256, "CreatePickup(%i, 23, %f, %f, %f, %i);\r\n",  pickupmodel, X, Y, Z, GetPlayerVirtualWorld(playerid));
  162.                 fwrite(pos, string);
  163.                 format(string, 256, "Create3DTextLabel(%s, 0xC2A2DAAA, %f, %f, %f, 5.0, %i);\r\n", pickuptext, X, Y, Z+0.50, GetPlayerVirtualWorld(playerid));
  164.                 fwrite(pos, string);
  165.                 fclose(pos);
  166.                 CreatePickup(pickupmodel, 23, X, Y, Z, GetPlayerVirtualWorld(playerid));
  167.                 Create3DTextLabel(pickuptext, 0xC2A2DAAA, X, Y, Z+0.50, 5.0, GetPlayerVirtualWorld(playerid));
  168.                 SendClientMessage(playerid, -1, "{FFFFFF}Pickup created, all the pickup will be saved in scriptfiles -> createdpickup.txt.");
  169.                 SendClientMessage(playerid, -1, "{FFFFFF}Type /createpickup to make an pickup.");
  170.             }
  171.             if(listitem == 5)
  172.             {
  173.                 GetPlayerPos(playerid, X, Y, Z);
  174.  
  175.                 new File:pos=fopen("createdpickup.txt", io_append);
  176.                 format(string, 256, "CreatePickup(%i, 23, %f, %f, %f, %i);\r\n",  pickupmodel, X, Y, Z, GetPlayerVirtualWorld(playerid));
  177.                 fwrite(pos, string);
  178.                 format(string, 256, "Create3DTextLabel(%s, 0xAFAFAFAA, %f, %f, %f, 5.0, %i);\r\n", pickuptext, X, Y, Z+0.50, GetPlayerVirtualWorld(playerid));
  179.                 fwrite(pos, string);
  180.                 fclose(pos);
  181.                 CreatePickup(pickupmodel, 23, X, Y, Z, GetPlayerVirtualWorld(playerid));
  182.                 Create3DTextLabel(pickuptext, 0xAFAFAFAA, X, Y, Z+0.50, 5.0, GetPlayerVirtualWorld(playerid));
  183.                 SendClientMessage(playerid, -1, "{FFFFFF}Pickup created, all the pickup will be saved in scriptfiles -> createdpickup.txt.");
  184.                 SendClientMessage(playerid, -1, "{FFFFFF}Type /createpickup to make an pickup.");
  185.             }
  186.             if(listitem == 6)
  187.             {
  188.                 GetPlayerPos(playerid, X, Y, Z);
  189.  
  190.                 new File:pos=fopen("createdpickup.txt", io_append);
  191.                 format(string, 256, "CreatePickup(%i, 23, %f, %f, %f, %i);\r\n",  pickupmodel, X, Y, Z, GetPlayerVirtualWorld(playerid));
  192.                 fwrite(pos, string);
  193.                 format(string, 256, "Create3DTextLabel(%s, 0xFF8000FF, %f, %f, %f, 5.0, %i);\r\n", pickuptext, X, Y, Z+0.50, GetPlayerVirtualWorld(playerid));
  194.                 fwrite(pos, string);
  195.                 fclose(pos);
  196.                 CreatePickup(pickupmodel, 23, X, Y, Z, GetPlayerVirtualWorld(playerid));
  197.                 Create3DTextLabel(pickuptext, 0xFF8000FF, X, Y, Z+0.50, 5.0, GetPlayerVirtualWorld(playerid));
  198.                 SendClientMessage(playerid, -1, "{FFFFFF}Pickup created, all the pickup will be saved in scriptfiles -> createdpickup.txt.");
  199.                 SendClientMessage(playerid, -1, "{FFFFFF}Type /createpickup to make an pickup.");
  200.             }
  201.         }
  202.     }
  203.     return 0;
  204. }
  205.  
  206. stock IsNumeric(const string[])
  207. {
  208.     for (new i = 0, j = strlen(string); i < j; i++)
  209.     {
  210.         if (string[i] > '9' || string[i] < '0') return 0;
  211.     }
  212.     return 1;
  213. }
Add Comment
Please, Sign In to add comment