Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- eBOMB - Bomb system by [Su37]Erich
- */
- #include "a_samp"
- #include "foreach"
- #include "streamer"
- #include "mapandreas"
- /*------------------PERSONALIZAR-------------------------------*/
- #define MAX_PLAYER 39 //Change this for the amount of slots that you have in your server
- #define LOAD_MAPANDREAS //Delete this line if you have already the MapAndreas plugin (This function enable minimal mode)
- #define BOMBS 4 //Change this for the amount of bombs that will be launched pressing the key N
- #define TIME 30 //Change this for the amount of time before you can launch bombs again (seconds)
- new Iterator:Bombs<10000>;
- new O_P = 0;
- new Last_Fire[MAX_PLAYER];
- new Launch_ID[MAX_PLAYER];
- #define FILTERSCRIPT
- public OnFilterScriptInit()
- {
- SetTimer("Count_Objects", 10000, false);
- #if defined LOAD_MAPANDREAS
- MapAndreas_Init(MAP_ANDREAS_MODE_MINIMAL);
- #endif
- print("---------------------------------------------");
- print("eBOMB by Su-37 Erich loaded");
- print("---------------------------------------------");
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(IsPlayerInAnyVehicle(playerid))
- {
- if(newkeys & KEY_NO)
- {
- switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
- {
- case 553, 476:
- {
- if(GetTickCount() - Last_Fire[playerid] < TIME*1000)
- {
- new string[108];
- format(string, sizeof(string), "Wait %d seconds before you can launch bombs again", TIME);
- return SendClientMessage(playerid, 0x00FF11FF, string);
- }
- Last_Fire[playerid] = GetTickCount();
- SetPVarInt(playerid, "Amount", BOMBS);
- Launch_ID[playerid] = SetTimerEx("Drop_Bombs", 400, true, "d", playerid);
- }
- }
- }
- }
- return 1;
- }
- forward Drop_Bombs(playerid);
- public Drop_Bombs(playerid)
- {
- if(GetPVarInt(playerid, "Amount") <= 0)
- return KillTimer(Launch_ID[playerid]);
- SetPVarInt(playerid, "Amount", GetPVarInt(playerid, "Amount") -1);
- new Float:X, Float:Y, Float:Z;
- if(!IsPlayerInAnyVehicle(playerid) || !IsPlayerConnected(playerid))
- return KillTimer(Launch_ID[playerid]);
- GetVehiclePos(GetPlayerVehicleID(playerid), X, Y, Z);
- new id = CreateDynamicObject(3786, X, Y, Z-3.0, 0.0, 0.0, 0.0);
- MapAndreas_FindZ_For2DCoord(X, Y, Z);
- MoveDynamicObject(id, X, Y, Z, 30.0);
- Iter_Add(Bombs, id-O_P);
- return 1;
- }
- public OnDynamicObjectMoved(objectid)
- {
- foreach(new i : Bombs)
- {
- if(objectid == i+O_P)
- {
- new Float:x,Float:y,Float:z;
- GetDynamicObjectPos(i+O_P, x, y, z);
- CreateExplosion(x, y, z, 6, 100.0);
- CreateExplosion(x+4.0, y, z, 6, 100.0);
- CreateExplosion(x, y+4.0, z, 6, 100.0);
- DestroyDynamicObject(i+O_P);
- new next;
- Iter_SafeRemove(Bombs, i, next);
- i = next;
- }
- }
- }
- forward Count_Objects();
- public Count_Objects()
- {
- for(new i = 0; i<500000; i++)
- {
- if(IsValidDynamicObject(i))
- O_P++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment