SA-MP Forums Archive
/triggerbomb command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /triggerbomb command (/showthread.php?tid=526777)



/triggerbomb command - Lajko1 - 19.07.2014

Hey guys, I started with new command.. for now I have only start of /bomb command:

pawn Код:
if(strcmp(cmd, "/plantbomb", true) == 0 || strcmp(cmd, "/pb", true) == 0)
    {
        new Float:X, Float:Y, Float:Z, bool: in_range;
        for(new a = 1; a < MAX_VEHICLES - 1; a++)
    {
    if (!GetVehiclePos(a, X, Y, Z)) continue; // vehicle does not exist
    if (IsPlayerInRangeOfPoint(playerid, 4.0, X, Y, Z))
    {
        in_range = true;
        break;
    }
    }
        SendClientMessage(playerid, -1, (in_range) ? ("{FF6A22}INFO:{FFFFFF} Bomb planted!") : ("{FF6A22}INFO:{FFFFFF} No vehicles near you to plant bomb."));
        return 1;
    }
How can I make /triggerbomb command that will make explosion at car coordinates that bomb is planted on?

rep+


Re: /triggerbomb command - GeekSiMo - 19.07.2014

This Will Help You :
https://sampwiki.blast.hk/wiki/CreateExplosion
+Rep If I helped You !


Re: /triggerbomb command - Lajko1 - 19.07.2014

Umm yes I checked that already, but two commands I need to save coordinates of vehicles to variable and use it in other command so explosion will be at same coordinates ?


Re: /triggerbomb command - GeekSiMo - 19.07.2014

Yes!!! Directly CreateExplosion X Y Z 10.0 etcc..


Re: /triggerbomb command - Lajko1 - 19.07.2014

pawn Код:
if(strcmp(cmd, "/plantbomb", true) == 0 || strcmp(cmd, "/pb", true) == 0)
    {
        new Float:X, Float:Y, Float:Z, bool: in_range;
        for(new a = 1; a < MAX_VEHICLES - 1; a++)
        {
        if (!GetVehiclePos(a, X, Y, Z)) continue; // vehicle does not exist
        if (IsPlayerInRangeOfPoint(playerid, 4.0, X, Y, Z))
        {
            in_range = true;
            break;
        }
        }
        SendClientMessage(playerid, -1, (in_range) ? ("{FF6A22}INFO:{FFFFFF} Bomb planted!") : ("{FF6A22}INFO:{FFFFFF} No vehicles near you to plant bomb."));
        return 1;
    }
   
    if(strcmp(cmd, "/triggerbomb", true) == 0 || strcmp(cmd, "/tb", true) == 0)
    {
        new Float:X, Float:Y, Float:Z;
        for(new a = 1; a < MAX_VEHICLES - 1; a++)
        {
            GetVehiclePos(a, X, Y, Z);
            CreateExplosion(X, Y, Z, 12, 10.0);
        }
        return 1;
    }
Well I tried this and it's not working.


Re: /triggerbomb command - Stinged - 19.07.2014

pawn Код:
new Float:pbX, Float:pbY, Float:pbZ; // At the top of your gamemode.
Use these.

Also if you want them to be assigned to a player, add MAX_PLAYERS to them.


Re: /triggerbomb command - Lajko1 - 19.07.2014

okay now explosion is at coordinates I wrote /plantbomb but it doesn't move with vehicle? :/

pawn Код:
if(strcmp(cmd, "/plantbomb", true) == 0 || strcmp(cmd, "/pb", true) == 0)
    {
        new bool: in_range;
        for(new a = 1; a < MAX_VEHICLES - 1; a++)
        {
        if (!GetVehiclePos(a, pX, pY, pZ)) continue; // vehicle does not exist
        if (IsPlayerInRangeOfPoint(playerid, 4.0, pX, pY, pZ))
        {
            in_range = true;
            break;
        }
        }
        SendClientMessage(playerid, -1, (in_range) ? ("{FF6A22}INFO:{FFFFFF} Bomb planted!") : ("{FF6A22}INFO:{FFFFFF} No vehicles near you to plant bomb."));
        return 1;
    }
   
    if(strcmp(cmd, "/triggerbomb", true) == 0 || strcmp(cmd, "/tb", true) == 0)
    {
        CreateExplosion(pX, pY, pZ, 12, 10.0);
        return 1;
    }



Re: /triggerbomb command - Lajko1 - 19.07.2014

Sorry but I can't make it work, can I get some more help?


Re: /triggerbomb command - Stinged - 19.07.2014

I've never done this before, but maybe this should help.
https://sampwiki.blast.hk/wiki/AttachObjectToVehicle

Try attaching and then getting the object's position.
NOTE: The object must be created then attached.


Re: /triggerbomb command - Lajko1 - 19.07.2014

Well I wanted to do that but which is best attach object to vehicle editor?