Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- All content enclosed in this document and its compiled clone are property of Adam "Hoborific" M-S
- This is not to be re-distributed,sold,given,gifted,or any other shape or form of transfer or disclosure.
- Any breach of the aforementioned terms will result in legal charges being pressed and your server host being contacted.
- You are to abide and follow these rules as you agreed to on downloading.
- Weaponbox 4.0 (C) 2010 - 2011, Adam "Hoborific" M-S
- */
- #include <a_samp>
- #include <zcmd>
- #define RED 0xE60000FF
- #define ORANGE 0xF97804FF
- #define WHITE 0xFFFFFFFF
- #define PURPLE 0xB360FDFF
- new WeaponBox;
- new Text3D:BoxLabel;
- new isSpawned[MAX_PLAYERS];
- new bool: BoxSpawned,bool:AdminBox;
- stock playername(playerid)
- {
- new pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName,MAX_PLAYER_NAME);
- return pName;
- }
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Weaponbox 4.0 (C) 2010 - 2011, Adam 'Hoborific' M-S loaded.");
- print("--------------------------------------\n");
- WeaponBox = CreateObject(3796,300,300,3000,0.00000000,0.00000000,0.00000000,100);
- SetTimer("BoxSpawnCheck" ,10 * 1000 ,1);
- SetTimer("BoxAutoSpawn", 300 * 1000 ,1);
- BoxSpawned = false;
- AdminBox = false;
- SetTimer("RandomBoxSpawn", 300 * 1000, true);
- SendClientMessageToAll(ORANGE,"Weapon Box 4.0 by Hoborific loaded");
- return 1;
- }
- /*
- forward BoxAutoSpawn();
- public BoxAutoSpawn()
- {
- if (BoxSpawned == true)
- {
- DestroyObject(WeaponBox);
- Delete3DTextLabel(BoxLabel);
- spawnbox();
- }
- printf("stuff","stuff");
- }
- */
- forward spawnbox();
- public OnFilterScriptExit()
- {
- print("\n--------------------------------------");
- print(" Weaponbox 4.0 by Hoborific unloaded.");
- print("--------------------------------------\n");
- DestroyObject(WeaponBox);
- Delete3DTextLabel(BoxLabel);
- BoxSpawned = false;
- AdminBox = false;
- SendClientMessageToAll(RED,"Weapon Box 4.0 by Hoborific has been turned off.");
- return 1;
- }
- command(box,playerid,params[]) // used to debug things mainly.
- {
- new Float:X, Float:Y, Float:Z;
- if (IsPlayerAdmin(playerid)) {
- DestroyObject(WeaponBox);
- Delete3DTextLabel(BoxLabel);
- GetPlayerPos(playerid,X,Y,Z);
- WeaponBox = CreateObject(3796,X,Y,Z-1,0.00000000,0.00000000,0.00000000,100);
- BoxLabel = Create3DTextLabel("Weapon box",ORANGE,X,Y,Z+1,100,0,true);
- BoxSpawned = true;
- AdminBox = true;
- SendClientMessageToAll(PURPLE,"A Weapon box has been spotted in San Andreas!");
- // I did plan to do more here, will do some more shit in the next update.
- return 1;
- }
- {
- SendClientMessage(playerid,RED, "You aren't an admin");
- return 1;
- }
- }
- Float:GetDistance( Float: x1, Float: y1, Float: z1, Float: x2, Float: y2, Float: z2 ) //credits to whom ever this came from, I have forgotten.
- {
- new Float:d;
- d += floatpower(x1-x2, 2.0 );
- d += floatpower(y1-y2, 2.0 );
- d += floatpower(z1-z2, 2.0 );
- d = floatsqroot(d);
- return d;
- }
- public spawnbox()
- {
- switch (random(8))
- {
- case 0:{
- WeaponBox = CreateObject(3796,1989.8403,-1482.7559,9.8281,0,0,270.2540,100);
- //BoxLabel = Create3DTextLabel("Weapon box",ORANGE,0,0,0,100,0,true);
- SendClientMessageToAll(WHITE,"[WEAPONBOX]: {9933FF}A Weapon box has been spotted around County General Hospital");
- }
- case 1:{
- WeaponBox = CreateObject(3796,1956.9316,-1201.4017,16.4500,0,0,95.1888,100);
- //BoxLabel = Create3DTextLabel("Weapon box",ORANGE,0,0,0,100,0,true);
- SendClientMessageToAll(WHITE,"[WEAPONBOX]: {9933FF}A Weapon box has been spotted around Glen Park");
- }
- case 2:{
- WeaponBox = CreateObject(3796,1319.8448,-1239.2180,12.5469,0,0,89.0429,100);
- //BoxLabel = Create3DTextLabel("Weapon box",ORANGE,0,0,0,100,0,true);
- SendClientMessageToAll(WHITE,"[WEAPONBOX]:{FF6600}A Weapon box has been delivered to the ammunation, it is hidden across the street.");
- //SendClientMessageToAll(ORANGE,"{FF6600}Go get it before anyone else does!");
- }
- case 3:{
- WeaponBox = CreateObject(3796,1035.3901,-1351.1062,17.5141,0,0,262.1001,100);
- //BoxLabel = Create3DTextLabel("Weapon box",ORANGE,0,0,0,100,0,true);
- SendClientMessageToAll(WHITE,"[WEAPONBOX]: {FF00CC}A Weapon box has been left on the Donut Shop roof (go get it before the pigs realize!)");
- }
- case 4:{
- WeaponBox = CreateObject(3796,1542.9207,-1669.8722,12.5554,0,0,86.3137,100);
- //BoxLabel = Create3DTextLabel("Weapon box",ORANGE,0,0,0,100,0,true);
- SendClientMessageToAll(WHITE,"[WEAPONBOX]: {FFFF00}A Weapon box has been delivered to the LSPD go steal it before they notice it!");
- }
- case 5:{
- WeaponBox = CreateObject(3796,756.8765,-1881.4176,1.5403,0,0,33.1117,100);
- BoxLabel = Create3DTextLabel("Weapon box",ORANGE,0,0,0,100,0,true);
- SendClientMessageToAll(WHITE,"[WEAPONBOX]: {FF9900}A Weapon box has washed up on the beach go find it before someone calls it in!");
- }
- case 6:{
- WeaponBox = CreateObject(3796,305.1527,-1895.3317,0.4861,0,0,350.4532,100);
- //BoxLabel = Create3DTextLabel("Weapon box",ORANGE,0,0,0,100,0,true);
- SendClientMessageToAll(WHITE,"[WEAPONBOX]: {FF9900}A Weapon box has washed up on shore go find it before someone calls it in!");
- }
- case 7:{
- WeaponBox = CreateObject(3796,1483.9762,-1732.2932,5.7253,0,0,269.6984,100);
- //BoxLabel = Create3DTextLabel("Weapon box",ORANGE,0,0,0,100,0,true);
- SendClientMessageToAll(WHITE,"[WEAPONBOX]: {00FF00}A Weapon box has been smuggled and is waiting in the underground sewer network!");
- }
- }
- return 1;
- }
- command(forcespawn,playerid,params)
- {
- if (IsPlayerAdmin(playerid))
- {
- BoxSpawned = true;
- AdminBox = true;
- spawnbox();
- return 1;
- }
- SendClientMessage(playerid,RED,"You aren't an admin!");
- return 1;
- }
- forward RandomBoxSpawn();
- public RandomBoxSpawn()
- {if (BoxSpawned == true)
- {
- DestroyObject(WeaponBox);
- Delete3DTextLabel(BoxLabel);
- spawnbox();
- }
- if(BoxSpawned == false)
- {
- BoxSpawned = true;
- spawnbox();
- }
- }
- forward BoxSpawnCheck();
- public BoxSpawnCheck() //I didn't know a better way XD
- {
- if (AdminBox == true)
- {
- Weaponbox();
- }
- if (AdminBox == false && BoxSpawned == true)
- {
- Weaponbox();
- return 1;
- }
- if (AdminBox == false && BoxSpawned == false)
- {
- // some function here for random box spawn
- //Changed to auto random spawn function.
- }
- return 1;
- }
- forward Weaponbox();
- public Weaponbox()
- {
- for(new i = 0; i<MAX_PLAYERS; i++) {
- if(!IsPlayerConnected( i ) && isSpawned[i] ==1) continue;
- new Float:X,Float:Y,Float:Z;
- new Float:BX,Float:BY,Float:BZ;
- GetPlayerPos(i,X,Y,Z);
- GetObjectPos(WeaponBox,BX,BY,BZ);
- if (GetDistance(X,Y,Z,BX,BY,BZ) <= 12) {
- //new string[128];
- // is now sen't via weapon rand format(string, 128, "[WEAPONBOX]: Found by {FF0000}%s{FFFFFF} || it contained an{FF0000} AK47!", playername(i));
- //SendClientMessageToAll(WHITE,string);
- DestroyObject(WeaponBox);
- Delete3DTextLabel(BoxLabel);
- weaponboxgive(i);
- BoxSpawned = false;
- AdminBox = false;
- return 1;
- }
- }
- return 1;
- }
- /*
- if (GetDistance(X,Y,Z,BX,BY,BZ) <= 30) {
- SendClientMessage(i,YELLOW," Weapon box is near!");
- }
- */
- forward weaponboxgive(i);
- public weaponboxgive(i)
- {
- switch(random(7)) {
- case 0:
- {
- new AK47[128];
- format(AK47, 128, "[WEAPONBOX]: Found by {FF0000}%s{FFFFFF} || it contained an{FF0000} AK47!", playername(i)); GivePlayerWeapon(i,30,999999);
- SendClientMessageToAll(WHITE,AK47);
- }
- case 1:
- {
- new DE[128];
- format(DE, 128, "[WEAPONBOX]: Found by {FF0000}%s{FFFFFF} || it contained a{FF0000} Desert Eagle!", playername(i)); GivePlayerWeapon(i,24,999999);
- SendClientMessageToAll(WHITE,DE);
- }
- case 2:
- {
- new SPAS[128];
- format(SPAS, 128, "[WEAPONBOX]: Found by {FF0000}%s{FFFFFF} || it contained a{FF0000} SPAS-12!", playername(i));
- GivePlayerWeapon(i,27,999999);
- SendClientMessageToAll(WHITE,SPAS);
- }
- case 3:
- {
- new Shotgun[128];
- format(Shotgun, 128, "[WEAPONBOX]: Found by {FF0000}%s{FFFFFF} || it contained a{FF0000} Pump Action Shotgun!", playername(i));
- GivePlayerWeapon(i,25,999999);
- SendClientMessageToAll(WHITE,Shotgun);
- }
- case 4:
- {
- new MP5[128];
- format(MP5, 128, "[WEAPONBOX]: Found by {FF0000}%s{FFFFFF} || it contained an{FF0000} MP5!", playername(i));
- GivePlayerWeapon(i,28,999999);
- SendClientMessageToAll(WHITE,MP5);
- }
- case 5:
- {
- new TRAP[128];
- format(TRAP, 128, "[WEAPONBOX]: Found by {FF0000}%s{FFFFFF} || it was a trap! the police are now after {FF0000}%s!",playername(i), playername(i));
- SendClientMessageToAll(WHITE,TRAP);
- SetPlayerWantedLevel(i,4);
- }
- case 6:
- {
- new parachute[128];
- format(parachute, 128, "[WEAPONBOX]: Found by {FF0000}%s{FFFFFF} || it contained a{FF0000} Parachute?", playername(i));
- GivePlayerWeapon(i,46,999999);
- SendClientMessageToAll(WHITE,parachute);
- }
- }
- new cash = 3500+random(4500),
- string[128];
- format(string, 128, "{00FF00}You also received {00FF00}$%d! {00FF00}for calling in the Weapon Box to the authorities",cash);
- SendClientMessage(i,WHITE,string);
- GivePlayerMoney(i,cash);
- BoxSpawned = false;
- AdminBox = false;}
- public OnPlayerConnect(playerid)
- {
- isSpawned[playerid] = false;
- SetPlayerVirtualWorld(playerid,0);
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- isSpawned[playerid] = true;
- return 1;
- }
- public OnPlayerRequestClass(playerid)
- {
- isSpawned[playerid] = false;
- return 1;
- }
- command(boxadmin,playerid,params[])
- {if(IsPlayerAdmin(playerid))
- {
- 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");
- return 1;
- }
- SendClientMessage(playerid,RED," You are not an Rcon Administrator!");
- return 1;
- }
- new BoxIO;
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(response)
- {
- switch(dialogid)
- {
- case 42:
- {
- switch(listitem)
- {
- case 0:
- {
- if (BoxIO == 1)
- {
- BoxIO = 0;
- SendClientMessageToAll(RED,"{FF6600}[WEAPONBOX]:{FFFFFF} Weapon box 4.0 By Hoborific has been disabled!");
- return 1;
- }
- else
- {
- BoxIO = 1;
- SendClientMessageToAll(RED,"{00FF00}[WEAPONBOX]:{FFFFFF} Weapon box 4.0 By Hoborific has been Enabled!");
- return 1;
- }
- }
- }
- }
- }
- }
- return 1;
- }
- command(weaponboxcredits,playerid,params[])
- {
- SendClientMessage(playerid,RED,"{FFFFFF}[WEAPONBOX]: {FF6600}WeaponBox 4.0 was created by Adam 'Hoborific' M-S");
- SendClientMessage(playerid,RED,"{FFFFFF}[WEAPONBOX]: {00FF00}Additional Credits to Zeex for Zcmd, Killa[DGZ] for collaborating on the concept, Ryan_Yarrum for being a fuck.");
- SendClientMessage(playerid,RED,"{FFFFFF}[WEAPONBOX]: {FF00CC}if you feel I have forgotten you, contact me via SA-MP forums, My username is 'Hoborific' ");
- return 1;
- }
- command(weaponboxinfo,playerid,params[])
- {
- SendClientMessage(playerid,RED,"{FFFFFF}[WEAPONBOX]: {FF6600}WeaponBox 4.0 was created by Adam 'Hoborific' M-S");
- SendClientMessage(playerid,RED,"{FFFFFF}[WEAPONBOX]: {00FF00}Additional Credits to Zeex for Zcmd, Killa[DGZ] for collaborating on the concept, Ryan_Yarrum for being a fuck.");
- SendClientMessage(playerid,RED,"{FFFFFF}[WEAPONBOX]: {FF00CC}if you feel I have forgotten you, contact me via SA-MP forums, My username is 'Hoborific' ");
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement