Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //********************************************************
- // Loro parlante hecho por Neymar y Traducido por Ner0x *
- //********************************************************
- #define FILTERSCRIPT
- #include <a_samp>
- #define DIALOG_ID 0
- #define PARROT_PRICE 5000
- #define INDEX 0
- #define Blanco 0xFFFFFFAA
- #define COLOR_FADE1 0xE6E6E6E6
- #define COLOR_FADE2 0xC8C8C8C8
- #define COLOR_FADE3 0xAAAAAAAA
- #define COLOR_FADE4 0x8C8C8C8C
- #define COLOR_FADE5 0x6E6E6E6E
- new stringp[MAX_PLAYERS][256];
- new pHasParrot[MAX_PLAYERS];
- new pParrotName[MAX_PLAYERS];
- new pParrotSentence[MAX_PLAYERS][5][35];
- forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
- forward SendParrotMessage(playerid);
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Loro parlante by Neymar Cargado");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- for(new i=0;i<MAX_PLAYERS;i++)
- {
- if(pHasParrot[i] == 1)
- {
- RemovePlayerAttachedObject(i,INDEX);
- }
- }
- print("\n--------------------------------------");
- print(" Loro parlante by Neymar Cerrado");
- print("--------------------------------------\n");
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- new string[2];
- format(string,sizeof(string)," ");
- strmid(pParrotSentence[playerid][0],string,0,strlen(string),255);
- strmid(pParrotSentence[playerid][1],string,0,strlen(string),255);
- strmid(pParrotSentence[playerid][2],string,0,strlen(string),255);
- strmid(pParrotSentence[playerid][3],string,0,strlen(string),255);
- strmid(pParrotSentence[playerid][4],string,0,strlen(string),255);
- strmid(pParrotName,string,0,strlen(string),255);
- pHasParrot[playerid] = 0;
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(pHasParrot[playerid] == 1)
- {
- RemovePlayerAttachedObject(playerid,INDEX);
- }
- new string[2];
- format(string,sizeof(string)," ");
- strmid(pParrotSentence[playerid][0],string,0,strlen(string),255);
- strmid(pParrotSentence[playerid][1],string,0,strlen(string),255);
- strmid(pParrotSentence[playerid][2],string,0,strlen(string),255);
- strmid(pParrotSentence[playerid][3],string,0,strlen(string),255);
- strmid(pParrotSentence[playerid][4],string,0,strlen(string),255);
- strmid(pParrotName,string,0,strlen(string),255);
- pHasParrot[playerid] = 0;
- return 1;
- }
- public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
- {
- if(IsPlayerConnected(playerid))
- {
- new Float:posx, Float:posy, Float:posz;
- new Float:oldposx, Float:oldposy, Float:oldposz;
- new Float:tempposx, Float:tempposy, Float:tempposz;
- GetPlayerPos(playerid, oldposx, oldposy, oldposz);
- //radi = 2.0; //Trigger Radius
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
- {
- GetPlayerPos(i, posx, posy, posz);
- tempposx = (oldposx -posx);
- tempposy = (oldposy -posy);
- tempposz = (oldposz -posz);
- //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
- if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
- {
- SendClientMessage(i, col1, string);
- }
- else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
- {
- SendClientMessage(i, col2, string);
- }
- else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
- {
- SendClientMessage(i, col3, string);
- }
- else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
- {
- SendClientMessage(i, col4, string);
- }
- else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
- {
- SendClientMessage(i, col5, string);
- }
- }
- }
- }//not connected
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- new Float:X,Float:Y,Float:Z;
- for(new p=0;p<MAX_PLAYERS;p++)
- {
- if(strfind(text,pParrotName[p],true)!=-1)
- {
- GetPlayerPos(playerid,X,Y,Z);
- if(IsPlayerInRangeOfPoint(p, 10.0, X, Y, Z))
- {
- new sent = random(4);
- switch(sent)
- {
- case 0:
- {
- if(strlen(pParrotSentence[p][0]) > 3)
- {
- format(stringp[playerid],256,"%s dice: %s",pParrotName[p],pParrotSentence[p][0]);
- SetTimerEx("SendParrotMessage",180,0,"i", playerid);
- }
- }
- case 1:
- {
- if(strlen(pParrotSentence[p][1]) > 3)
- {
- format(stringp[playerid],256,"%s dice: %s",pParrotName[p],pParrotSentence[p][1]);
- SetTimerEx("SendParrotMessage",180,0,"i", playerid);
- }
- }
- case 2:
- {
- if(strlen(pParrotSentence[p][2]) > 3)
- {
- format(stringp[playerid],256,"%s dice: %s",pParrotName[p],pParrotSentence[p][2]);
- SetTimerEx("SendParrotMessage",180,0,"i", playerid);
- }
- }
- case 3:
- {
- if(strlen(pParrotSentence[p][3]) > 3)
- {
- format(stringp[playerid],256,"%s dice: %s",pParrotName[p],pParrotSentence[p][3]);
- SetTimerEx("SendParrotMessage",180,0,"i", playerid);
- }
- }
- case 4:
- {
- if(strlen(pParrotSentence[p][4]) > 3)
- {
- format(stringp[playerid],256,"%s dice: %s",pParrotName[p],pParrotSentence[p][4]);
- SetTimerEx("SendParrotMessage",180,0,"i", playerid);
- }
- }
- }
- }
- }
- }
- return 1;
- }
- public SendParrotMessage(playerid)
- {
- ProxDetector(20.0, playerid, stringp[playerid],COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new string[128];
- if (strcmp("/comprarloro", cmdtext, true) == 0)
- {
- if(GetPlayerMoney(playerid) >= PARROT_PRICE)
- {
- GivePlayerMoney(playerid,-PARROT_PRICE);
- format(string,sizeof(string)," Has comprado un {F70C47}loro hablador{FFFFFF} por {6CE61C}${FFFFFF}%i.",PARROT_PRICE);
- SendClientMessage(playerid,Blanco,string);
- SendClientMessage(playerid,Blanco," Para ensecharle a hablar usa {F70C47}/enseñarfrases{FFFFFF}.");
- pHasParrot[playerid] = 1;
- SetPlayerAttachedObject(playerid,INDEX,19078,1,0.320722,-0.067912,-0.165151,0.000000,0.000000,0.000000,1.000000,1.000000,1.000000); // Parrot
- 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","");
- }
- else
- {
- format(string,sizeof(string)," Un loro parlante cuesta {6CE61C}${FFFFFF}%i.",PARROT_PRICE);
- SendClientMessage(playerid,Blanco,string);
- }
- return 1;
- }
- if (strcmp("/enseñarfrases", cmdtext, true) == 0)
- {
- if(pHasParrot[playerid] == 1)
- {
- new string1[256];
- format(string1,sizeof(string1),"1.%s\n2.%s\n3.%s\n4.%s\n5.%s",
- pParrotSentence[playerid][0],
- pParrotSentence[playerid][1],
- pParrotSentence[playerid][2],
- pParrotSentence[playerid][3],
- pParrotSentence[playerid][4]);
- ShowPlayerDialog(playerid,DIALOG_ID+1,DIALOG_STYLE_LIST,"Oraciones del Loro",string1,"Cambiar","Cancelar");
- }
- else
- {
- SendClientMessage(playerid,Blanco," Usted no tiene un {F70C47}loro parlante{FFFFFF}.");
- }
- return 1;
- }
- return 0;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == DIALOG_ID)
- {
- if(response)
- {
- if(strlen(inputtext) < 3 || strlen(inputtext) > 20)
- {
- 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","");
- }
- else
- {
- strmid(pParrotName[playerid],inputtext,0,strlen(inputtext),255);
- SendClientMessage(playerid,Blanco," Nombre del Loro Cambiado.");
- }
- }
- else
- {
- 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","");
- }
- }
- if(dialogid == DIALOG_ID+1)
- {
- if(response)
- {
- if(listitem == 0)
- {
- 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");
- }
- else if(listitem == 1)
- {
- 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");
- }
- else if(listitem == 2)
- {
- 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");
- }
- else if(listitem == 3)
- {
- 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");
- }
- else if(listitem == 4)
- {
- 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");
- }
- }
- }
- else if(dialogid == DIALOG_ID+2)
- {
- if(response)
- {
- if(strlen(inputtext) < 3 || strlen(inputtext) > 35)
- {
- 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");
- }
- else
- {
- strmid(pParrotSentence[playerid][0],inputtext,0,strlen(inputtext),255);
- SendClientMessage(playerid,Blanco," Oración Nº1 Cambiada.");
- }
- }
- }
- else if(dialogid == DIALOG_ID+3)
- {
- if(response)
- {
- if(strlen(inputtext) < 3 || strlen(inputtext) > 35)
- {
- 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");
- }
- else
- {
- strmid(pParrotSentence[playerid][1],inputtext,0,strlen(inputtext),255);
- SendClientMessage(playerid,Blanco," Oración Nº2 Cambiada.");
- }
- }
- }
- else if(dialogid == DIALOG_ID+4)
- {
- if(response)
- {
- if(strlen(inputtext) < 3 || strlen(inputtext) > 35)
- {
- 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");
- }
- else
- {
- strmid(pParrotSentence[playerid][2],inputtext,0,strlen(inputtext),255);
- SendClientMessage(playerid,Blanco," Oración Nº3 Cambiada.");
- }
- }
- }
- else if(dialogid == DIALOG_ID+5)
- {
- if(response)
- {
- if(strlen(inputtext) < 3 || strlen(inputtext) > 35)
- {
- 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");
- }
- else
- {
- strmid(pParrotSentence[playerid][3],inputtext,0,strlen(inputtext),255);
- SendClientMessage(playerid,Blanco," Oración Nº4 Cambiada.");
- }
- }
- }
- else if(dialogid == DIALOG_ID+6)
- {
- if(response)
- {
- if(strlen(inputtext) < 3 || strlen(inputtext) > 35)
- {
- 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");
- }
- else
- {
- strmid(pParrotSentence[playerid][4],inputtext,0,strlen(inputtext),255);
- SendClientMessage(playerid,Blanco," Sentence Nº5 Cambiada.");
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement