Guest User

Untitled

a guest
Jun 17th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 11.02 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3.  
  4. #define RED     0xE60000FF
  5. #define ORANGE  0xF97804FF
  6. #define WHITE   0xFFFFFFFF
  7. #define PURPLE  0xB360FDFF
  8.  
  9. new WeaponBox;
  10. new Text3D:BoxLabel;
  11. new isSpawned[MAX_PLAYERS];
  12. new bool: BoxSpawned,bool:AdminBox;
  13.  
  14. stock playername(playerid)
  15. {
  16.     new pName[MAX_PLAYER_NAME];
  17.     GetPlayerName(playerid, pName,MAX_PLAYER_NAME);
  18.     return pName;
  19. }
  20.  
  21.  
  22. public OnFilterScriptInit()
  23. {
  24.     print("\n--------------------------------------");
  25.     print(" Weaponbox 4.0 (C) 2010 - 2011, Adam 'Hoborific' M-S loaded.");
  26.     print("--------------------------------------\n");
  27.     WeaponBox = CreateObject(3796,300,300,3000,0.00000000,0.00000000,0.00000000,100);
  28.     SetTimer("BoxSpawnCheck" ,10 * 1000 ,1);
  29.     SetTimer("BoxAutoSpawn", 300 * 1000 ,1);
  30.     BoxSpawned = false;
  31.     AdminBox = false;
  32.     SetTimer("RandomBoxSpawn", 300 * 1000, true);
  33.     SendClientMessageToAll(ORANGE,"Weapon Box 4.0 by Hoborific loaded");
  34.     return 1;
  35. }
  36.  
  37. /*
  38.  
  39. forward BoxAutoSpawn();
  40.  
  41. public BoxAutoSpawn()
  42. {
  43. if (BoxSpawned == true)
  44. {
  45. DestroyObject(WeaponBox);
  46. Delete3DTextLabel(BoxLabel);
  47. spawnbox();
  48. }
  49. printf("stuff","stuff");
  50. }
  51.  
  52. */
  53.  
  54. forward spawnbox();
  55.  
  56.  
  57.  
  58. public OnFilterScriptExit()
  59. {
  60.     print("\n--------------------------------------");
  61.     print(" Weaponbox 4.0 by Hoborific unloaded.");
  62.     print("--------------------------------------\n");
  63.     DestroyObject(WeaponBox);
  64.     Delete3DTextLabel(BoxLabel);
  65.     BoxSpawned = false;
  66.     AdminBox = false;
  67.     SendClientMessageToAll(RED,"Weapon Box 4.0 by Hoborific has been turned off.");
  68.  
  69.     return 1;
  70. }
  71.  
  72.  
  73.  
  74.  
  75. command(box,playerid,params[]) // used to debug things mainly.
  76. {
  77.     new Float:X, Float:Y, Float:Z;
  78.     if (IsPlayerAdmin(playerid)) {
  79.         DestroyObject(WeaponBox);
  80.         Delete3DTextLabel(BoxLabel);
  81.         GetPlayerPos(playerid,X,Y,Z);
  82.         WeaponBox = CreateObject(1550,X,Y,Z-1,0.00000000,0.00000000,0.00000000,100);
  83.         BoxLabel = Create3DTextLabel("Weapon box",ORANGE,X,Y,Z+1,100,0,true);
  84.         BoxSpawned = true;
  85.         AdminBox = true;
  86.         SendClientMessageToAll(PURPLE,"A Weapon box has been spotted in San Andreas!");
  87.         // I did plan to do more here, will do some more shit in the next update.
  88.         return 1;
  89.     }
  90.     {
  91.         SendClientMessage(playerid,RED, "You aren't an admin");
  92.         return 1;
  93.     }
  94. }
  95.  
  96.  
  97. Float:GetDistance( Float: x1, Float: y1, Float: z1, Float: x2, Float: y2, Float: z2 ) //credits to whom ever this came from, I have forgotten.
  98. {
  99.     new Float:d;
  100.     d += floatpower(x1-x2, 2.0 );
  101.     d += floatpower(y1-y2, 2.0 );
  102.     d += floatpower(z1-z2, 2.0 );
  103.     d = floatsqroot(d);
  104.     return d;
  105. }
  106.  
  107. public spawnbox()
  108. {
  109. switch (random(8))
  110. {
  111. case 0:{
  112.         WeaponBox = CreateObject(1550,154.3803, -1946.2564, 5.1632,100,0,0);
  113.         //BoxLabel = Create3DTextLabel("Weapon box",ORANGE,0,0,0,100,0,true);
  114.         SendClientMessageToAll(WHITE,"[GOLDPOT]: {9933FF}Find the GOldpot Worth 10000$ And 10 Scores(hint:Lighthouse)");
  115.         }
  116. case 1:{
  117.         WeaponBox = CreateObject(1550,2100.9372, -1649.0474, 13.4390,100,0,0);
  118.         //BoxLabel = Create3DTextLabel("Weapon box",ORANGE,0,0,0,100,0,true);
  119.         SendClientMessageToAll(WHITE,"[GOLDPOT]: {9933FF}Find the GOldpot Worth 10000$ And 10 Scores(hint:CJ First Tagging Mission)");
  120.         }
  121. case 2:{
  122.         WeaponBox = CreateObject(1550,2539.5004, 2161.4807, 10.8203,100,0,0);
  123.         //BoxLabel = Create3DTextLabel("Weapon box",ORANGE,0,0,0,100,0,true);
  124.         SendClientMessageToAll(WHITE,"[GOLDPOT]:{FF6600}Find the Goldpot Worth 10000$ And 10 Scores(hint:LV Gift And Jewellers)");
  125.         //SendClientMessageToAll(ORANGE,"{FF6600}Go get it before anyone else does!");
  126.         }
  127. case 3:{
  128.         WeaponBox = CreateObject(1550,-1633.2149, 1421.2930, 7.1875,100,0,0);
  129.         //BoxLabel = Create3DTextLabel("Weapon box",ORANGE,0,0,0,100,0,true);
  130.         SendClientMessageToAll(WHITE,"[GOLDPOT]: {FF00CC}Find the Goldpot Worth 10000$ And 10 Scores(hint:Pier 69)");
  131.         }
  132. case 4:{
  133.         WeaponBox = CreateObject(1550,2002.0093, 1544.3480, 13.5859,100,0,0);
  134.         //BoxLabel = Create3DTextLabel("Weapon box",ORANGE,0,0,0,100,0,true);
  135.         SendClientMessageToAll(WHITE,"[GOLDPOT]: {FFFF00}Find the Goldpot Worth 10000$ And 10 Scores(hint:PirateShip)");
  136.         }
  137. case 5:{
  138.         WeaponBox = CreateObject(1550,2323.7473, 1283.1275, 97.5359,100,0,0);
  139.         BoxLabel = Create3DTextLabel("Weapon box",ORANGE,0,0,0,100,0,true);
  140.         SendClientMessageToAll(WHITE,"[GOLDPOT]: {FF9900}Find the Goldpot Worth 10000$ And 10 Scores(hint:On The Top of The Pyramid)");
  141.         }
  142. case 6:{
  143.         WeaponBox = CreateObject(1550,2089.1010, 1450.8000, 10.8203,100,0,0);
  144.         //BoxLabel = Create3DTextLabel("Weapon box",ORANGE,0,0,0,100,0,true);
  145.         SendClientMessageToAll(WHITE,"[GOLDPOT]: {FF9900}Find the Goldpot Worth 10000$ And 10 Scores(hint:Royal Casino)");
  146.         }
  147. case 7:{
  148.         WeaponBox = CreateObject(1550,-1249.8885, 501.5375, 18.2343,100,0,0);
  149.         //BoxLabel = Create3DTextLabel("Weapon box",ORANGE,0,0,0,100,0,true);
  150.         SendClientMessageToAll(WHITE,"[GOLDPOT]: {00FF00}Find the Goldpot Worth 10000$ And 10 Scores(hint:I Bet My Hydra Can Land Of That Ship)!");
  151.         }
  152.  
  153.  
  154. }
  155. return 1;
  156. }
  157.  
  158. command(forcespawn,playerid,params)
  159. {
  160. if (IsPlayerAdmin(playerid))
  161. {
  162. BoxSpawned = true;
  163. AdminBox = true;
  164. spawnbox();
  165. return 1;
  166. }
  167. SendClientMessage(playerid,RED,"You aren't an admin!");
  168. return 1;
  169. }
  170.  
  171. forward RandomBoxSpawn();
  172.  
  173. public RandomBoxSpawn()
  174. {if (BoxSpawned == true)
  175. {
  176. DestroyObject(WeaponBox);
  177. Delete3DTextLabel(BoxLabel);
  178. spawnbox();
  179. }
  180.  if(BoxSpawned == false)
  181. {
  182. BoxSpawned = true;
  183. spawnbox();
  184.  
  185. }
  186. }
  187.  
  188.  
  189. forward BoxSpawnCheck();
  190. public BoxSpawnCheck()  //I didn't know a better way XD
  191. {
  192. if (AdminBox == true)
  193. {
  194. Weaponbox();
  195. }
  196. if (AdminBox == false && BoxSpawned == true)
  197. {
  198. Weaponbox();
  199. return 1;
  200. }
  201. if (AdminBox == false && BoxSpawned == false)
  202. {
  203. // some function here for random box spawn
  204.  
  205. //Changed to auto random spawn function.
  206. }
  207.  
  208. return 1;
  209. }
  210.  
  211.  
  212. forward Weaponbox();
  213. public Weaponbox()
  214. {
  215.     for(new i = 0; i<MAX_PLAYERS; i++) {
  216.         if(!IsPlayerConnected( i )  && isSpawned[i] ==1) continue;
  217.         new Float:X,Float:Y,Float:Z;
  218.         new Float:BX,Float:BY,Float:BZ;
  219.  
  220.         GetPlayerPos(i,X,Y,Z);
  221.         GetObjectPos(WeaponBox,BX,BY,BZ);
  222.         if (GetDistance(X,Y,Z,BX,BY,BZ) <= 12) {
  223.             //new string[128];
  224. // is now sen't via weapon rand             format(string, 128, "[WEAPONBOX]: Found by {FF0000}%s{FFFFFF} || it contained an{FF0000} AK47!", playername(i));
  225.             //SendClientMessageToAll(WHITE,string);
  226.             DestroyObject(WeaponBox);
  227.             Delete3DTextLabel(BoxLabel);
  228.             weaponboxgive(i);
  229.             BoxSpawned = false;
  230.             AdminBox = false;
  231.             return 1;
  232.         }
  233.     }
  234.     return 1;
  235. }
  236.  
  237.  
  238. /*
  239.     if (GetDistance(X,Y,Z,BX,BY,BZ) <= 30)  {
  240.     SendClientMessage(i,YELLOW," Weapon box is near!");
  241.     }
  242. */
  243.  
  244. forward weaponboxgive(i);
  245. public weaponboxgive(i)
  246. {
  247.  
  248.     switch(random(7)) {
  249.         case 0:
  250.         {
  251.         new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
  252.         GetPlayerName(i, name, sizeof(name));
  253.         format(string, sizeof(string), "%s has Found The GOldpot Which Worth 10000$ And 10 Scores", name);
  254.         SendClientMessageToAll(0xC4C4C4FF, string);
  255.         SetPlayerScore(i,GetPlayerScore(i)+10);
  256.         GivePlayerMoney(i, 10000);
  257.         }
  258.         case 1:
  259.         {
  260.         new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
  261.         GetPlayerName(i, name, sizeof(name));
  262.         format(string, sizeof(string), "%s has Found The GOldpot Which Worth 10000$ And 10 Scores", name);
  263.         SendClientMessageToAll(0xC4C4C4FF, string);
  264.         SetPlayerScore(i,GetPlayerScore(i)+10);
  265.         GivePlayerMoney(i, 10000);
  266.         }
  267.         case 2:
  268.         {
  269.         new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
  270.         GetPlayerName(i, name, sizeof(name));
  271.         format(string, sizeof(string), "%s has Found The GOldpot Which Worth 10000$ And 10 Scores", name);
  272.         SendClientMessageToAll(0xC4C4C4FF, string);
  273.         SetPlayerScore(i,GetPlayerScore(i)+10);
  274.         GivePlayerMoney(i, 10000);
  275.         }
  276.         case 3:
  277.         {
  278.         new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
  279.         GetPlayerName(i, name, sizeof(name));
  280.         format(string, sizeof(string), "%s has Found The GOldpot Which Worth 10000$ And 10 Scores", name);
  281.         SendClientMessageToAll(0xC4C4C4FF, string);
  282.         SetPlayerScore(i,GetPlayerScore(i)+10);
  283.         GivePlayerMoney(i, 10000);
  284.         }
  285.         case 4:
  286.         {
  287.         new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
  288.         GetPlayerName(i, name, sizeof(name));
  289.         format(string, sizeof(string), "%s has Found The GOldpot Which Worth 10000$ And 10 Scores", name);
  290.         SendClientMessageToAll(0xC4C4C4FF, string);
  291.         SetPlayerScore(i,GetPlayerScore(i)+10);
  292.         GivePlayerMoney(i, 10000);
  293.         }
  294.         case 5:
  295.         {
  296.         new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
  297.         GetPlayerName(i, name, sizeof(name));
  298.         format(string, sizeof(string), "%s has Found The GOldpot Which Worth 10000$ And 10 Scores", name);
  299.         SendClientMessageToAll(0xC4C4C4FF, string);
  300.         SetPlayerScore(i,GetPlayerScore(i)+10);
  301.         GivePlayerMoney(i, 10000);
  302.         }
  303.         case 6:
  304.         {
  305.         new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
  306.         GetPlayerName(i, name, sizeof(name));
  307.         format(string, sizeof(string), "%s has Found The GOldpot Which Worth 10000$ And 10 Scores", name);
  308.         SendClientMessageToAll(0xC4C4C4FF, string);
  309.         SetPlayerScore(i,GetPlayerScore(i)+10);
  310.         GivePlayerMoney(i, 10000);
  311.         }
  312.  
  313.     }
  314.     new cash = 3500+random(4500),
  315.         string[128];
  316.     format(string, 128, "{00FF00}You also received {00FF00}$%d! {00FF00}for calling in the Weapon Box to the authorities",cash);
  317.     SendClientMessage(i,WHITE,string);
  318.     GivePlayerMoney(i, 10000);
  319.     BoxSpawned = false;
  320.     AdminBox = false;}
  321.  
  322.  
  323. public OnPlayerConnect(playerid)
  324. {
  325.     isSpawned[playerid] = false;
  326.     SetPlayerVirtualWorld(playerid,0);
  327.     return 1;
  328. }
  329.  
  330.  
  331. public OnPlayerSpawn(playerid)
  332. {
  333.     isSpawned[playerid] = true;
  334.     return 1;
  335. }
  336.  
  337. public OnPlayerRequestClass(playerid)
  338. {
  339.     isSpawned[playerid] = false;
  340.     return 1;
  341. }
  342.  
  343.  
  344.  
  345. command(boxadmin,playerid,params[])
  346. {if(IsPlayerAdmin(playerid))
  347. {
  348. ShowPlayerDialog(playerid,42,DIALOG_STYLE_LIST,"Admin settings for the Weapon Box 4.0 by Hoborific","Enable/Disable\r\nErase Custom spawns\r\nToggle Default Spawns \r\n","Cancel","Select");
  349. return 1;
  350. }
  351.  SendClientMessage(playerid,RED," You are not an Rcon Administrator!");
  352.  return 1;
  353. }
  354.  
  355.  
  356.  
  357. new BoxIO;
  358.  
  359. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  360. {
  361. if(response)
  362.     {
  363.         switch(dialogid)
  364.         {
  365.                 case 42:
  366.                 {
  367.                 switch(listitem)
  368.                 {
  369.                 case 0:
  370.                 {
  371.                 if (BoxIO == 1)
  372.                     {
  373.                     BoxIO = 0;
  374.                     SendClientMessageToAll(RED,"{FF6600}[WEAPONBOX]:{FFFFFF} Weapon box 4.0 By Hoborific has been disabled!");
  375.                     return 1;
  376.                     }
  377.                 else
  378.                     {
  379.                     BoxIO = 1;
  380.                     SendClientMessageToAll(RED,"{00FF00}[WEAPONBOX]:{FFFFFF} Weapon box 4.0 By Hoborific has been Enabled!");
  381.                     return 1;
  382.                     }
  383.                 }
  384.  
  385.                 }
  386.                 }
  387.       }
  388.   }
  389. return 1;
  390. }
Add Comment
Please, Sign In to add comment