Advertisement
Guest User

Bomb Shop

a guest
May 30th, 2015
503
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 7.07 KB | None | 0 0
  1. //==============================================================================
  2. //------------------------------------------------------------------------------
  3. //==================[Script Facut de NoNamed pentru SA-MP.Ro]===================
  4. //------------------[Te Rog Sa Pastrezi Creditele Scriptului]-------------------
  5. //==============================================================================
  6. //------------------------------------------------------------------------------
  7.  
  8. //===========================[Includes]=========================================
  9. #include <a_samp>
  10. #include <streamer>
  11. //===========================[Includes]=========================================
  12.  
  13. //============================[Defines]=========================================
  14. #define COLOR_WHITE 0xFFFFFFAA
  15. #define COLOR_PURPLE 0xC2A2DAAA
  16. //============================[Defines]=========================================
  17.  
  18. //==============================[New's]=========================================
  19. new Float:ax, Float:ay, Float:az;
  20. new bomb[MAX_PLAYERS];
  21. //==============================[New's]=========================================
  22.  
  23. //===========================[Forwards]=========================================
  24. forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
  25. forward ProxDetector(Float:radi, playerid, str[],col1,col2,col3,col4,col5);
  26. forward Explosion();
  27. //===========================[Forwards]=========================================
  28.  
  29. public OnFilterScriptInit()
  30. {
  31.     print("\n---------------------------------------------------");
  32.     print(" Magazin de Bombe - Scriptat de NoNamed");
  33.     print("-----------------------------------------------------\n");
  34.     return 1;
  35. }
  36.  
  37. public OnFilterScriptExit()
  38. {
  39.     return 1;
  40. }
  41. //============================[Comenzi]=========================================
  42. public OnPlayerCommandText(playerid, cmdtext[])
  43. {
  44.     if (strcmp("/bombshop", cmdtext, true, 10) == 0)
  45.     {
  46.         SetPlayerCheckpoint(playerid, 1913.3884,-1070.5337,24.2487, 3.0);
  47.         SendClientMessage(playerid, COLOR_WHITE, "Mergi la {FF0000}checkpoint-ul rosu {FFFFFF}de pe harta !");
  48.         return 1;
  49.     }
  50.     if (strcmp("/buybomb", cmdtext, true, 10) == 0)
  51.     {
  52.         if(PlayerToPoint(5.0, playerid, 1913.3884,-1070.5337,24.2487))
  53.         {
  54.             if(bomb[playerid] == 1)
  55.             {
  56.                 SendClientMessage(playerid, COLOR_WHITE, "Nu poti lua mai mult de o bomba !");
  57.                 return 1;
  58.             }
  59.             else
  60.             {
  61.                 bomb[playerid] += 1;
  62.                 GivePlayerMoney(playerid, -5000);
  63.                 SendClientMessage(playerid, COLOR_WHITE, "Ai cumparat o {FF0000} bomba {FFFFFF}pentru pretul de {FF0000} $5000{FFFFFF}.");
  64.                 SendClientMessage(playerid, COLOR_WHITE, "Foloseste {FF0000} /plantbomb {FFFFFF}pentru a planta bomba normal.");
  65.                 SendClientMessage(playerid, COLOR_WHITE, "Foloseste {FF0000}/silentbomb {FFFFFF} pentru a planta bomba pe ascuns.");
  66.             }
  67.         }
  68.         return 1;
  69.     }
  70.     if (strcmp("/plantbomb", cmdtext, true, 10) == 0)
  71.     {
  72.         new playername[MAX_PLAYER_NAME],string[128];
  73.         GetPlayerPos(playerid, ax,ay,az);
  74.         if(bomb[playerid] == 1)
  75.         {
  76.             ApplyAnimation(playerid, "BOMBER", "BOM_PLANT", 4.1, 0, 0, 0, 0, 0);
  77.             SetTimer("Explosion", 10000, false);
  78.             bomb[playerid] = 0;
  79.             SendClientMessage(playerid, COLOR_WHITE, "Ai plantat bomba, aceasta explodeaza in 10 secunde !");
  80.             GetPlayerName(playerid, playername, sizeof(playername));
  81.             format(string, sizeof(string), "%s a plantat o bomba, e cazul sa fugiti!", playername);
  82.             ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  83.         }
  84.         else
  85.         {
  86.             SendClientMessage(playerid, COLOR_WHITE, "Nu ai o bomba ca sa o plantezi .");
  87.         }
  88.         return 1;
  89.     }
  90.     if (strcmp("/silentbomb", cmdtext, true, 10) == 0)
  91.     {
  92.         GetPlayerPos(playerid, ax,ay,az);
  93.         if(bomb[playerid] == 1)
  94.         {
  95.             ApplyAnimation(playerid, "BOMBER", "BOM_PLANT", 4.1, 0, 0, 0, 0, 0);
  96.             SetTimer("Explosion", 10000, false);
  97.             bomb[playerid] = 0;
  98.             SendClientMessage(playerid, COLOR_WHITE, "Ai plantat bomba, aceasta explodeaza in 10 secunde !");
  99.         }
  100.         else
  101.         {
  102.             SendClientMessage(playerid, COLOR_WHITE, "Nu ai o bomba ca sa o plantezi .");
  103.         }
  104.         return 1;
  105.     }
  106.     return 0;
  107. }
  108. //============================[Comenzi]=========================================
  109.  
  110. //============================[Checkpoint-uri]==================================
  111. public OnPlayerEnterCheckpoint(playerid)
  112. {
  113.     if(PlayerToPoint(3.0, playerid, 1913.3884,-1070.5337,24.2487))
  114.     {
  115.         SendClientMessage(playerid, COLOR_WHITE, "Ai ajuns la destinatie! Foloseste {FF0000}/buybomb{FFFFFF}.");
  116.         DisablePlayerCheckpoint(playerid);
  117.     }
  118.     return 1;
  119. }
  120. //============================[Checkpoint-uri]==================================
  121.  
  122. //=============================[Alte Functii]===================================
  123. public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
  124. {
  125.     if(IsPlayerConnected(playerid))
  126.     {
  127.         new Float:oldposx, Float:oldposy, Float:oldposz;
  128.         new Float:tempposx, Float:tempposy, Float:tempposz;
  129.         GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  130.         tempposx = (oldposx -x);
  131.         tempposy = (oldposy -y);
  132.         tempposz = (oldposz -z);
  133.         if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  134.         {
  135.             return 1;
  136.         }
  137.     }
  138.     return 0;
  139. }
  140. public ProxDetector(Float:radi, playerid, str[],col1,col2,col3,col4,col5)
  141. {
  142.     if(IsPlayerConnected(playerid))
  143.     {
  144.         new Float:posx, Float:posy, Float:posz;
  145.         new Float:oldposx, Float:oldposy, Float:oldposz;
  146.         new Float:tempposx, Float:tempposy, Float:tempposz;
  147.         GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  148.         for(new i = 0; i < MAX_PLAYERS; i++)
  149.         {
  150.             if(IsPlayerConnected(i))
  151.             {
  152.  
  153.                 GetPlayerPos(i, posx, posy, posz);
  154.                 tempposx = (oldposx -posx);
  155.                 tempposy = (oldposy -posy);
  156.                 tempposz = (oldposz -posz);
  157.                 if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
  158.                 {
  159.                     SendClientMessage(i, col1, str);
  160.                 }
  161.                 else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
  162.                 {
  163.                     SendClientMessage(i, col2, str);
  164.                 }
  165.                 else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
  166.                 {
  167.                     SendClientMessage(i, col3, str);
  168.                 }
  169.                 else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
  170.                 {
  171.                     SendClientMessage(i, col4, str);
  172.                 }
  173.                 else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  174.                 {
  175.                     SendClientMessage(i, col5, str);
  176.                 }
  177.             }
  178.         }
  179.     }//not connected
  180.     return 1;
  181. }
  182. public Explosion()
  183. {
  184.     CreateExplosion(ax, ay, az, 11, 5000);
  185. }
  186. //=============================[Alte Functii]===================================
  187.  
  188. /*Scriptat si creat de NoNamed ! Copyright © NoNamed , All Rights Reserved!*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement