Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /***************************************************************
- * *
- * Bomb System *
- * (c) 2012. B-Matt *
- * You may edit this, delete credits etc. *
- * *
- ****************************************************************/
- //----Includes----
- #include <a_samp>
- #include <ZCMD>
- //----News----
- new Bomb[MAX_PLAYERS];
- new TNT[MAX_PLAYERS];
- new CBomb[MAX_VEHICLES];
- new Armed[MAX_PLAYERS]; //Bombs
- new BombO; //bomb object
- new BombT; //bomb timer
- //----Forwards----
- forward detonate(bomb);
- //----SA-MP Callbacks----
- public OnFilterScriptInit()
- {
- print("\n*************************************************");
- print("* Bomb system by: B-Matt *");
- print("*************************************************\n");
- CreateVehicle(445, 1583.6045, -1709.9716, 5.4000, 90, 0, 1, 60);
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(response)
- {
- switch(dialogid)
- {
- case 1:
- {
- switch(listitem)
- {
- case 0://TBOMB
- {
- if(GetPlayerMoney(playerid) < 500) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash (500$).");
- GivePlayerMoney(playerid, -500);
- SendClientMessage(playerid, 0xFFFFFFFF, "You successfully bought Timer bomb!");
- Bomb[playerid] = 1;
- }
- case 1: //TNT
- {
- if(GetPlayerMoney(playerid) < 800) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash (800$).");
- GivePlayerMoney(playerid, -800);
- SendClientMessage(playerid, 0xFFFFFFFF, "You successfully bought TNT!");
- TNT[playerid] = 1;
- }
- case 2: //CBOMB
- {
- if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash (1.000$).");
- GivePlayerMoney(playerid, -1000);
- SendClientMessage(playerid, 0xFFFFFFFF, "You successfully bought Car bomb!");
- CBomb[playerid] = 1;
- }
- }
- }
- }
- }
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- new pState = GetPlayerState(playerid);
- if (pState == PLAYER_STATE_DRIVER)
- {
- if (newkeys & KEY_UP)
- {
- if(Armed[playerid] == 1)
- {
- if (IsPlayerInAnyVehicle(playerid))
- {
- new Float:X, Float:Y, Float:Z;
- new vehicleid = GetPlayerVehicleID(playerid);
- GetVehiclePos(vehicleid, X, Y, Z);
- CreateExplosion(X, Y, Z, 12, 15.0);
- CreateExplosion(X, Y, Z, 10, 15.0);
- Armed[playerid] = 0;
- }
- }
- }
- }
- if (newkeys & KEY_FIRE)
- {
- if(Armed[playerid] == 1)
- {
- new Float:X, Float:Y, Float:Z;
- GetObjectPos(BombO, X, Y, Z);
- CreateExplosion(X, Y, Z, 2, 100.0);
- CreateExplosion(X, Y, Z, 12, 25.0);
- CreateExplosion(X, Y, Z, 10, 30.0);
- DestroyObject(BombO);
- Armed[playerid] = 0;
- }
- }
- return 1;
- }
- //----Custom Callbacks----
- public detonate(bomb)
- {
- new Float:X, Float:Y, Float:Z;
- GetObjectPos(BombO, X, Y, Z);
- CreateExplosion(X, Y, Z, 0, 50.0);
- DestroyObject(BombO);
- KillTimer(BombT);
- return 1;
- }
- //----Commands----
- CMD:buy(playerid, params[])
- {
- if(Bomb[playerid] == 0 || TNT[playerid] == 0 || CBomb[playerid] == 0)
- {
- ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Bomb buy", "Timer bomb\nTNT\nCar Bomb", "Buy", "Select");
- }
- else return SendClientMessage(playerid, 0xE21414FF, "You already have bomb!");
- return 1;
- }
- CMD:plant(playerid, params[])
- {
- if(Bomb[playerid] == 1) //TBOMB
- {
- ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.1, 0, 0, 0, 0, 1000, 1);
- new Float:X, Float:Y, Float:Z;
- GetPlayerPos(playerid, X, Y, Z);
- BombO = CreateObject(1252, X, Y, Z, 0.0, 0.0, 96.0);
- BombT = SetTimer("detonate",5000,false);
- Armed[playerid] = 1;
- Bomb[playerid] = 0;
- }
- if(TNT[playerid] == 1)//TNT
- {
- ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.1, 0, 0, 0, 0, 1000, 1);
- new Float:X, Float:Y, Float:Z;
- GetPlayerPos(playerid, X, Y, Z);
- BombO = CreateObject(1252, X, Y, Z, 0.0, 0.0, 96.0);
- GivePlayerWeapon(playerid, 40, 2);
- Armed[playerid] = 1;
- TNT[playerid] = 0;
- }
- if(IsPlayerInAnyVehicle(playerid)) //CBOMB
- {
- if(CBomb[playerid] == 1)
- {
- SendClientMessage(playerid, 0xFFFFFFFF, "You planted bomb! Get out of there!");
- Armed[playerid] = 1;
- CBomb[playerid] = 0;
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement