Advertisement
Guest User

Papagailis.pwn

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