Advertisement
B3x7K

Bot Administrative Chatter

Feb 18th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 11.61 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #include <EasyDialog>
  4. #include <foreach>
  5. #include <sscanf>
  6. #include <zcmd>
  7.  
  8. //by Y_LESS and Missiur on topic (https://forum.sa-mp.com/showthread.php?t=583472)
  9. #define FLOAT_INFINITY           (Float:0x7F800000)
  10. #define FLOAT_NEG_INFINITY       (Float:0xFF800000)
  11. #define FLOAT_NAN                (Float:0xFFFFFFFF)
  12.  
  13. #define PlayerSay(%0, %1)        !strcmp(%0,%1,false) && strlen(%0) == strlen(%1)
  14. #define CONTROL->%0(%1)          forward%0(%1); public%0(%1);
  15. #define IsNull(%1)               ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
  16.  
  17. enum FormList
  18. {
  19.     //FormName[32]
  20.     FormType,
  21.     FormFill1,
  22.     FormFill2,
  23.     FormFill3,
  24.     FormFill4,
  25.     FormFill5,
  26.     FormFill6,
  27.     Bool:FormReceiving,
  28.     Bool:FormFilled
  29. };
  30. new Formulir[MAX_PLAYERS][FormList];
  31.  
  32. public OnFilterScriptInit()
  33. {
  34.     print("Bot Administrative Chatter!");
  35.     print("By: Your Hated Scripter | 0x1E4");
  36.     print("");
  37.     print("Loaded Successfully!");
  38.  
  39. }
  40.  
  41. public OnFilterScriptExit()
  42. {
  43.     print("Bot Administrative Chatter!");
  44.     print("By: Your Hated Scripter | 0x1E4");
  45.     print("");
  46.     print("See you later!");
  47. }
  48.  
  49. stock GetClosestBOT(obj)
  50. {
  51.     new
  52.         x,
  53.         Float:dis = FLOAT_INFINITY,
  54.         Float:dis2,
  55.         person = -1;
  56.  
  57.     for (x = 0; x < MAX_PLAYERS; x++)
  58.     {
  59.         if(IsPlayerConnected(x) && IsPlayerNPC(x))
  60.         {
  61.             if(x != obj)
  62.             {
  63.                 dis2 = GetDistanceBetweenPlayers(x, obj);
  64.                 if(dis2 < dis && dis2 != -1.00)
  65.                 {
  66.                     dis = dis2;
  67.                     person = x;
  68.                 }
  69.             }
  70.         }
  71.     }
  72.     return person;
  73. }
  74.  
  75. stock IsFormFilled(playerid)
  76. {
  77.     if(!IsNull(Formulir[playerid][FormFill1]) && !IsNull(Formulir[playerid][FormFill2]) && !IsNull(Formulir[playerid][FormFill3])
  78.        !IsNull(Formulir[playerid][FormFill4]) && !IsNull(Formulir[playerid][FormFill5]) && !IsNull(Formulir[playerid][FormFill6])) return 1;
  79.    
  80.     return 0;
  81. }
  82.  
  83. stock GetName(obj, con=0) //1 = underscore, and 0 = not underscore
  84. {
  85.     new
  86.         asynk[MAX_PLAYER_NAME+2];
  87.     switch(con)
  88.     {
  89.         case 0:
  90.         {
  91.             GetPlayerName(obj, asynk, sizeof(asynk));
  92.             for(new i; i < MAX_PLAYER_NAME; i++) if (asynk[i] == '_') asynk[i] = ' ';
  93.         }
  94.         case 1: GetPlayerName(obj, asynk, sizeof(asynk));
  95.     }
  96.     return asynk;
  97. }
  98.  
  99. public OnPlayerConnect(playerid)
  100. {
  101.     ClearFormulir(playerid);
  102.     return 1;
  103. }
  104.  
  105. public OnPlayerDisconnect(playerid, reason)
  106. {
  107.     ClearFormulir(playerid);
  108.     return 1;
  109. }
  110.  
  111. public OnPlayerText(playerid, text[])
  112. {
  113.     new BOT = GetClosestBOT(playerid);
  114.     if(PlayerSay(text, "Tolong buatkan saya SIM"));
  115.     {
  116.         BotReply(playerid, "Baiklah tunggu sebentar...");
  117.         BotReply(playerid, "Oh iya tolong isikan data lengkap anda disini ya.");
  118.  
  119.         BotRP(playerid, "%s mengambil kertas formulir ID Card untuk %s", GetName(BOT), GetName(playerid));
  120.         Formulir[playerid][FormReceiving] = 1;
  121.         Formulir[playerid][FormType] = 1; //ID Card
  122.  
  123.     }
  124. }
  125.  
  126. CONTROL->ProcessingFormulir(playerid)
  127. {
  128.     new contain[128];
  129.  
  130.     format(contain, sizeof(contain),           
  131.         "Name\t%s\n \
  132.         Age\t%s\n \
  133.         Address\t%s\n \
  134.         Sex\t%s\n \
  135.         Religion\t%s\n \
  136.         Status\t%s\n \
  137.         \n \
  138.         with the formation of this ID Card I promise to \n \
  139.         be a good citizen for the future \n \
  140.         \n \
  141.         %s, %s",
  142.         Formulir[playerid][FormFill1],
  143.         Formulir[playerid][FormFill2],
  144.         Formulir[playerid][FormFill3],
  145.         Formulir[playerid][FormFill4],
  146.         Formulir[playerid][FormFill5],
  147.         Formulir[playerid][FormFill6]
  148.     );
  149.  
  150.     Dialog_Show(playerid, ShowToPlayer, DIALOG_STYLE_MSGBOX, "Your ID Card", contain, "Save (Comming Soon)", "Close");
  151.     return 1;
  152. }
  153.  
  154. CONTROL->ResetFormulir(playerid)
  155. {
  156.     Formulir[playerid][FormFill1][0] = '\0';
  157.     Formulir[playerid][FormFill2][0] = '\0';
  158.     Formulir[playerid][FormFill3][0] = '\0';
  159.     Formulir[playerid][FormFill4][0] = '\0';
  160.     Formulir[playerid][FormFill5][0] = '\0';
  161.     Formulir[playerid][FormFill6][0] = '\0';
  162.     return 1;
  163. }
  164.  
  165. CMD:fillformulir(playerid, params[])
  166. {
  167.     new contain[128];
  168.  
  169.     format(contain, sizeof(contain),           
  170.         "Nama\t%s\n \
  171.         Umur\t%s\n \
  172.         Tempat Tinggal\t%s\n \
  173.         Jenis Kelamin\t%s\n \
  174.         Agama\t%s\n \
  175.         Status\t%s\n",
  176.         Formulir[playerid][FormFill1],
  177.         Formulir[playerid][FormFill2],
  178.         Formulir[playerid][FormFill3],
  179.         Formulir[playerid][FormFill4],
  180.         Formulir[playerid][FormFill5],
  181.         Formulir[playerid][FormFill6]
  182.     );
  183.  
  184.     if(Formulir[playerid][Receiving] == 1 && Formulir[playerid][Type] == 1)
  185.         Dialog_Show(playerid, FormIDCardMenu, DIALOG_STYLE_TABLIST, "Formulir Menu", contain, "Done", "Exit");
  186.         //Dialog_Show(playerid, FormIDCardMenu, DIALOG_STYLE_LIST, "Formulir Menu", "Nama\nUmur\nTempat Tinggal\nJenis Kelamin\nAgama\nStatus");
  187.  
  188.     return 1;
  189. }
  190.  
  191. CMD:giveformulir(playerid, params[])
  192. {
  193.     new BOT = GetClonew BOT = GetClosestBOT(playerid);
  194.  
  195.     if(Formulir[playerid][FormFilled] != 1)
  196.         return OutputError(playerid, "Kamu belum mengisi semua datanya, tolong diisi segera!");
  197.  
  198.     SendNearbyMessage(playerid, 30.0, COLOR_PURPLE, "* %s memberikan sebuah formulir kepada %s", GetName(playerid), GetName(BOT));
  199.     SendNearbyMessage(playerid, 30.0, COLOR_PURPLE, "* %s menerima formulir tersebut lalu mendatanya", GetName(BOT), GetName(playerid));
  200.  
  201.     ProcessingFormulir(playerid);
  202.     return 1;
  203. }
  204.  
  205. Dialog:FormIDCardMenu(playerid, response, listitem, inputtext[])
  206. {
  207.     if(!response) return 0;
  208.     if(IsFormFilled(playerid)) return Formulir[playerid][FormFilled] == 1;
  209.  
  210.     switch(listitem)
  211.     {
  212.         //wiki tells me to start from 0
  213.         case 0: Dialog_Show(playerid, FormIDCardName, DIALOG_STYLE_INPUT, "Isilah Nama anda dibawah ini!", "Sudah", "");
  214.         case 1: Dialog_Show(playerid, FormIDCardAge, DIALOG_STYLE_INPUT, "Isilah Umur anda dibawah ini!", "Sudah", "");
  215.         case 2: Dialog_Show(playerid, FormIDCardAddr, DIALOG_STYLE_INPUT, "Isilah Tempat Tinggal anda yang sekarang dibawah ini!", "Sudah", "");
  216.         case 3: Dialog_Show(playerid, FormIDCardSex, DIALOG_STYLE_INPUT, "Isilah Jenis Kelamin anda dibawah ini!", "Sudah", "");
  217.         case 4: Dialog_Show(playerid, FormIDCardReli, DIALOG_STYLE_INPUT, "Isilah Agama yang anda ikuti dibawah ini!", "Sudah", "");
  218.         case 5: Dialog_Show(playerid, FormIDCardStat, DIALOG_STYLE_INPUT, "Isilah Status Pekerjaan anda dibawah ini!", "Sudah", "");
  219.     }
  220.     return 1;
  221. }
  222.  
  223. Dialog:FormIDCardName(playerid, response, listitem, inputtext[])
  224. {
  225.     new contain[128];
  226.     if(!response) return 0;
  227.  
  228.     if(IsNull(Inputtext))
  229.     {
  230.         OutputError(playerid, "Kamu belum mengisi datanya, tolong diisi segera!");
  231.         return Dialog_Show(playerid, FormIDCardName, DIALOG_STYLE_INPUT, "Isilah Nama anda dibawah ini!", "Sudah", "");
  232.     }
  233.  
  234.     Formulir[playerid][FormFill1] = inputtext;
  235.  
  236.     format(contain, sizeof(contain),           
  237.         "Nama\t%s\n \
  238.         Umur\t%s\n \
  239.         Tempat Tinggal\t%s\n \
  240.         Jenis Kelamin\t%s\n \
  241.         Agama\t%s\n \
  242.         Status\t%s\n",
  243.         Formulir[playerid][FormFill1],
  244.         Formulir[playerid][FormFill2],
  245.         Formulir[playerid][FormFill3],
  246.         Formulir[playerid][FormFill4],
  247.         Formulir[playerid][FormFill5],
  248.         Formulir[playerid][FormFill6]
  249.     );
  250.  
  251.     if(Formulir[playerid][Receiving] == 1 && Formulir[playerid][Type] == 1)
  252.         Dialog_Show(playerid, FormIDCardMenu, DIALOG_STYLE_TABLIST, "Formulir Menu", contain, "Done", "Exit");
  253.  
  254.     return 1;
  255. }
  256.  
  257. Dialog:FormIDCardAge(playerid, response, listitem, inputtext[])
  258. {
  259.     new contain[128];
  260.     if(!response) return 0;
  261.  
  262.     if(IsNull(Inputtext))
  263.     {
  264.         OutputError(playerid, "Kamu belum mengisi datanya, tolong diisi segera!");
  265.         return Dialog_Show(playerid, FormIDCardAge, DIALOG_STYLE_INPUT, "Isilah Umur anda dibawah ini!", "Sudah", "");
  266.     }
  267.  
  268.     Formulir[playerid][FormFill2] = inputtext;
  269.  
  270.     format(contain, sizeof(contain),           
  271.         "Nama\t%s\n \
  272.         Umur\t%s\n \
  273.         Tempat Tinggal\t%s\n \
  274.         Jenis Kelamin\t%s\n \
  275.         Agama\t%s\n \
  276.         Status\t%s\n",
  277.         Formulir[playerid][FormFill1],
  278.         Formulir[playerid][FormFill2],
  279.         Formulir[playerid][FormFill3],
  280.         Formulir[playerid][FormFill4],
  281.         Formulir[playerid][FormFill5],
  282.         Formulir[playerid][FormFill6]
  283.     );
  284.  
  285.     if(Formulir[playerid][Receiving] == 1 && Formulir[playerid][Type] == 1)
  286.         Dialog_Show(playerid, FormIDCardMenu, DIALOG_STYLE_TABLIST, "Formulir Menu", contain, "Done", "Exit");
  287.  
  288.     return 1;
  289. }
  290.  
  291.  
  292. Dialog:FormIDCardAddr(playerid, response, listitem, inputtext[])
  293. {
  294.     new contain[128];
  295.     if(!response) return 0;
  296.  
  297.     if(IsNull(Inputtext))
  298.     {
  299.         OutputError(playerid, "Kamu belum mengisi datanya, tolong diisi segera!");
  300.         return Dialog_Show(playerid, FormIDCardName, DIALOG_STYLE_INPUT, "Isilah Tempat Tinggal anda dibawah ini!", "Sudah", "");
  301.     }
  302.  
  303.     Formulir[playerid][FormFill3] = inputtext;
  304.  
  305.     format(contain, sizeof(contain),           
  306.         "Nama\t%s\n \
  307.         Umur\t%s\n \
  308.         Tempat Tinggal\t%s\n \
  309.         Jenis Kelamin\t%s\n \
  310.         Agama\t%s\n \
  311.         Status\t%s\n",
  312.         Formulir[playerid][FormFill1],
  313.         Formulir[playerid][FormFill2],
  314.         Formulir[playerid][FormFill3],
  315.         Formulir[playerid][FormFill4],
  316.         Formulir[playerid][FormFill5],
  317.         Formulir[playerid][FormFill6]
  318.     );
  319.  
  320.     if(Formulir[playerid][Receiving] == 1 && Formulir[playerid][Type] == 1)
  321.         Dialog_Show(playerid, FormIDCardMenu, DIALOG_STYLE_TABLIST, "Formulir Menu", contain, "Done", "Exit");
  322.  
  323.     return 1;
  324. }
  325.  
  326.  
  327. Dialog:FormIDCardSex(playerid, response, listitem, inputtext[])
  328. {
  329.     new contain[128];
  330.     if(!response) return 0;
  331.  
  332.     if(IsNull(Inputtext))
  333.     {
  334.         OutputError(playerid, "Kamu belum mengisi datanya, tolong diisi segera!");
  335.         return Dialog_Show(playerid, FormIDCardName, DIALOG_STYLE_INPUT, "Isilah Jenis Kelamin anda dibawah ini!", "Sudah", "");
  336.     }
  337.  
  338.     Formulir[playerid][FormFill4] = inputtext;
  339.  
  340.     format(contain, sizeof(contain),           
  341.         "Nama\t%s\n \
  342.         Umur\t%s\n \
  343.         Tempat Tinggal\t%s\n \
  344.         Jenis Kelamin\t%s\n \
  345.         Agama\t%s\n \
  346.         Status\t%s\n",
  347.         Formulir[playerid][FormFill1],
  348.         Formulir[playerid][FormFill2],
  349.         Formulir[playerid][FormFill3],
  350.         Formulir[playerid][FormFill4],
  351.         Formulir[playerid][FormFill5],
  352.         Formulir[playerid][FormFill6]
  353.     );
  354.  
  355.     if(Formulir[playerid][Receiving] == 1 && Formulir[playerid][Type] == 1)
  356.         Dialog_Show(playerid, FormIDCardMenu, DIALOG_STYLE_TABLIST, "Formulir Menu", contain, "Done", "Exit");
  357.  
  358.     return 1;
  359. }
  360.  
  361.  
  362. Dialog:FormIDCardReli(playerid, response, listitem, inputtext[])
  363. {
  364.     new contain[128];
  365.     if(!response) return 0;
  366.  
  367.     if(IsNull(Inputtext))
  368.     {
  369.         OutputError(playerid, "Kamu belum mengisi datanya, tolong diisi segera!");
  370.         return Dialog_Show(playerid, FormIDCardName, DIALOG_STYLE_INPUT, "Isilah Agama yang anda ikuti dibawah ini!", "Sudah", "");
  371.     }
  372.  
  373.     Formulir[playerid][FormFill5] = inputtext;
  374.  
  375.     format(contain, sizeof(contain),           
  376.         "Nama\t%s\n \
  377.         Umur\t%s\n \
  378.         Tempat Tinggal\t%s\n \
  379.         Jenis Kelamin\t%s\n \
  380.         Agama\t%s\n \
  381.         Status\t%s\n",
  382.         Formulir[playerid][FormFill1],
  383.         Formulir[playerid][FormFill2],
  384.         Formulir[playerid][FormFill3],
  385.         Formulir[playerid][FormFill4],
  386.         Formulir[playerid][FormFill5],
  387.         Formulir[playerid][FormFill6]
  388.     );
  389.  
  390.     if(Formulir[playerid][Receiving] == 1 && Formulir[playerid][Type] == 1)
  391.         Dialog_Show(playerid, FormIDCardMenu, DIALOG_STYLE_TABLIST, "Formulir Menu", contain, "Done", "Exit");
  392.  
  393.     return 1;
  394. }
  395.  
  396.  
  397. Dialog:FormIDCardStat(playerid, response, listitem, inputtext[])
  398. {
  399.     new contain[128];
  400.     if(!response) return 0;
  401.  
  402.     if(IsNull(Inputtext))
  403.     {
  404.         OutputError(playerid, "Kamu belum mengisi datanya, tolong diisi segera!");
  405.         return Dialog_Show(playerid, FormIDCardName, DIALOG_STYLE_INPUT, "Isilah Status Pekerjaan anda dibawah ini!", "Sudah", "");
  406.     }
  407.  
  408.     Formulir[playerid][FormFill6] = inputtext;
  409.  
  410.     format(contain, sizeof(contain),           
  411.         "Nama\t%s\n \
  412.         Umur\t%s\n \
  413.         Tempat Tinggal\t%s\n \
  414.         Jenis Kelamin\t%s\n \
  415.         Agama\t%s\n \
  416.         Status\t%s\n",
  417.         Formulir[playerid][FormFill1],
  418.         Formulir[playerid][FormFill2],
  419.         Formulir[playerid][FormFill3],
  420.         Formulir[playerid][FormFill4],
  421.         Formulir[playerid][FormFill5],
  422.         Formulir[playerid][FormFill6]
  423.     );
  424.  
  425.     if(Formulir[playerid][Receiving] == 1 && Formulir[playerid][Type] == 1)
  426.         Dialog_Show(playerid, FormIDCardMenu, DIALOG_STYLE_TABLIST, "Formulir Menu", contain, "Done", "Exit");
  427.  
  428.     return 1;
  429. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement