Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Autor: DeadSkyTkb en SA-MP Forums; Jedashe en PawnoScripting */
- #include <a_samp>
- #define MAX_OBJDINERO 100 // El máximo de bolsas de dinero que pueden haber en el suelo.
- #define COLOR_VIOLETA 0xC2A2DAAA
- #define COLOR_ROJO 0xE60000FF
- #define COLOR_GRIS 0xAFAFAFAA
- // -----------------------------------------------------------------------------
- new Float:CoordsDinero[MAX_OBJDINERO][3];
- new TDinero[MAX_OBJDINERO];
- new DineroID[MAX_OBJDINERO][1];
- new BigEar[MAX_PLAYERS];
- // -----------------------------------------------------------------------------
- enum jInfo
- {
- jDinero
- };
- new JugadorInfo[MAX_PLAYERS][jInfo];
- // -----------------------------------------------------------------------------
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new cmd[256];
- new tmp[256];
- new idx;
- cmd = strtok(cmdtext,idx);
- if(strcmp(cmd, "/tirardinero", true) == 0 || strcmp(cmd, "/tdinero", true) == 0)
- {
- if(JugadorInfo[playerid][jDinero] != 0)
- {
- new f = MAX_OBJDINERO+1;
- for(new a = 0; a < sizeof(CoordsDinero); a++)
- {
- if(CoordsDinero[a][0] == 0.0)
- {
- f = a;
- break;
- }
- }
- tmp = strtok(cmdtext, idx);
- new dinero = strval(tmp);
- if(!strlen(tmp))
- {
- SendClientMessage(playerid, COLOR_GRIS, "Utilice: /t(irar)dinero [Cantidad]");
- return 1;
- }
- new string[128];
- if(f > MAX_OBJDINERO) return SendClientMessage(playerid, COLOR_ROJO, "Usted no peude tirar dinero ahora, inténtalo más tarde.");
- DineroID[f][0] = dinero;
- JugadorInfo[playerid][jDinero] -= dinero;
- GetPlayerPos(playerid, CoordsDinero[f][0], CoordsDinero[f][1], CoordsDinero[f][2]);
- if(dinero < 1000)
- {
- TDinero[f] = CreateObject(1212,CoordsDinero[f][0],CoordsDinero[f][1],CoordsDinero[f][2]-1,0.00000000,0.00000000,0.00000000);
- format(string, sizeof(string), "* %s tira unos billetes de dinero al suelo.", PlayerName(playerid));
- ProxDetector(30.0, playerid, string, COLOR_VIOLETA,COLOR_VIOLETA,COLOR_VIOLETA,COLOR_VIOLETA,COLOR_VIOLETA);
- }
- else
- {
- TDinero[f] = CreateObject(1550,CoordsDinero[f][0],CoordsDinero[f][1],CoordsDinero[f][2]-1,0.00000000,0.00000000,0.00000000);
- format(string, sizeof(string), "* %s tira una bolsa de dinero al suelo.", PlayerName(playerid));
- ProxDetector(30.0, playerid, string, COLOR_VIOLETA,COLOR_VIOLETA,COLOR_VIOLETA,COLOR_VIOLETA,COLOR_VIOLETA);
- }
- }
- return 1;
- }
- if(strcmp(cmd, "/recogerdinero", true) == 0 || strcmp(cmd, "/rdinero", true) == 0)
- {
- new string2[128];
- new f = MAX_OBJDINERO+1;
- for(new a = 0; a < sizeof(CoordsDinero); a++)
- {
- if(IsPlayerInRangeOfPoint(playerid, 5.0, CoordsDinero[a][0], CoordsDinero[a][1], CoordsDinero[a][2]))
- {
- f = a;
- break;
- }
- }
- if(f > MAX_OBJDINERO) return SendClientMessage(playerid, COLOR_ROJO, "Usted no está cerca de ninguna bolsa o paquete de dinero.");
- else
- {
- CoordsDinero[f][0] = 0.0;
- CoordsDinero[f][1] = 0.0;
- CoordsDinero[f][2] = 0.0;
- JugadorInfo[playerid][jDinero] += DineroID[f][0];
- DestroyObject(TDinero[f]);
- format(string2, sizeof(string2), "* %s recoge dinero del suelo.", PlayerName(playerid));
- ProxDetector(30.0, playerid, string2, COLOR_VIOLETA,COLOR_VIOLETA,COLOR_VIOLETA,COLOR_VIOLETA,COLOR_VIOLETA);
- }
- return 1;
- }
- return 0;
- }
- // -----------------------------------------------------------------------------
- forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
- 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)))
- {
- if(!BigEar[i])
- {
- GetPlayerPos(i, posx, posy, posz);
- tempposx = (oldposx -posx);
- tempposy = (oldposy -posy);
- tempposz = (oldposz -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);
- }
- }
- else
- {
- SendClientMessage(i, col1, string);
- }
- }
- }
- }//not connected
- return 1;
- }
- strtok(const string[], &index)
- {
- new length = strlen(string);
- while ((index < length) && (string[index] <= ' '))
- {
- index++;
- }
- new offset = index;
- new result[20];
- while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
- {
- result[index - offset] = string[index];
- index++;
- }
- result[index - offset] = EOS;
- return result;
- }
- stock PlayerName(playerid)
- {
- new Nombre[24];
- GetPlayerName(playerid,Nombre,24);
- new N[24];
- strmid(N,Nombre,0,strlen(Nombre),24);
- for(new i = 0; i < MAX_PLAYER_NAME; i++)
- {
- if (N[i] == '_') N[i] = ' ';
- }
- return N;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement