Advertisement
Ner0x

[FS/Traducción] Loro hablador

Nov 6th, 2013
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 12.34 KB | None | 0 0
  1. //********************************************************
  2. // Loro parlante hecho por Neymar y Traducido por Ner0x  *
  3. //********************************************************
  4. #define FILTERSCRIPT
  5.  
  6. #include <a_samp>
  7.  
  8. #define DIALOG_ID 0
  9. #define PARROT_PRICE 5000
  10. #define INDEX 0
  11.  
  12. #define Blanco 0xFFFFFFAA
  13. #define COLOR_FADE1 0xE6E6E6E6
  14. #define COLOR_FADE2 0xC8C8C8C8
  15. #define COLOR_FADE3 0xAAAAAAAA
  16. #define COLOR_FADE4 0x8C8C8C8C
  17. #define COLOR_FADE5 0x6E6E6E6E
  18.  
  19. new stringp[MAX_PLAYERS][256];
  20.  
  21. new pHasParrot[MAX_PLAYERS];
  22. new pParrotName[MAX_PLAYERS];
  23. new pParrotSentence[MAX_PLAYERS][5][35];
  24.  
  25. forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
  26. forward SendParrotMessage(playerid);
  27.  
  28. public OnFilterScriptInit()
  29. {
  30.     print("\n--------------------------------------");
  31.     print(" Loro parlante by Neymar Cargado");
  32.     print("--------------------------------------\n");
  33.     return 1;
  34. }
  35.  
  36. public OnFilterScriptExit()
  37. {
  38.     for(new i=0;i<MAX_PLAYERS;i++)
  39.     {
  40.         if(pHasParrot[i] == 1)
  41.         {
  42.             RemovePlayerAttachedObject(i,INDEX);
  43.         }
  44.     }
  45.     print("\n--------------------------------------");
  46.     print(" Loro parlante by Neymar Cerrado");
  47.     print("--------------------------------------\n");
  48.     return 1;
  49. }
  50.  
  51. public OnPlayerConnect(playerid)
  52. {
  53.     new string[2];
  54.     format(string,sizeof(string)," ");
  55.     strmid(pParrotSentence[playerid][0],string,0,strlen(string),255);
  56.     strmid(pParrotSentence[playerid][1],string,0,strlen(string),255);
  57.     strmid(pParrotSentence[playerid][2],string,0,strlen(string),255);
  58.     strmid(pParrotSentence[playerid][3],string,0,strlen(string),255);
  59.     strmid(pParrotSentence[playerid][4],string,0,strlen(string),255);
  60.     strmid(pParrotName,string,0,strlen(string),255);
  61.     pHasParrot[playerid] = 0;
  62.     return 1;
  63. }
  64.  
  65. public OnPlayerDisconnect(playerid, reason)
  66. {
  67.     if(pHasParrot[playerid] == 1)
  68.     {
  69.         RemovePlayerAttachedObject(playerid,INDEX);
  70.     }
  71.     new string[2];
  72.     format(string,sizeof(string)," ");
  73.     strmid(pParrotSentence[playerid][0],string,0,strlen(string),255);
  74.     strmid(pParrotSentence[playerid][1],string,0,strlen(string),255);
  75.     strmid(pParrotSentence[playerid][2],string,0,strlen(string),255);
  76.     strmid(pParrotSentence[playerid][3],string,0,strlen(string),255);
  77.     strmid(pParrotSentence[playerid][4],string,0,strlen(string),255);
  78.     strmid(pParrotName,string,0,strlen(string),255);
  79.     pHasParrot[playerid] = 0;
  80.     return 1;
  81. }
  82.  
  83. public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
  84. {
  85.     if(IsPlayerConnected(playerid))
  86.     {
  87.         new Float:posx, Float:posy, Float:posz;
  88.         new Float:oldposx, Float:oldposy, Float:oldposz;
  89.         new Float:tempposx, Float:tempposy, Float:tempposz;
  90.         GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  91.         //radi = 2.0; //Trigger Radius
  92.         for(new i = 0; i < MAX_PLAYERS; i++)
  93.         {
  94.             if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
  95.             {
  96.                 GetPlayerPos(i, posx, posy, posz);
  97.                 tempposx = (oldposx -posx);
  98.                 tempposy = (oldposy -posy);
  99.                 tempposz = (oldposz -posz);
  100.                 //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
  101.                 if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
  102.                 {
  103.                     SendClientMessage(i, col1, string);
  104.                 }
  105.                 else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
  106.                 {
  107.                     SendClientMessage(i, col2, string);
  108.                 }
  109.                 else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
  110.                 {
  111.                     SendClientMessage(i, col3, string);
  112.                 }
  113.                 else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
  114.                 {
  115.                     SendClientMessage(i, col4, string);
  116.                 }
  117.                 else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  118.                 {
  119.                     SendClientMessage(i, col5, string);
  120.                 }
  121.             }
  122.         }
  123.     }//not connected
  124.     return 1;
  125. }
  126. public OnPlayerText(playerid, text[])
  127. {
  128.     new Float:X,Float:Y,Float:Z;
  129.     for(new p=0;p<MAX_PLAYERS;p++)
  130.     {
  131.         if(strfind(text,pParrotName[p],true)!=-1)
  132.         {
  133.             GetPlayerPos(playerid,X,Y,Z);
  134.             if(IsPlayerInRangeOfPoint(p, 10.0, X, Y, Z))
  135.             {
  136.                 new sent = random(4);
  137.                 switch(sent)
  138.                 {
  139.                     case 0:
  140.                     {
  141.                         if(strlen(pParrotSentence[p][0]) > 3)
  142.                         {
  143.                             format(stringp[playerid],256,"%s dice: %s",pParrotName[p],pParrotSentence[p][0]);
  144.                             SetTimerEx("SendParrotMessage",180,0,"i", playerid);
  145.                         }
  146.                     }
  147.                     case 1:
  148.                     {
  149.                         if(strlen(pParrotSentence[p][1]) > 3)
  150.                         {
  151.                             format(stringp[playerid],256,"%s dice: %s",pParrotName[p],pParrotSentence[p][1]);
  152.                             SetTimerEx("SendParrotMessage",180,0,"i", playerid);
  153.                         }
  154.                     }
  155.                     case 2:
  156.                     {
  157.                         if(strlen(pParrotSentence[p][2]) > 3)
  158.                         {
  159.                             format(stringp[playerid],256,"%s dice: %s",pParrotName[p],pParrotSentence[p][2]);
  160.                             SetTimerEx("SendParrotMessage",180,0,"i", playerid);
  161.                         }
  162.                     }
  163.                     case 3:
  164.                     {
  165.                         if(strlen(pParrotSentence[p][3]) > 3)
  166.                         {
  167.                             format(stringp[playerid],256,"%s dice: %s",pParrotName[p],pParrotSentence[p][3]);
  168.                             SetTimerEx("SendParrotMessage",180,0,"i", playerid);
  169.                         }
  170.                     }
  171.                     case 4:
  172.                     {
  173.                         if(strlen(pParrotSentence[p][4]) > 3)
  174.                         {
  175.                             format(stringp[playerid],256,"%s dice: %s",pParrotName[p],pParrotSentence[p][4]);
  176.                             SetTimerEx("SendParrotMessage",180,0,"i", playerid);
  177.                         }
  178.                     }
  179.                 }
  180.             }
  181.         }
  182.     }
  183.     return 1;
  184. }
  185.  
  186. public SendParrotMessage(playerid)
  187. {
  188.     ProxDetector(20.0, playerid, stringp[playerid],COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
  189. }
  190.  
  191. public OnPlayerCommandText(playerid, cmdtext[])
  192. {
  193.     new string[128];
  194.     if (strcmp("/comprarloro", cmdtext, true) == 0)
  195.     {
  196.         if(GetPlayerMoney(playerid) >= PARROT_PRICE)
  197.         {
  198.             GivePlayerMoney(playerid,-PARROT_PRICE);
  199.             format(string,sizeof(string)," Has comprado un {F70C47}loro hablador{FFFFFF} por {6CE61C}${FFFFFF}%i.",PARROT_PRICE);
  200.             SendClientMessage(playerid,Blanco,string);
  201.             SendClientMessage(playerid,Blanco," Para ensecharle a hablar usa {F70C47}/enseñarfrases{FFFFFF}.");
  202.             pHasParrot[playerid] = 1;
  203.             SetPlayerAttachedObject(playerid,INDEX,19078,1,0.320722,-0.067912,-0.165151,0.000000,0.000000,0.000000,1.000000,1.000000,1.000000); // Parrot
  204.             ShowPlayerDialog(playerid,DIALOG_ID,DIALOG_STYLE_INPUT,"{FF0000}Nombre para su Loro"," {FFFFFF}Porfavor escriba el nombre que quiere para su loro\n{FFFFFF}Caracteres: Máximos: 20 | Minimos: 3","Poner","");
  205.         }
  206.         else
  207.         {
  208.             format(string,sizeof(string)," Un loro parlante cuesta {6CE61C}${FFFFFF}%i.",PARROT_PRICE);
  209.             SendClientMessage(playerid,Blanco,string);
  210.         }
  211.         return 1;
  212.     }
  213.     if (strcmp("/enseñarfrases", cmdtext, true) == 0)
  214.     {
  215.         if(pHasParrot[playerid] == 1)
  216.         {
  217.             new string1[256];
  218.             format(string1,sizeof(string1),"1.%s\n2.%s\n3.%s\n4.%s\n5.%s",
  219.             pParrotSentence[playerid][0],
  220.             pParrotSentence[playerid][1],
  221.             pParrotSentence[playerid][2],
  222.             pParrotSentence[playerid][3],
  223.             pParrotSentence[playerid][4]);
  224.             ShowPlayerDialog(playerid,DIALOG_ID+1,DIALOG_STYLE_LIST,"Oraciones del Loro",string1,"Cambiar","Cancelar");
  225.         }
  226.         else
  227.         {
  228.             SendClientMessage(playerid,Blanco," Usted no tiene un {F70C47}loro parlante{FFFFFF}.");
  229.         }
  230.         return 1;
  231.     }
  232.     return 0;
  233. }
  234.  
  235. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  236. {
  237.     if(dialogid == DIALOG_ID)
  238.     {
  239.         if(response)
  240.         {
  241.             if(strlen(inputtext) < 3 || strlen(inputtext) > 20)
  242.             {
  243.                 ShowPlayerDialog(playerid,DIALOG_ID,DIALOG_STYLE_INPUT,"{FF0000}Nombre para su Loro"," {FFFFFF}Porfavor escriba el nombre que quiere para su loro\n{FFFFFF}Caracteres: Máximos: 20 | Minimos: 3","Poner","");
  244.             }
  245.             else
  246.             {
  247.                 strmid(pParrotName[playerid],inputtext,0,strlen(inputtext),255);
  248.                 SendClientMessage(playerid,Blanco," Nombre del Loro Cambiado.");
  249.             }
  250.         }
  251.         else
  252.         {
  253.             ShowPlayerDialog(playerid,DIALOG_ID,DIALOG_STYLE_INPUT,"{FF0000}Nombre para su Loro"," {FFFFFF}Porfavor escriba el nombre que quiere para su loro\n{FFFFFF}Caracteres: Máximos: 20 | Minimos: 3","Poner","");
  254.         }
  255.     }
  256.     if(dialogid == DIALOG_ID+1)
  257.     {
  258.         if(response)
  259.         {
  260.             if(listitem == 0)
  261.             {
  262.                 ShowPlayerDialog(playerid,DIALOG_ID+2,DIALOG_STYLE_INPUT," Cambio Oración"," Porfavor, escribe una frase con un minimo de 3 caracteres y un máximo de 35 caracteres:","Cambiar","Cancelar");
  263.             }
  264.             else if(listitem == 1)
  265.             {
  266.                 ShowPlayerDialog(playerid,DIALOG_ID+3,DIALOG_STYLE_INPUT," Cambio Oración"," Porfavor, escribe una frase con un minimo de 3 caracteres y un máximo de 35 caracteres:","Cambiar","Cancelar");
  267.             }
  268.             else if(listitem == 2)
  269.             {
  270.                 ShowPlayerDialog(playerid,DIALOG_ID+4,DIALOG_STYLE_INPUT," Cambio Oración"," Porfavor, escribe una frase con un minimo de 3 caracteres y un máximo de 35 caracteres:","Cambiar","Cancelar");
  271.             }
  272.             else if(listitem == 3)
  273.             {
  274.                 ShowPlayerDialog(playerid,DIALOG_ID+5,DIALOG_STYLE_INPUT," Cambio Oración"," Porfavor, escribe una frase con un minimo de 3 caracteres y un máximo de 35 caracteres:","Cambiar","Cancelar");
  275.             }
  276.             else if(listitem == 4)
  277.             {
  278.                 ShowPlayerDialog(playerid,DIALOG_ID+6,DIALOG_STYLE_INPUT," Cambio Oración"," Porfavor, escribe una frase con un minimo de 3 caracteres y un máximo de 35 caracteres:","Cambiar","Cancelar");
  279.             }
  280.         }
  281.     }
  282.     else if(dialogid == DIALOG_ID+2)
  283.     {
  284.         if(response)
  285.         {
  286.             if(strlen(inputtext) < 3 || strlen(inputtext) > 35)
  287.             {
  288.                 ShowPlayerDialog(playerid,DIALOG_ID+2,DIALOG_STYLE_INPUT," Cambio Oración"," Porfavor, escribe una frase con un minimo de 3 caracteres y un máximo de 35 caracteres:","Cambiar","Cancelar");
  289.             }
  290.             else
  291.             {
  292.                 strmid(pParrotSentence[playerid][0],inputtext,0,strlen(inputtext),255);
  293.                 SendClientMessage(playerid,Blanco," Oración Nº1 Cambiada.");
  294.             }
  295.         }
  296.     }
  297.     else if(dialogid == DIALOG_ID+3)
  298.     {
  299.         if(response)
  300.         {
  301.             if(strlen(inputtext) < 3 || strlen(inputtext) > 35)
  302.             {
  303.                 ShowPlayerDialog(playerid,DIALOG_ID+3,DIALOG_STYLE_INPUT," Cambio Oración"," Porfavor, escribe una frase con un minimo de 3 caracteres y un máximo de 35 caracteres:","Cambiar","Cancelar");
  304.             }
  305.             else
  306.             {
  307.                 strmid(pParrotSentence[playerid][1],inputtext,0,strlen(inputtext),255);
  308.                 SendClientMessage(playerid,Blanco," Oración Nº2 Cambiada.");
  309.             }
  310.         }
  311.     }
  312.     else if(dialogid == DIALOG_ID+4)
  313.     {
  314.         if(response)
  315.         {
  316.             if(strlen(inputtext) < 3 || strlen(inputtext) > 35)
  317.             {
  318.                 ShowPlayerDialog(playerid,DIALOG_ID+4,DIALOG_STYLE_INPUT," Cambio Oración"," Porfavor, escribe una frase con un minimo de 3 caracteres y un máximo de 35 caracteres:","Cambiar","Cancelar");
  319.             }
  320.             else
  321.             {
  322.                 strmid(pParrotSentence[playerid][2],inputtext,0,strlen(inputtext),255);
  323.                 SendClientMessage(playerid,Blanco," Oración Nº3 Cambiada.");
  324.             }
  325.         }
  326.     }
  327.     else if(dialogid == DIALOG_ID+5)
  328.     {
  329.         if(response)
  330.         {
  331.             if(strlen(inputtext) < 3 || strlen(inputtext) > 35)
  332.             {
  333.                 ShowPlayerDialog(playerid,DIALOG_ID+5,DIALOG_STYLE_INPUT," Cambio Oración"," Porfavor, escribe una frase con un minimo de 3 caracteres y un máximo de 35 caracteres:","Cambiar","Cancelar");
  334.             }
  335.             else
  336.             {
  337.                 strmid(pParrotSentence[playerid][3],inputtext,0,strlen(inputtext),255);
  338.                 SendClientMessage(playerid,Blanco," Oración Nº4 Cambiada.");
  339.             }
  340.         }
  341.     }
  342.     else if(dialogid == DIALOG_ID+6)
  343.     {
  344.         if(response)
  345.         {
  346.             if(strlen(inputtext) < 3 || strlen(inputtext) > 35)
  347.             {
  348.                 ShowPlayerDialog(playerid,DIALOG_ID+6,DIALOG_STYLE_INPUT," Cambio Oración"," Porfavor, escribe una frase con un minimo de 3 caracteres y un máximo de 35 caracteres:","Cambiar","Cancelar");
  349.             }
  350.             else
  351.             {
  352.                 strmid(pParrotSentence[playerid][4],inputtext,0,strlen(inputtext),255);
  353.                 SendClientMessage(playerid,Blanco," Sentence Nº5 Cambiada.");
  354.             }
  355.         }
  356.     }
  357.     return 1;
  358. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement