Advertisement
Guest User

Papagailis.pwn

a guest
Jul 17th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 9.39 KB | None | 0 0
  1. #define PARROT_INDEX 0 // SetPlayerAttachedObject slots kuru aizņem papagailis (0-9)
  2.  
  3.  
  4. //---   Pie PlayerInfo   ---//
  5.  
  6.     pParrot,
  7.     pParrotName,
  8.     pParrotSentence[5][35],
  9.    
  10.  
  11. //---   Pie ResetNew   ---//
  12.  
  13.     if(PlayerInfo[playerid][pParrot] == 1)
  14.     {
  15.         RemovePlayerAttachedObject(playerid,PARROT_INDEX);
  16.     }
  17.     new string1[2];
  18.     format(string1,sizeof(string1)," ");
  19.     strmid(PlayerInfo[playerid][pParrotSentence][0],string1,0,strlen(string1),255);
  20.     strmid(PlayerInfo[playerid][pParrotSentence][1],string1,0,strlen(string1),255);
  21.     strmid(PlayerInfo[playerid][pParrotSentence][2],string1,0,strlen(string1),255);
  22.     strmid(PlayerInfo[playerid][pParrotSentence][3],string1,0,strlen(string1),255);
  23.     strmid(PlayerInfo[playerid][pParrotSentence][4],string1,0,strlen(string1),255);
  24.     strmid(PlayerInfo[playerid][pParrotName],string1,0,strlen(string1),255);
  25.     PlayerInfo[playerid][pParrot] = 0;
  26.  
  27. //---   Pie OnPlayerText   ---//
  28.    
  29.     new Float:X,Float:Y,Float:Z; // sitie varetu ar kaut ko konfliktet ja liec pasa augsa, tapec vai nu liec pasa apaksa vai ari maini mainigos
  30.     for(new p=0;p<MAX_PLAYERS;p++)
  31.     {
  32.         if(PlayerInfo[playerid][pParrot] == 1)
  33.             if(strfind(text,PlayerInfo[p][pParrotName],true)!=-1)
  34.             {
  35.                 GetPlayerPos(playerid,X,Y,Z);
  36.                 if(IsPlayerInRangeOfPoint(p,20.0,X,Y,Z))
  37.                 {
  38.                     new sent = random(4), stringp[MAX_PLAYERS][256];
  39.                     switch(sent)
  40.                     {
  41.                         case 0:
  42.                         {
  43.                             if(strlen(PlayerInfo[p][pParrotSentence][0]) > 3)
  44.                             {
  45.                                 format(stringp[playerid],256,"%s saka: %s",PlayerInfo[p][pParrotName],PlayerInfo[p][pParrotSentence][0]);
  46.                                 ProxDetector(20.0, playerid, stringp[playerid],COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
  47.                             }
  48.                         }
  49.                         case 1:
  50.                         {
  51.                             if(strlen(PlayerInfo[p][pParrotSentence][1]) > 3)
  52.                             {
  53.                                 format(stringp[playerid],256,"%s saka: %s",PlayerInfo[p][pParrotName],PlayerInfo[p][pParrotSentence][1]);
  54.                                 ProxDetector(20.0, playerid, stringp[playerid],COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
  55.                             }
  56.                         }
  57.                         case 2:
  58.                         {
  59.                             if(strlen(PlayerInfo[p][pParrotSentence][2]) > 3)
  60.                             {
  61.                                 format(stringp[playerid],256,"%s saka: %s",PlayerInfo[p][pParrotName],PlayerInfo[p][pParrotSentence][2]);
  62.                                 ProxDetector(20.0, playerid, stringp[playerid],COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
  63.                             }
  64.                         }
  65.                         case 3:
  66.                         {
  67.                             if(strlen(PlayerInfo[p][pParrotSentence][3]) > 3)
  68.                             {
  69.                                 format(stringp[playerid],256,"%s saka: %s",PlayerInfo[p][pParrotName],PlayerInfo[p][pParrotSentence][3]);
  70.                                 ProxDetector(20.0, playerid, stringp[playerid],COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
  71.                             }
  72.                         }
  73.                         case 4:
  74.                         {
  75.                             if(strlen(PlayerInfo[p][pParrotSentence][4]) > 3)
  76.                             {
  77.                                 format(stringp[playerid],256,"%s saka: %s",PlayerInfo[p][pParrotName],PlayerInfo[p][pParrotSentence][4]);
  78.                                 ProxDetector(20.0, playerid, stringp[playerid],COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
  79.                             }
  80.                         }
  81.                     }
  82.                 }
  83.             }
  84.     }
  85.  
  86.  
  87. //////// KOMANDAS
  88.  
  89. CMD:pmenu(playerid)
  90. {
  91.     if(PlayerLogged[playerid] == 0) return 1;
  92.     if(!Inventory_HasItem(playerid, "Papagailis")) return SendClientMessage(playerid, COLOR_LIGHTRED, "Tev nav papagaiļa!");
  93.     Dialog_Show(playerid,PARROTMENU,2,"Papagaiļa darbības","1. Mainīt papagaiļa vārdu\n2. Iemācīt papagailim frāzes\n3. Noņemt/Uzlikt papagaili","Izvēlēties", "Atcelt");
  94.     SendClientMessage(playerid, COLOR_ORANGE, "Atceries: Papagaiļa vārds un frāzes ir jāliek pēc katra RR no jauna!");
  95.     return 1;
  96. }
  97.  
  98. CMD:papagailis(playerid)
  99. {
  100.     if(PlayerLogged[playerid] == 0) return 1;
  101.     if(PlayerInfo[playerid][pAdmin] < 1337 || AdminLogged[playerid] == false) return 1;
  102.     Inventory_Add(playerid, "Papagailis", 19078);
  103.     return 1;
  104. }
  105.  
  106. ///////// DIALOGI
  107.  
  108. Dialog:PARROTMENU(playerid, response, listitem, inputtext[])
  109. {
  110.     if(response)
  111.     {
  112.         if(listitem == 0)
  113.         {
  114.             Dialog_Show(playerid,PARROTMENU+1,DIALOG_STYLE_INPUT,"Papagaiļa vārds","Papagailis runās, kad tiks pieminēts viņa vārds. (3-20 simboli)","Uzstādīt","");
  115.         }
  116.         else if(listitem == 1)
  117.         {
  118.             new string1[256];
  119.             format(string1,sizeof(string1),"1.%s\n2.%s\n3.%s\n4.%s\n5.%s",
  120.             PlayerInfo[playerid][pParrotSentence][0],
  121.             PlayerInfo[playerid][pParrotSentence][1],
  122.             PlayerInfo[playerid][pParrotSentence][2],
  123.             PlayerInfo[playerid][pParrotSentence][3],
  124.             PlayerInfo[playerid][pParrotSentence][4]);
  125.             Dialog_Show(playerid,PARROTMENU+2,DIALOG_STYLE_LIST,"Papagaiļa frāzes",string1,"Mainīt","Atcelt");
  126.         }
  127.         else if(listitem == 2)
  128.         {
  129.             Dialog_Show(params[0],PARROTMENU+3,0,"Papagailis","Ko vēlaties darīt?", "Uzlikt", "Noņemt");
  130.         }
  131.     }
  132.     return 1;
  133. }
  134.  
  135. Dialog:PARROTMENU+1(playerid, response, listitem, inputtext[])
  136. {
  137.     if(response)
  138.     {
  139.         if(strlen(inputtext) < 3 || strlen(inputtext) > 20)
  140.         {
  141.             Dialog_Show(playerid,PARROTMENU+1,DIALOG_STYLE_INPUT,"Papagaiļa vārds","Papagailis runās, kad tiks pieminēts viņa vārds. (3-20 simboli)","Uzstādīt","");
  142.         }
  143.         else
  144.         {
  145.             strmid(PlayerInfo[playerid][pParrotName],inputtext,0,strlen(inputtext),255);
  146.             SendClientMessage(playerid,COLOR_ORANGE,"Papagaiļa vārds tika veiskmīgi nomainīts!");
  147.         }
  148.     }
  149.     else
  150.     {
  151.         Dialog_Show(playerid,PARROTMENU+1,DIALOG_STYLE_INPUT,"Papagaiļa vārds","Papagailis runās, kad tiks pieminēts viņa vārds. (3-20 simboli)","Uzstādīt","");
  152.     }
  153.     return 1;
  154. }
  155.  
  156. Dialog:PARROTMENU+2(playerid, response, listitem, inputtext[])
  157. {
  158.     if(response)
  159.     {
  160.         if(listitem == 0)
  161.         {
  162.             Dialog_Show(playerid,PARROT,DIALOG_STYLE_INPUT,"Mainīt frāzi","Frāzei ir jabūt 3-35 simbolu garai.","Mainīt","Atcelt");
  163.         }
  164.         else if(listitem == 1)
  165.         {
  166.             Dialog_Show(playerid,PARROT+1,DIALOG_STYLE_INPUT,"Mainīt frāzi","Frāzei ir jabūt 3-35 simbolu garai.","Mainīt","Atcelt");
  167.         }
  168.         else if(listitem == 2)
  169.         {
  170.             Dialog_Show(playerid,PARROT+2,DIALOG_STYLE_INPUT,"Mainīt frāzi","Frāzei ir jabūt 3-35 simbolu garai.","Mainīt","Atcelt");
  171.         }
  172.         else if(listitem == 3)
  173.         {
  174.             Dialog_Show(playerid,PARROT+3,DIALOG_STYLE_INPUT,"Mainīt frāzi","Frāzei ir jabūt 3-35 simbolu garai.","Mainīt","Atcelt");
  175.         }
  176.         else if(listitem == 4)
  177.         {
  178.             Dialog_Show(playerid,PARROT+4,DIALOG_STYLE_INPUT,"Mainīt frāzi","Frāzei ir jabūt 3-35 simbolu garai.","Mainīt","Atcelt");
  179.         }
  180.     }
  181.     return 1;
  182. }
  183.  
  184. Dialog:PARROTMENU+3(playerid, response, listitem, inputtext[])
  185. {
  186.     if(response)
  187.     {
  188.         SetPlayerAttachedObject(playerid,PARROT_INDEX,19078,1,0.320722,-0.067912,-0.165151,0.000000,0.000000,0.000000,1.000000,1.000000,1.000000); // Parrot
  189.         PlayerInfo[playerid][pParrot] = 1;
  190.         SendClientMessage(playerid,COLOR_ORANGE,"Papagailis tika uzlikts uz pleca.");
  191.         Inventory_Remove(playerid, "Papagailis");
  192.     }
  193.     else
  194.     {
  195.         RemovePlayerAttachedObject(playerid,PARROT_INDEX);
  196.         PlayerInfo[playerid][pParrot] = 0;
  197.         SendClientMessage(playerid,COLOR_ORANGE,"Papagailis tika noņemts no pleca.");
  198.         Inventory_Add(playerid, "Papagailis", 19078);
  199.     }
  200.     return 1;
  201. }
  202.  
  203. Dialog:PARROT(playerid, response, listitem, inputtext[])
  204. {
  205.     if(response)
  206.     {
  207.         if(strlen(inputtext) < 3 || strlen(inputtext) > 35)
  208.         {
  209.             Dialog_Show(playerid,PARROT,DIALOG_STYLE_INPUT,"Mainīt frāzi","Frāzei ir jabūt 3-35 simbolu garai.","Mainīt","Atcelt");
  210.         }
  211.         else
  212.         {
  213.             strmid(PlayerInfo[playerid][pParrotSentence][0],inputtext,0,strlen(inputtext),255);
  214.             SendClientMessage(playerid,COLOR_ORANGE,"Papagaiļa frāze tika veiksmīgi nomainīta!");
  215.         }
  216.     }
  217.     return 1;
  218. }
  219.  
  220. Dialog:PARROT+1(playerid, response, listitem, inputtext[])
  221. {
  222.     if(response)
  223.     {
  224.         if(strlen(inputtext) < 3 || strlen(inputtext) > 35)
  225.         {
  226.             Dialog_Show(playerid,PARROT+1,DIALOG_STYLE_INPUT,"Mainīt frāzi","Frāzei ir jabūt 3-35 simbolu garai.","Mainīt","Atcelt");
  227.         }
  228.         else
  229.         {
  230.             strmid(PlayerInfo[playerid][pParrotSentence][1],inputtext,0,strlen(inputtext),255);
  231.             SendClientMessage(playerid,COLOR_ORANGE,"Papagaiļa frāze tika veiksmīgi nomainīta!");
  232.         }
  233.     }
  234.     return 1;
  235. }
  236.  
  237. Dialog:PARROT+2(playerid, response, listitem, inputtext[])
  238. {
  239.     if(response)
  240.     {
  241.         if(strlen(inputtext) < 3 || strlen(inputtext) > 35)
  242.         {
  243.             Dialog_Show(playerid,PARROT+2,DIALOG_STYLE_INPUT,"Mainīt frāzi","Frāzei ir jabūt 3-35 simbolu garai.","Mainīt","Atcelt");
  244.         }
  245.         else
  246.         {
  247.             strmid(PlayerInfo[playerid][pParrotSentence][2],inputtext,0,strlen(inputtext),255);
  248.             SendClientMessage(playerid,COLOR_ORANGE,"Papagaiļa frāze tika veiksmīgi nomainīta!");
  249.         }
  250.     }
  251.     return 1;
  252. }
  253.  
  254. Dialog:PARROT+3(playerid, response, listitem, inputtext[])
  255. {
  256.     if(response)
  257.     {
  258.         if(strlen(inputtext) < 3 || strlen(inputtext) > 35)
  259.         {
  260.             Dialog_Show(playerid,PARROT+3,DIALOG_STYLE_INPUT,"Mainīt frāzi","Frāzei ir jabūt 3-35 simbolu garai.","Mainīt","Atcelt");
  261.         }
  262.         else
  263.         {
  264.             strmid(PlayerInfo[playerid][pParrotSentence][3],inputtext,0,strlen(inputtext),255);
  265.             SendClientMessage(playerid,COLOR_ORANGE,"Papagaiļa frāze tika veiksmīgi nomainīta!");
  266.         }
  267.     }
  268.     return 1;
  269. }
  270.  
  271. Dialog:PARROT+4(playerid, response, listitem, inputtext[])
  272. {
  273.     if(response)
  274.     {
  275.         if(strlen(inputtext) < 3 || strlen(inputtext) > 35)
  276.         {
  277.             Dialog_Show(playerid,PARROT+4,DIALOG_STYLE_INPUT,"Mainīt frāzi","Frāzei ir jabūt 3-35 simbolu garai.","Mainīt","Atcelt");
  278.         }
  279.         else
  280.         {
  281.             strmid(PlayerInfo[playerid][pParrotSentence][4],inputtext,0,strlen(inputtext),255);
  282.             SendClientMessage(playerid,COLOR_ORANGE,"Papagaiļa frāze tika veiksmīgi nomainīta!");
  283.         }
  284.     }
  285.     return 1;
  286. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement