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>
- #include <sscanf2>
- #include <zcmd>
- #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];
- // -----------------------------------------------------------------------------
- zcmd(tdinero, playerid, params[])
- {
- if(JugadorInfo[playerid][jDinero] != 0)
- {
- new f = MAX_OBJDINERO+1; new dinero, dineronecesario;
- if(!sscanf(params, "d", dinero))
- {
- if(dineronecesario > 1) return SendClientMessage(playerid, COLOR_ROJO, "Usted no tiene suficiente dinero.");
- for(new a = 0; a < sizeof(CoordsDinero); a++)
- {
- if(CoordsDinero[a][0] == 0.0)
- {
- f = a;
- break;
- }
- }
- new string[128];
- if(f > MAX_OBJDINERO) return SendClientMessage(playerid, COLOR_ROJO, "Usted no puede tirar dinero ahora, inténtalo más tarde.");
- 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);
- DineroID[f][0] = dinero;
- GivePlayerMoney(playerid, -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);
- }
- else
- {
- TDinero[f] = CreateObject(1550,CoordsDinero[f][0],CoordsDinero[f][1],CoordsDinero[f][2]-1,0.00000000,0.00000000,0.00000000);
- }
- }
- else
- return SendClientMessage(playerid, COLOR_GRIS, "Utilice: /tdinero [Cantidad]" );
- }
- return 1;
- }
- zcmd(rdinero, playerid, params[])
- {
- 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;
- }
- }
- new string[128];
- 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;
- GivePlayerMoney(playerid, DineroID[f][0]);
- JugadorInfo[playerid][jDinero] += DineroID[f][0];
- DestroyObject(TDinero[f]);
- format(string, sizeof(string), "* %s recoge una bolsa de dinero del suelo.", PlayerName(playerid));
- ProxDetector(30.0, playerid, string, COLOR_VIOLETA,COLOR_VIOLETA,COLOR_VIOLETA,COLOR_VIOLETA,COLOR_VIOLETA);
- }
- return 1;
- }
- // -----------------------------------------------------------------------------
- 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;
- }
- 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