Badyx

[FS] Atraco al banco

Nov 15th, 2012
402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 6.83 KB | None | 0 0
  1. /*
  2.         Sistema atraco al banco By Badyx
  3.                                                         */
  4. #include <a_samp>
  5.  
  6. /*      Macros      */
  7.  
  8. #define \
  9.             funcion%0(%1) \
  10.                             forward %0(%1); public %0(%1)
  11.  
  12. /*      Colores     */
  13.  
  14. #define Rojo                                                          0xAA3333AA
  15. #define Verde                                                         0x9EC73DAA
  16. #define Rosado                                                        0xC2A2DAAA
  17.  
  18. /*      News        */
  19. new AtracarBanco = 0;
  20. new IntentosAtraco = 0;
  21. new bool:EstaAtracando[MAX_PLAYERS];
  22. new BigEar[MAX_PLAYERS];
  23.  
  24. #if defined FILTERSCRIPT
  25.  
  26. public OnFilterScriptInit()        /*      Badyx       */
  27. {
  28.     AtracarBanco = 0;
  29.     IntentosAtraco = 0;
  30.     return 1;
  31. }
  32.  
  33. #else
  34.  
  35. main(){}
  36.  
  37. #endif
  38.  
  39. funcion OnPlayerConnect(playerid)        /*      Badyx       */
  40. {
  41.     Seteos(playerid);
  42.     return 1;
  43. }
  44.  
  45. funcion OnPlayerDisconnect(playerid, reason)        /*      Badyx       */
  46. {
  47.     Seteos(playerid);
  48.     return 1;
  49. }
  50.  
  51. funcion OnPlayerCommandText(playerid, cmdtext[])
  52. {
  53.     new string[150];
  54.     if (strcmp("/AtracarBanco", cmdtext, true, 10) == 0)        /*      Badyx       */
  55.     {
  56.         if(AtracarBanco == 1)return SendClientMessage(playerid, Rojo,  #[Error] Este banco no posee mas dinero);
  57.         if(EstaAtracando[playerid] == true) return SendClientMessage(playerid, Rojo,  #[Error] Usted ya esta atracando);
  58.         if(IntentosAtraco == 3) AtracarBanco = 1;
  59.         if (!PlayerToPoint(100, playerid,-30.875, -88.9609, 1004.53)) return SendClientMessage(playerid, Rojo,  #[Error] Usted no esta en el banco);
  60.         if(GetPlayerWeapon(playerid) >= 1)
  61.         {
  62.         new gunID = GetPlayerWeapon(playerid), gunname[32];
  63.         GetWeaponName(gunID, gunname, sizeof(gunname));
  64.         format(string, sizeof(string), " %s empuña su %s y apunta al cajero.", NombreEx(playerid),gunname);
  65.         ProxDetector(12.0, playerid, string,Rosado,Rosado,Rosado,Rosado,Rosado);
  66.         EstaAtracando[playerid] = true;
  67.         SetTimerEx("Atracando", 10000, false, "i", playerid);
  68.         return 1;
  69.         }
  70.         return  SendClientMessage(playerid, Rojo, #[Error] Necesitas un arma);
  71.     }
  72.     return 0;
  73. }
  74.  
  75. funcion TerminarAtraco(playerid)        /*      Badyx       */
  76. {
  77.     EstaAtracando[playerid] = false;
  78.     return 1;
  79. }
  80.  
  81. funcion Atracando(playerid)        /*      Badyx       */
  82. {
  83.     new Opciones = random(4);
  84.     EstaAtracando[playerid] = false;
  85.     switch(Opciones)
  86.     {
  87.     case 0,3,2: {   SendClientMessage(playerid, Rojo,  #[Info] Tu arma a caido al suelo y no pudiste atracar. PATOSO);  IntentosAtraco +=1; return 1;   }
  88.     case 1,4:       DineroAtraco(playerid);
  89.     }
  90.     return 1;
  91. }
  92.  
  93. funcion VolveraAtracar(playerid)        /*      Badyx       */
  94. {
  95.     Seteos(playerid);
  96.     return 1;
  97. }
  98.  
  99. funcion DineroAtraco(playerid)        /*      Badyx       */
  100. {
  101. new Dinero = random(15000); Dinero += 10000;
  102. new string[128];
  103. format(string, sizeof(string), "Conseguiste %d en el atraco", Dinero);
  104. SendClientMessage(playerid,Verde, string);
  105. AtracarBanco = 1;
  106. GivePlayerMoney(playerid, Dinero);
  107. SetTimer("VolveraAtracar", 600000, 1);  /*      10 Minutos      */
  108.  
  109. return 1;
  110. }
  111.  
  112. funcion Seteos(playerid)        /*      Badyx       */
  113. {
  114.     EstaAtracando[playerid] = false;
  115.     EstaAtracando[playerid] = false;
  116.     return 1;
  117. }
  118.  
  119.  
  120. /*      Funciones de otros      */
  121.  
  122. stock NombreEx(playerid)                /*      ¿?       */
  123. {
  124.     new string[24];
  125.     GetPlayerName(playerid,string,24);
  126.     new str[24];
  127.     strmid(str,string,0,strlen(string),24);
  128.     for(new i = 0; i < MAX_PLAYER_NAME; i++)
  129.     {
  130.         if (str[i] == '_') str[i] = ' ';
  131.     }
  132.     return str;
  133. }
  134.  
  135.  
  136. funcion ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)         /*      ¿?       */
  137. {
  138.     if(IsPlayerConnected(playerid))
  139.     {
  140.         new Float:posx, Float:posy, Float:posz;
  141.         new Float:oldposx, Float:oldposy, Float:oldposz;
  142.         new Float:tempposx, Float:tempposy, Float:tempposz;
  143.         GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  144.         for(new i = 0; i < MAX_PLAYERS; i++)
  145.         {
  146.             if(IsPlayerConnected(i))
  147.             {
  148.                 if(!BigEar[i])
  149.                 {
  150.                     GetPlayerPos(i, posx, posy, posz);
  151.                     tempposx = (oldposx -posx);
  152.                     tempposy = (oldposy -posy);
  153.                     tempposz = (oldposz -posz);
  154.                     if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
  155.                     {
  156.                         if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid))
  157.                         {
  158.                             SendClientMessage(i, col1, string);
  159.                         }
  160.                     }
  161.                     else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
  162.                     {
  163.                         if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid))
  164.                         {
  165.                             SendClientMessage(i, col2, string);
  166.                         }
  167.                     }
  168.                     else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
  169.                     {
  170.                         if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid))
  171.                         {
  172.                             SendClientMessage(i, col3, string);
  173.                         }
  174.                     }
  175.                     else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
  176.                     {
  177.                         if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid))
  178.                         {
  179.                             SendClientMessage(i, col4, string);
  180.                         }
  181.                     }
  182.                     else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  183.                     {
  184.                         if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid))
  185.                         {
  186.                             SendClientMessage(i, col5, string);
  187.                         }
  188.                     }
  189.                 }
  190.                 else
  191.                 {
  192.                     SendClientMessage(i, col1, string);
  193.                 }
  194.             }
  195.         }
  196.     }
  197.     return 1;
  198. }
  199.  
  200. funcion PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)                /*      ¿?       */
  201. {
  202.     if(IsPlayerConnected(playerid))
  203.     {
  204.         new Float:oldposx, Float:oldposy, Float:oldposz;
  205.         new Float:tempposx, Float:tempposy, Float:tempposz;
  206.         GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  207.         tempposx = (oldposx -x);
  208.         tempposy = (oldposy -y);
  209.         tempposz = (oldposz -z);
  210.         if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  211.         {
  212.             return 1;
  213.         }
  214.     }
  215.     return 0;
  216. }
  217.  
  218. //============================================================================//
  219. //                                                                            //
  220. //                               FINAL DEL SCRIPT                             //
  221. //                                                                            //
  222. //               SI TE SIRVIO, RESPETA EL TRABAJO DEL CREADOR                 //
  223. //                                                                            //
  224. //============================================================================//
Advertisement
Add Comment
Please, Sign In to add comment