Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <zcmd>
- #define COLOR_RED 0xFF0606AA
- #define DIALOG_NUKE (13000)
- #define DIALOG_YES (13001)
- #define DIALOG_NO (13002)
- #define DIALOG_DELETE (13003)
- enum nbInfo
- {
- bool:SetPosition,
- Float:P[3],
- Missile[2],
- Smoke[12],
- FlyingTimer,
- bool:FlyingVar[3],
- ExplodingTimer,
- SmokeTimer,
- bool:SmokeVar[2],
- SmokeTime
- };
- new
- NuclearBlast[MAX_PLAYERS][nbInfo]
- ;
- forward Flying(playerid);
- forward Exploding(playerid);
- forward Smoking(playerid);
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Nuclear Blast Filterscript by Toreno");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- for(new i; i < MAX_PLAYERS; i++)
- {
- for(new a; a < 2; a++)
- {
- DestroyObject(NuclearBlast[i][Missile][a]);
- }
- for(new a; a < 12; a++)
- {
- DestroyObject(NuclearBlast[i][Smoke][a]);
- }
- KillTimer(NuclearBlast[i][FlyingTimer]);
- KillTimer(NuclearBlast[i][ExplodingTimer]);
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- switch(dialogid)
- {
- case DIALOG_NUKE:
- {
- if(!response)
- {
- return ShowPlayerDialog(playerid, DIALOG_NO, DIALOG_STYLE_MSGBOX, "{FFFFFF}MESSAGE!", "{FF0000}You have canceled sending a nuclear blast.", "Close", "");
- }
- ShowPlayerDialog(playerid, DIALOG_YES, DIALOG_STYLE_MSGBOX, "{FFFFFF}MESSAGE!", "{00FF00}Well done!\r\nPositions are now known, and are ready to be sended.\r\n\r\nIn order to send, type /sendnuclearblast command, or type /delposition command to delete position, and stop it.", "Close", "");
- GetPlayerPos(playerid, NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2]);
- NuclearBlast[playerid][SetPosition] = true;
- }
- }
- return 1;
- }
- public Flying(playerid)
- {
- if(!NuclearBlast[playerid][FlyingVar][1])
- {
- MoveObject(NuclearBlast[playerid][Missile][0], NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2], 50.0);
- MoveObject(NuclearBlast[playerid][Missile][1], NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2], 50.0);
- NuclearBlast[playerid][FlyingVar][0] = false;
- NuclearBlast[playerid][FlyingVar][1] = true;
- }
- new
- Float:GOP[3]
- ;
- GetObjectPos(NuclearBlast[playerid][Missile][0], GOP[0], GOP[1], GOP[2]);
- if(GOP[0] == NuclearBlast[playerid][P][0] && GOP[1] == NuclearBlast[playerid][P][1] && GOP[2] == NuclearBlast[playerid][P][2])
- {
- NuclearBlast[playerid][ExplodingTimer] = SetTimerEx("Exploding", 100, false, "i", playerid);
- KillTimer(NuclearBlast[playerid][FlyingTimer]);
- }
- return 1;
- }
- public Exploding(playerid)
- {
- if(!NuclearBlast[playerid][FlyingVar][0])
- {
- DestroyObject(NuclearBlast[playerid][Missile][0]);
- DestroyObject(NuclearBlast[playerid][Missile][1]);
- NuclearBlast[playerid][FlyingVar][0] = true;
- }
- CreateExplosion(NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2], 6, 50.0);
- CreateExplosion(NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] + 10.0, 6, 50.0);
- CreateExplosion(NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] + 20.0, 6, 50.0);
- CreateExplosion(NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] + 30.0, 6, 50.0);
- CreateExplosion(NuclearBlast[playerid][P][0] + 15.0, NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2], 6, 50.0);
- CreateExplosion(NuclearBlast[playerid][P][0] - 15.0, NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2], 6, 50.0);
- CreateExplosion(NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1] + 15.0, NuclearBlast[playerid][P][2], 6, 50.0);
- CreateExplosion(NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1] - 15.0, NuclearBlast[playerid][P][2], 6, 50.0);
- NuclearBlast[playerid][SmokeVar][0] = false;
- NuclearBlast[playerid][SmokeVar][1] = false;
- NuclearBlast[playerid][SmokeTimer] = SetTimerEx("Smoking", 25, true, "i", playerid);
- return 1;
- }
- public Smoking(playerid)
- {
- if(!NuclearBlast[playerid][SmokeVar][0])
- {
- NuclearBlast[playerid][Smoke][0] = CreateObject(2780, NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] - 2.0, 0.0, 0.0, 0.0);
- NuclearBlast[playerid][Smoke][1] = CreateObject(2780, NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] - 2.0, 0.0, 0.0, 0.0);
- NuclearBlast[playerid][Smoke][2] = CreateObject(2780, NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] - 2.0, 0.0, 0.0, 0.0);
- NuclearBlast[playerid][Smoke][3] = CreateObject(2780, NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] - 2.0, 0.0, 0.0, 0.0);
- NuclearBlast[playerid][Smoke][4] = CreateObject(2780, NuclearBlast[playerid][P][0] + 7.5, NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] - 2.0, 0.0, 0.0, 0.0);
- NuclearBlast[playerid][Smoke][5] = CreateObject(2780, NuclearBlast[playerid][P][0] - 7.5, NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] - 2.0, 0.0, 0.0, 0.0);
- NuclearBlast[playerid][Smoke][6] = CreateObject(2780, NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1] + 7.5, NuclearBlast[playerid][P][2] - 2.0, 0.0, 0.0, 0.0);
- NuclearBlast[playerid][Smoke][7] = CreateObject(2780, NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1] - 7.5, NuclearBlast[playerid][P][2] - 2.0, 0.0, 0.0, 0.0);
- NuclearBlast[playerid][Smoke][8] = CreateObject(2780, NuclearBlast[playerid][P][0] + 15.0, NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] - 2.0, 0.0, 0.0, 0.0);
- NuclearBlast[playerid][Smoke][9] = CreateObject(2780, NuclearBlast[playerid][P][0] - 15.0, NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] - 2.0, 0.0, 0.0, 0.0);
- NuclearBlast[playerid][Smoke][10] = CreateObject(2780, NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1] + 15.0, NuclearBlast[playerid][P][2] - 2.0, 0.0, 0.0, 0.0);
- NuclearBlast[playerid][Smoke][11] = CreateObject(2780, NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1] - 15.0, NuclearBlast[playerid][P][2] - 2.0, 0.0, 0.0, 0.0);
- NuclearBlast[playerid][SmokeVar][0] = true;
- }
- if(!NuclearBlast[playerid][SmokeVar][1])
- {
- MoveObject(NuclearBlast[playerid][Smoke][0], NuclearBlast[playerid][P][0] + 15.0, NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] - 2.0, 2.5);
- MoveObject(NuclearBlast[playerid][Smoke][1], NuclearBlast[playerid][P][0] - 15.0, NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] - 2.0, 2.5);
- MoveObject(NuclearBlast[playerid][Smoke][2], NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1] + 15.0, NuclearBlast[playerid][P][2] - 2.0, 2.5);
- MoveObject(NuclearBlast[playerid][Smoke][3], NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1] - 15.0, NuclearBlast[playerid][P][2] - 2.0, 2.5);
- MoveObject(NuclearBlast[playerid][Smoke][4], NuclearBlast[playerid][P][0] + 17.5, NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] - 2.0, 2.5);
- MoveObject(NuclearBlast[playerid][Smoke][5], NuclearBlast[playerid][P][0] - 17.5, NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] - 2.0, 2.5);
- MoveObject(NuclearBlast[playerid][Smoke][6], NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1] + 17.5, NuclearBlast[playerid][P][2] - 2.0, 2.5);
- MoveObject(NuclearBlast[playerid][Smoke][7], NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1] - 17.5, NuclearBlast[playerid][P][2] - 2.0, 2.5);
- MoveObject(NuclearBlast[playerid][Smoke][8], NuclearBlast[playerid][P][0] + 30.0, NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] - 2.0, 2.5);
- MoveObject(NuclearBlast[playerid][Smoke][9], NuclearBlast[playerid][P][0] - 30.0, NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] - 2.0, 2.5);
- MoveObject(NuclearBlast[playerid][Smoke][10], NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1] + 30.0, NuclearBlast[playerid][P][2] - 2.0, 2.5);
- MoveObject(NuclearBlast[playerid][Smoke][11], NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1] - 30.0, NuclearBlast[playerid][P][2] - 2.0, 2.5);
- NuclearBlast[playerid][SmokeVar][1] = true;
- NuclearBlast[playerid][SmokeTime] = gettime();
- }
- if((gettime() - NuclearBlast[playerid][SmokeTime]) >= 10)
- {
- for(new i; i < 12; i++)
- {
- DestroyObject(NuclearBlast[playerid][Smoke][i]);
- }
- NuclearBlast[playerid][FlyingVar][0] = true;
- NuclearBlast[playerid][FlyingVar][1] = false;
- NuclearBlast[playerid][FlyingVar][2] = false;
- NuclearBlast[playerid][SmokeVar][0] = true;
- NuclearBlast[playerid][SmokeVar][1] = true;
- KillTimer(NuclearBlast[playerid][SmokeTimer]);
- }
- return 1;
- }
- CMD:setposition(playerid, params[])
- {
- #pragma unused params
- if(IsPlayerInAnyVehicle(playerid))
- {
- return SendClientMessage(playerid, COLOR_RED, "Get out of the vehicle, to get this command work properly.");
- }
- ShowPlayerDialog(playerid, DIALOG_NUKE, DIALOG_STYLE_MSGBOX, "{FF0000}WARNING!", "{FFFFFF}Are you sure you want to send a nuclear blast at your current position?", "Yes", "No");
- return 1;
- }
- CMD:delposition(playerid, params[])
- {
- #pragma unused params
- if(!NuclearBlast[playerid][SetPosition])
- {
- return SendClientMessage(playerid, COLOR_RED, "You haven't set a position.");
- }
- ShowPlayerDialog(playerid, DIALOG_DELETE, DIALOG_STYLE_MSGBOX, "{FFFFFF}MESSAGE!", "{FFFF00}You have deleted your position, and stopped the nuclear blast.", "Close", "");
- NuclearBlast[playerid][SetPosition] = false;
- return 1;
- }
- CMD:sendnuclearblast(playerid, params[])
- {
- #pragma unused params
- if(!NuclearBlast[playerid][SetPosition])
- {
- return SendClientMessage(playerid, COLOR_RED, "You haven't set a position.");
- }
- if(NuclearBlast[playerid][FlyingVar][2])
- {
- return SendClientMessage(playerid, COLOR_RED, "You sent a missile already, wait until it blows up.");
- }
- NuclearBlast[playerid][Missile][0] = CreateObject(3786, NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] + 60.0, 0.0, -90.0, 0.0);
- NuclearBlast[playerid][Missile][1] = CreateObject(2780, NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] + 61.0, 0.0, 0.0, 0.0);
- NuclearBlast[playerid][FlyingVar][2] = true;
- NuclearBlast[playerid][FlyingTimer] = SetTimerEx("Flying", 25, true, "i", playerid);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement