Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //-------------------------------------------------
- //
- // This filter script allows you to have weapon drops after death
- // Uses Dynamic pickups from Incognito's Streamer
- //
- // Bomber07
- // Incognito for Streamer Plugin
- //
- //-------------------------------------------------
- #include <a_samp> //SAMP Team
- #include <streamer> //Incognito
- //-------------------------------------------------
- #define MAX_DROPS 1000//this is the maximum amount of drops our server can have, can be extended to whatever value you want
- //These are just defination of pickup models, just for ease
- #define PICKUP_MODEL_ARMOR 1242
- #define PICKUP_MODEL_HEALTH 1240
- #define PICKUP_MODEL_CASH 1274
- #define PICKUP_MODEL_CASHBAG 1550
- enum StaticPickupEnum//enum
- {
- E_model,
- E_ammount,
- E_pickupid,
- E_timer
- }
- new gStaticPickup[MAX_DROPS][StaticPickupEnum];//all the static pickup data will be saved here
- //------------------------------------------------
- public OnFilterScriptInit()
- {
- //we must reseting all the data of array before doing anything, otherwise noting will work according to the system!
- for(new i = 0; i < MAX_DROPS; i++)
- {
- gStaticPickup[i][E_model] = -1;
- gStaticPickup[i][E_ammount] = -1;
- gStaticPickup[i][E_pickupid] = -1;
- }
- print("\n--------------------------------------");
- print(" Drop Filterscript by Bomber07");
- print(" Loaded");
- print("--------------------------------------\n");
- return 1;
- }
- //------------------------------------------------
- public OnFilterScriptExit()
- {
- for(new i = 0; i < MAX_DROPS; i++)//destroy after this FS is unloaded
- {
- DestroyStaticPickup(i);
- }
- return 1;
- }
- //------------------------------------------------
- CreateStaticPickup(Float:x, Float:y, Float:z, model, ammount, interior = -1, virtualworld = -1)
- {
- for(new i = 0; i < MAX_DROPS; i++)
- {
- if(gStaticPickup[i][E_model] == -1)
- {
- gStaticPickup[i][E_model] = model;
- gStaticPickup[i][E_ammount] = ammount;
- gStaticPickup[i][E_pickupid] = CreateDynamicPickup(model, 1, x, y, z, virtualworld, interior);
- gStaticPickup[i][E_timer] = SetTimerEx("OnAutoPickupDestroy", 13000, true, "i", i);
- return i;//return the static pickup id
- }
- }
- return -1;//will return -1 if no static pickup was created
- }
- //------------------------------------------------
- //destroy the pickup and reset the array index
- DestroyStaticPickup(pickupid)
- {
- DestroyDynamicPickup(gStaticPickup[pickupid][E_pickupid]);
- gStaticPickup[pickupid][E_pickupid] = -1;
- gStaticPickup[pickupid][E_model] = -1;
- gStaticPickup[pickupid][E_ammount] = -1;
- return true;
- }
- //------------------------------------------------
- stock IsValidStaticPickup(pickupid)
- {
- if(gStaticPickup[pickupid][E_model] == -1) return false;
- return true;
- }
- //------------------------------------------------
- forward OnAutoPickupDestroy(pickupid);
- public OnAutoPickupDestroy(pickupid)
- {
- return DestroyStaticPickup(pickupid);
- }
- //------------------------------------------------
- public OnPlayerPickUpDynamicPickup(playerid, pickupid)
- {
- for(new i = 0; i < MAX_DROPS; i++)
- {
- if(pickupid == gStaticPickup[i][E_pickupid])
- {
- switch(gStaticPickup[i][E_model])
- {
- case 331,333..341,321..326,342..355,372,356..371: GivePlayerWeapon(playerid, GetModelWeaponID(gStaticPickup[i][E_model]), gStaticPickup[i][E_ammount]);
- }
- DestroyStaticPickup(i);
- }
- }
- return 1;
- }
- //------------------------------------------------
- GetModelWeaponID(weaponid)//this gives you the weapon id of the model specified; if its incorrect, then simply returns -1;
- {
- switch(weaponid)
- {
- case 331: return 1;
- case 333: return 2;
- case 334: return 3;
- case 335: return 4;
- case 336: return 5;
- case 337: return 6;
- case 338: return 7;
- case 339: return 8;
- case 341: return 9;
- case 321: return 10;
- case 322: return 11;
- case 323: return 12;
- case 324: return 13;
- case 325: return 14;
- case 326: return 15;
- case 342: return 16;
- case 343: return 17;
- case 344: return 18;
- case 346: return 22;
- case 347: return 23;
- case 348: return 24;
- case 349: return 25;
- case 350: return 26;
- case 351: return 27;
- case 352: return 28;
- case 353: return 29;
- case 355: return 30;
- case 356: return 31;
- case 372: return 32;
- case 357: return 33;
- case 358: return 34;
- case 359: return 35;
- case 360: return 36;
- case 361: return 37;
- case 362: return 38;
- case 363: return 39;
- case 364: return 40;
- case 365: return 41;
- case 366: return 42;
- case 367: return 43;
- case 368: return 44;
- case 369: return 45;
- case 371: return 46;
- }
- return -1;
- }
- //------------------------------------------------
- GetWeaponModelID(weaponid)//this return model id from weapon id, returns -1 if incorrect
- {
- switch(weaponid)
- {
- case 1: return 331;
- case 2: return 333;
- case 3: return 334;
- case 4: return 335;
- case 5: return 336;
- case 6: return 337;
- case 7: return 338;
- case 8: return 339;
- case 9: return 341;
- case 10: return 321;
- case 11: return 322;
- case 12: return 323;
- case 13: return 324;
- case 14: return 325;
- case 15: return 326;
- case 16: return 342;
- case 17: return 343;
- case 18: return 344;
- case 22: return 346;
- case 23: return 347;
- case 24: return 348;
- case 25: return 349;
- case 26: return 350;
- case 27: return 351;
- case 28: return 352;
- case 29: return 353;
- case 30: return 355;
- case 31: return 356;
- case 32: return 372;
- case 33: return 357;
- case 34: return 358;
- case 35: return 359;
- case 36: return 360;
- case 37: return 361;
- case 38: return 362;
- case 39: return 363;
- case 40: return 364;
- case 41: return 365;
- case 42: return 366;
- case 43: return 367;
- case 44: return 368;
- case 45: return 369;
- case 46: return 371;
- }
- return -1;
- }
- //------------------------------------------------
- public OnPlayerDeath(playerid, killerid, reason)
- {
- new weapon, ammo;
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- for(new i = 0; i < 13; i++)//drop all player weapons
- {
- GetPlayerWeaponData(playerid, i, weapon, ammo);
- switch(weapon)
- {
- case 1..37:
- {
- if(weapon != 0 && ammo != 0) CreateStaticPickup(x + random(4), y, z, GetWeaponModelID(weapon), ammo, GetPlayerInterior(playerid), GetPlayerVirtualWorld(playerid));
- }
- }
- }
- return 1;
- }
- //------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement