drop bombs
#1

i want to make a FS that drops bombs from plane i want to make it myself.... So please help me by giving hints that how can i do that !!!
Reply
#2

You need to create a timer. Something like this for example:

pawn Код:
// in a /bomb command for example:

if(strcmp("/bomb", cmdtext, true, 5) == 0)
{
    GameTextForAll("~w~the bomb has been ~r~~n~dropped ~n~~w~exploding in ~p~10 sec",5000,3);

    SetTimerEx("Bomb",10000,false,"d",playerid); // bomb timer set for 10sec, will not repeat
   
    return 1;
}

// bottom of script

forward Bomb(playerid);
public Bomb(playerid)
{
    GameTextForAll("~w~the ~r~bomb ~w~has ~r~exploded!",5000,3);
   
    CreateExplosion(x,y,z,type,Float:Radius);
   
    return 1;
}
Reply
#3

Thank You for your help

BUT

i want to drop this bomb from a plane in that case what can i do ?
Reply
#4

You need the plane interior coordinates. If they are in range, the bomb will drop, if not it will return an error message.

When you use the CreateExplosion function, make the coordinates somewhere on the ground or something, since it's falling from a plane, downward.

pawn Код:
// in a /bomb command for example:
if(strcmp("/bomb", cmdtext, true, 5) == 0)
{
    if(IsPlayerInRangeOfPoint(playerid,10,x,y,z)) // plane interior coordinates
    {
        GameTextForAll("~w~the bomb has been ~r~~n~dropped ~n~~w~exploding in ~p~10 sec",5000,3);

        SetTimerEx("Bomb",10000,false,"d",playerid);

        return 1;
    } else return SendClientMessage(playerid,-1,"You Must Be In A Plane To Use This Command.");
}

// bottom of script

forward Bomb(playerid);
public Bomb(playerid)
{
    GameTextForAll("~w~the ~r~bomb ~w~has ~r~exploded!",5000,3);

    CreateExplosion(x,y,z,type,Float:Radius);

    return 1;
}
Reply
#5

yeah that was helpful but i want that when a player in a plane (assume Neavada) presses fire button it drops a bomb(Visible) to ground which explodes when it hit ground.. bombs ammo should be 40-60 and plane can drop 20 bombs constantly and then a delay period of 5 sec. saying that reloading bombs !!

is it is possible or not ?
Reply
#6

Yes it's possible, you would have to use SetPlayerPos a lot to make the bomb drop in mid air.

I'm not too sure how to make it properly though, sorry.
Reply
#7

u use this here is an example using ur script Otto
pawn Код:
// top of script
new bomb;
// in a /bomb command for example:
if(strcmp("/bomb", cmdtext, true, 5) == 0)
{
    if(IsPlayerInRangeOfPoint(playerid,10,x,y,z)) // plane interior coordinates
    {
        new float: x, y, z, a, VID;
        VID = GetPlayerVehicleID(playerid);
        GameTextForAll("~w~the bomb has been ~r~~n~dropped ~n~~w~exploding in ~p~10 sec",5000,3);
        GetVehiclePos(VID, x, y, z);
        GetVehicleZAngle(VID, a);
        Bomb = CreateObject(bombobjectid, x, y, z, RotX, RotY, a);
        MoveObject(Bomb, x, y, z, speed);
        SetTimerEx("Bomb",10000,false,"d",playerid);

        return 1;
    } else return SendClientMessage(playerid,-1,"You Must Be In A Plane To Use This Command.");
}

// bottom of script

forward Bomb(playerid);
public Bomb(playerid)
{
    GameTextForAll("~w~the ~r~bomb ~w~has ~r~exploded!",5000,3);

    CreateExplosion(x,y,z,type,Float:Radius);

    return 1;
}
thats how u get the vehicle rotation position and create the bomb and move it i think lol

Not 100% sure though may not work!
Reply
#8

is that the command that i need to use when i want to drop bombs by just pressing fire button my keyboard
Reply
#9

Quote:
Originally Posted by jiwan
Посмотреть сообщение
is that the command that i need to use when i want to drop bombs by just pressing fire button my keyboard
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_FIRE)
    {
        if(IsPlayerInRangeOfPoint(playerid,10,x,y,z)) // plane interior coordinates
        {
            new float: x, y, z, a, VID;
            VID = GetPlayerVehicleID(playerid);
            GameTextForAll("~w~the bomb has been ~r~~n~dropped ~n~~w~exploding in ~p~10 sec",5000,3);
            GetVehiclePos(VID, x, y, z);
            GetVehicleZAngle(VID, a);
            Bomb = CreateObject(bombobjectid, x, y, z, RotX, RotY, a);
            MoveObject(Bomb, x, y, z, speed);
            SetTimerEx("Bomb",10000,false,"d",playerid);
        } else return SendClientMessage(playerid,-1,"You Must Be In A Plane To Use This Command.");
    }
    return 1;
}
If you want it using KEY_FIRE
Reply
#10

To make the bomb explode when hitting ground, use mapandreas.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)