Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Feb 9th, 2010 | Syntax: None | Size: 7.11 KB | Hits: 5 | Expires: Never
Copy text to clipboard
  1. enum boom
  2. {// I scripted that in 30mins XDDD
  3.         Float: bombx,
  4.         Float: bomby,
  5.         Float: bombz,
  6.         plantedby,
  7.         object,
  8.         invehicle
  9. }
  10. new Bomb[50][boom];
  11. new plantedbombs=0;
  12.  
  13. OnGameModeInit
  14. {
  15.         for(new b=0; b<=50; b++)
  16.         {
  17.                 Bomb[b][bombx]=0.0;
  18.                 Bomb[b][bomby]=0.0;
  19.                 Bomb[b][bombz]=0.0;
  20.                 Bomb[b][plantedby]=-1;
  21.                 Bomb[b][object]=-1;
  22.                 Bomb[b][invehcile]=0;
  23.         }
  24. }
  25. OnPlayerDisconnect
  26. {
  27.         if(PlayerTemp[playerid][bombid]!= -1)
  28.         {
  29.                 new b = PlayerTemp[playerid][bombid];
  30.                 Bomb[b][bombx]=0.0;
  31.                 Bomb[b][bomby]=0.0;
  32.                 Bomb[b][bombz]=0.0;
  33.                 Bomb[b][plantedby]=-1;
  34.                 Bomb[b][object]=-1;
  35.                 Bomb[b][invehcile]=0;
  36.                 plantedbombs--;
  37.         }
  38. }
  39.  
  40. if(strcmp(cmd,"/givebomb",true) == 0)
  41. {
  42.         if(PlayerInfo[playerid][power] > 2)
  43.         {
  44.                 new tmp[256];
  45.                 tmp = strtok(cmdtext,idx);
  46.                 if(!strlen(tmp))
  47.                 {
  48.                     SendClientUsage(playerid,cmd,"[playerid/PartOfName]");
  49.                     return 1;
  50.                 }
  51.                 new target = ReturnUser(tmp);
  52.                 if(IsPlayerConnected(target))
  53.                 {
  54.                     new stringa[MAX_STRING];
  55.                     PlayerTemp[target][bomb]=true;
  56.                     format(stringa,sizeof(stringa),"Admin %s gave you bomb",PlayerName(playerid));
  57.                     SendClientInfo(target,stringa);
  58.                     format(stringa,sizeof(stringa),"You gave bomb to %s",PlayerName(target));
  59.                     SendClientInfo(playerid,stringa);
  60.                     return 1;
  61.                 } else SendClientError(playerid,"This player is not connected");
  62.         }
  63.         return 1;
  64. }
  65.  
  66.  
  67. if(strcmp(cmd,"/plantbomb",true) == 0)
  68. {
  69.         if(PlayerTemp[playerid][bomb]==true)
  70.         {
  71.                 new tmp[256];
  72.                 tmp = strtok(cmdtext,idx);
  73.                 if(!strlen(tmp))
  74.                 {
  75.                     SendClientUsage(playerid,cmd,"[ground/car]");
  76.                     return 1;
  77.                 }
  78.                 if(strcmp(tmp,"ground",true) == 0)
  79.                 {
  80.                 if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
  81.                 {
  82.                         if(plantedbombs > 50) return SendClientError(playerid,"Max bombs already planted");
  83.                         new Float: X, Float: Y, Float: Z;
  84.                         GetPlayerPos(playerid,X,Y,Z);
  85.                         plantedbombs++;
  86.                         Bomb[plantedbombs][object]=CreateObject(1654, X, Y, Z-0.9, 0, 90, 0);
  87.                         Bomb[plantebombs][bombx]=X;
  88.                         Bomb[plantedbombs][bomby]=Y;
  89.                         Bomb[plantedbombs[bombz]=Z;
  90.                                 Bomb[plantedbombs][plantedby]=playerid;
  91.                         Bomb[plantedbombs][invehicle]=0;
  92.                        
  93.                         PlayerTemp[playerid][bombid]=plantedbombs;
  94.                         PlayerTemp[playerid][bomb]=false;
  95.                                 printf("%s planted bomb at %.2f %.2f %.2f on ground",PlayerName(playerid),X,Y,Z);
  96.                                 SendClientInfo(playerid,"Bomb planted");
  97.                                 return 1;
  98.                         } else SendClientError(playerid,"You are not on feet");
  99.                 }
  100.                 else if(strcmp(tmp,"car",true) == 0)
  101.                 {
  102.                     if(IsPlayerInAnyVehicle(playerid))
  103.                     {
  104.                         if(plantedbombs > 50) return SendClientError(playerid,"Max bombs already planted");
  105.                                 plantedbombs++;
  106.                                 Bomb[plantedbombs][invehicle]=GetPlayerVehicleID(playerid);
  107.                                 PlayerTemp[playerid][bombid]=plantedbombs;
  108.                                 PlayerTemp[playerid][bomb]=false;
  109.                                 printf("%s planted bomb in car %d",PlayerName(playerid),GetPlayerVehicleID(playerid));
  110.                                 SendClientInfo(playerid,"Bomb planted");
  111.                                 return 1;
  112.                         } else SendClientError(playerid,"You are not in vehicle");
  113.                 }
  114.         } else SendClientError(playerid,"You don't have any bomb");
  115. }
  116.  
  117. if(strcmp(cmd,"/activatebomb",true) == 0)
  118. {
  119.         if(PlayerTemp[playerid][bombid]!=-1)
  120.         {
  121.                 new bombid = PlayerTemp[playerid][bombid];
  122.                 if(Bomb[bombid][invehicle] == 0)
  123.                 {
  124.                     CreateExplosion(Bomb[bombid][bombx],Bomb[bombid][bomby],Bomb[bombid][bombz],7, 10);
  125.                     Bomb[bombid][bombx]=0.0;
  126.                     Bomb[bombid][bomby]=0.0;
  127.                         Bomb[bombid][bombz]=0.0;
  128.                         DestroyObject(Bomb[bombid][obect]);
  129.                         Bomb[bombid][plantedby]=-1;
  130.                         bombid=-1;
  131.                         plantedbombs--;
  132.                         SendClientInfo(playerid,"Bomb activated");
  133.                         return 1;
  134.                 }
  135.                 else
  136.                 {
  137.                         new Float: X, Float: Y, Float: Z;
  138.                         GetVehiclePos(Bomb[bombid][invehicle],X,Y,Z);
  139.                         CreateExplosion(X,Y,Z,7, 10);
  140.                         Bomb[bombid][invehicle]=0;
  141.                         bombid=-1;
  142.                         plantedbombs--;
  143.                         SendClientInfo(playerid,"Bomb activated");
  144.                         return 1;
  145.                 }
  146.         } else SendClientError(playerid,"You didn't plant any bomb");
  147. }
  148.  
  149. if(strcmp(cmd,"/plantedby",true) == 0)
  150. {
  151.         if(PlayerInfo[playerid][power]>2)
  152.         {
  153.             new stringa[MAX_STRING];
  154.             for(new b=0; b<=50; b++)
  155.             {
  156.                 if(IsPlayerInSphere(playerid,Bomb[b][bombx],Bomb[b][bomby],Bomb[b][bombz],3)
  157.                 {
  158.                     format(stringa,sizeof(stringa),"Bombid: %d - Plantedby: %s - Vehicle: %d",b,PlayerName(Bomb[b][plantedby]),Bomb[b][invehicle]);
  159.                     SendClientInfo(playerid,stringa);
  160.                     return 1;
  161.                         }
  162.                 }
  163.         }
  164.         return 1;
  165. }
  166.                
  167. //I WILL EDIT /FRISKCAR COMMAND
  168.  
  169.  
  170. if(strcmp(cmd,"/defusebomb",true) == 0)
  171. {
  172.         new message[MAX_STRING];
  173.         for(new b=0; b<=50; b++)
  174.         {
  175.             if(Bomb[b][invehicle] == 0)
  176.             {
  177.                         if(IsPlayerInSphere(playerid,Bomb[b][bombx],Bomb[b][bomby],Bomb[b][bombz],3)
  178.                         {
  179.                             new rand=random(100);
  180.                             if((rand > 70 && (PlayerInfo[playerid][playerteam] != SASF || PlayerInfo[playerid][playerteam] != COPS))
  181.                                  || rand > 60 && (PlayerInfo[playerid][playerteam] == SASF || PlayerInfo[playerid][playerteam] == COPS))
  182.                             {
  183.                                 format(message,sizeof(message),"%s tries to defuse bomb and fail",PlayerName(playerid));
  184.                                 NearMessage(playerid,message,COLOR_RED);
  185.                                 CreateExplosion(Bomb[b][bombx],Bomb[b][bomby],Bomb[b][bombz],7, 10);
  186.                                 Bomb[b][bombx]=0.0;
  187.                                 Bomb[b][bomby]=0.0;
  188.                                         Bomb[b][bombz]=0.0;
  189.                                         DestroyObject(Bomb[b][obect]);
  190.                                         PlayerTemp[Bomb[b][plantedby][bombid]=-1;
  191.                                         Bomb[b][plantedby]=-1;
  192.                                         plantedbombs--;
  193.                                         return 1;
  194.                                 }
  195.                                 else
  196.                                 {
  197.                                     format(message,sizeof(message),"%s tries to defuse bomb and succeed",PlayerName(playerid));
  198.                                     NearMessage(playerid,message,COLOR_GREEN);
  199.                                 Bomb[b][bombx]=0.0;
  200.                                 Bomb[b][bomby]=0.0;
  201.                                         Bomb[b][bombz]=0.0;
  202.                                         DestroyObject(Bomb[b][obect]);
  203.                                         PlayerTemp[Bomb[b][plantedby][bombid]=-1;
  204.                                         Bomb[b][plantedby]=-1;
  205.                                         plantedbombs--;
  206.                                         return 1;
  207.                                 }
  208.                         }
  209.                 }
  210.                 else
  211.                 {
  212.                     if(PlayerTemp[playerid][foundbomb]==true)
  213.                     {
  214.                             new rand=random(100);
  215.                             if((rand > 70 && (PlayerInfo[playerid][playerteam] != SASF || PlayerInfo[playerid][playerteam] != COPS))
  216.                                  || rand > 60 && (PlayerInfo[playerid][playerteam] == SASF || PlayerInfo[playerid][playerteam] == COPS))
  217.                             {
  218.                                 format(message,sizeof(message),"%s tries to defuse bomb and fail",PlayerName(playerid));
  219.                                 NearMessage(playerid,message,COLOR_RED);
  220.                                 new Float: X, Float: Y, Float: Z;
  221.                                 GetVehiclePos(Bomb[b][invehicle],X,Y,Z);
  222.                                 CreateExplosion(X,Y,Z,7, 10);
  223.                                         PlayerTemp[Bomb[b][plantedby][bombid]=-1;
  224.                                         Bomb[b][plantedby]=-1;
  225.                                         Bomb[b][invehicle]=0;
  226.                                         plantedbombs--;
  227.                                         return 1;
  228.                                 }
  229.                                 else
  230.                                 {
  231.                                     format(message,sizeof(message),"%s tries to defuse bomb and succeed",PlayerName(playerid));
  232.                                     NearMessage(playerid,message,COLOR_GREEN);
  233.                                 new Float: X, Float: Y, Float: Z;
  234.                                 GetVehiclePos(Bomb[b][invehicle],X,Y,Z);
  235.                                         PlayerTemp[Bomb[b][plantedby][bombid]=-1;
  236.                                         Bomb[b][plantedby]=-1;
  237.                                         Bomb[b][invehicle]=0;
  238.                                         plantedbombs--;
  239.                                         return 1;
  240.                                 }
  241.                         }
  242.                         else SendClientError(playerid,"You haven't found any bomb");
  243.                 }
  244.         }
  245.         return 1;
  246. }