SA-MP Forums Archive
How to make a command that lets someone blowup a building - 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: How to make a command that lets someone blowup a building (/showthread.php?tid=349334)



How to make a command that lets someone blowup a building - stormchaser206 - 08.06.2012

I am making a CnR gamemode, and i need to know how to make a building "fall" to the ground.
The command is /blowup.

I really need help.

Thanks.


Re: How to make a command that lets someone blowup a building - sanrock - 08.06.2012

You can't make buildings fall to ground though if it GTA SA buildings.


Re: How to make a command that lets someone blowup a building - stormchaser206 - 08.06.2012

No, i know you can use rotation to make it fall downwards... But i just dont know how to.


AW: How to make a command that lets someone blowup a building - Nero_3D - 08.06.2012

Use RemoveBuildingForPlayer and remove the object and readd it afterwards
Now use SetObjectRot and SetObjectPos to blow it up within a timer which gets called by your command


Re: AW: How to make a command that lets someone blowup a building - stormchaser206 - 08.06.2012

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
Use RemoveBuildingForPlayer and remove the object and readd it afterwards
Now use SetObjectRot and SetObjectPos to blow it up within a timer which gets called by your command
I dont understand it that much (sorry), can you please explain a little more?


AW: How to make a command that lets someone blowup a building - Nero_3D - 08.06.2012

Also first use RemoveBuildingForPlayer to remove the original gta-sa object because we cant move or rotate it
Afterwards re add the object and save the objectid into a variable
Now you can move or rotate it with the function SetObjectPos and SetObjectRot
To let the "fall" look smooth you should use a timer which calls SetObjectPos and SetObjectRot repeatedly
This timer you start with your command


Re: How to make a command that lets someone blowup a building - [KHK]Khalid - 08.06.2012

How about creating a few HUGE explosions (https://sampwiki.blast.hk/wiki/CreateExplosion) at some parts of the building when someone types the command /blowup, then set a timer which remove that building (https://sampwiki.blast.hk/wiki/RemoveBuildingForPlayer(I can help ya if ya don't know how to remove it for all players)) a few seconds after the explosion. If you could do a merged script using my method ^ and Nero_3D's one it will be epic.


Re: How to make a command that lets someone blowup a building - stormchaser206 - 08.06.2012

How do you do it for all players?
And does set object rotation like "move" it to that rotation. And i mean like: it doesnt just dissapear and re-appear at the position you set?


Re: How to make a command that lets someone blowup a building - [KHK]Khalid - 08.06.2012

Quote:
Originally Posted by stormchaser206
Посмотреть сообщение
How do you do it for all players?
pawn Код:
for(new p = 0; p < MAX_PLAYERS; p++)
{
    if(IsPlayerConnected(p))
    {
        RemoveBuildingForPlayer(p, modelid, fX, fY, fZ, fRadius);
    }
}



Re: How to make a command that lets someone blowup a building - stormchaser206 - 10.06.2012

Bump - And would the rotation params of MoveObject work?