How to destroy objects
#1

Hi,
I tried to destroy objects in this way >
Code:
for(new i = 0;i<MAX_PLAYERS;i++)
	        {
	            RemoveBuildingForPlayer(i,2780, -1763.72510, 780.92908, 174.22932,   0.25);
				RemoveBuildingForPlayer(i,2780, -1752.37158, 780.15802, 174.22932,   0.25);
				RemoveBuildingForPlayer(i,2780, -1744.06750, 779.74738, 174.22932,   0.25);
				RemoveBuildingForPlayer(i,2780, -1766.28955, 764.69904, 168.54120,   0.25);
				RemoveBuildingForPlayer(i,2780, -1743.22437, 764.93964, 168.54120,   0.25);
				RemoveBuildingForPlayer(i,2780, -1766.28955, 764.69904, 168.54120,   0.25);
				RemoveBuildingForPlayer(i,2780, -1743.22437, 764.93964, 168.54120,   0.25);
				RemoveBuildingForPlayer(i,2780, -1774.05896, 774.17719, 168.39337,   0.25);
				RemoveBuildingForPlayer(i,2780, -1774.03223, 784.32123, 168.39337,   0.25);
				RemoveBuildingForPlayer(i,2780, -1774.00366, 794.26978, 168.39337,   0.25);
				RemoveBuildingForPlayer(i,2780, -1774.07361, 805.47406, 168.39337,   0.25);
				RemoveBuildingForPlayer(i,2780, -1766.94690, 795.36481, 166.59729,   0.25);
				RemoveBuildingForPlayer(i,2780, -1767.67834, 789.19318, 166.59729,   0.25);
				RemoveBuildingForPlayer(i,2780, -1767.58838, 782.20294, 166.59729,   0.25);
				RemoveBuildingForPlayer(i,2780, -1742.22107, 795.15344, 166.60779,   0.25);
				RemoveBuildingForPlayer(i,2780, -1742.22778, 789.51678, 166.60779,   0.25);
				RemoveBuildingForPlayer(i,2780, -1742.17041, 782.18506, 166.60779,   0.25);
				RemoveBuildingForPlayer(i,2780, -1734.08972, 806.35828, 168.23134,   0.25);
				RemoveBuildingForPlayer(i,2780, -1733.98816, 796.45825, 168.23134,   0.25);
				RemoveBuildingForPlayer(i,2780, -1734.02966, 785.73511, 168.23134,   0.25);
				RemoveBuildingForPlayer(i,2780, -1734.39221, 773.08496, 168.23134,   0.25);
				RemoveBuildingForPlayer(i,2780, -1755.33472, 803.83698, 166.60779,   0.25);
				RemoveBuildingForPlayer(i,2780, -1746.55688, 801.01849, 174.27007,   0.25);
				RemoveBuildingForPlayer(i,2780, -1752.35779, 801.12927, 174.27007,   0.25);
				RemoveBuildingForPlayer(i,2780, -1748.36548, 789.42651, 166.60779,   0.25);
				RemoveBuildingForPlayer(i,2780, -1761.39917, 789.22473, 166.59729,   0.25);
				RemoveBuildingForPlayer(i,2780, -1766.02844, 815.00385, 167.98318,   0.25);
				RemoveBuildingForPlayer(i,2780, -1753.73547, 814.99573, 167.98318,   0.25);
				RemoveBuildingForPlayer(i,2780, -1744.25513, 815.03125, 167.98318,   0.25);
				RemoveBuildingForPlayer(i,2780, -1748.68921, 795.19330, 166.60779,   0.25);
				RemoveBuildingForPlayer(i,2780, -1761.43872, 795.26221, 166.59729,   0.25);
				RemoveBuildingForPlayer(i,2780, -1761.31079, 782.31293, 166.59729,   0.25);
				RemoveBuildingForPlayer(i,2780, -1748.67859, 782.21063, 166.60779,   0.25);
				RemoveBuildingForPlayer(i,2780, -1753.37720, 794.05072, 174.23012,   0.25);
				RemoveBuildingForPlayer(i,2780, -1753.27991, 787.92670, 174.34773,   0.25);
				RemoveBuildingForPlayer(i,2780, -1755.48560, 768.98016, 166.96951,   0.25);
				Update3DTextLabelText(smoke, 0x2222FFFF, "Press 'Y' to make smoke!");
	        }
but FAILED

How can i destroy these all objects?
Reply
#2

If you want to remove a gta sa game object (not server sided object), you have to put RemoveBuildingForPlayer
under OnPlayerConnect, everytime a player connected to your server, the object will be removed for him.

Ex :

PHP Code:
public OnPlayerConnect(playerid)
{
     
RemoveBuildingForPlayer(playeridmodelidFloat:fXFloat:fYFloat:fZFloat:fRadius)
     return 
1;

You don't have to use loop, if you use it that way

EDIT : Are you making a command to destroy a game object?
Reply
#3

Quote:
Originally Posted by AfiqIqbal
View Post
If you want to remove a gta sa game object (not server sided object), you have to put RemoveBuildingForPlayer
under OnPlayerConnect, everytime a player connected to your server, the object will be removed for him.

Ex :

PHP Code:
public OnPlayerConnect(playerid)
{
     
RemoveBuildingForPlayer(playeridmodelidFloat:fXFloat:fYFloat:fZFloat:fRadius)
     return 
1;

You don't have to use loop, if you use it that way

EDIT : Are you making a command to destroy a game object?
Yea trying to make a command that destroy a game object
Reply
#4

You should make an object system then, Which make each object has got an ID, In addition too, you won't be able to delete a game object by an in game command, must be by a mapping software..
Reply
#5

Add these somewhere in your script
pawn Code:
RemoveObjectsForPlayer(playerid)
{
    RemoveBuildingForPlayer(playerid, 2780, -1763.72510, 780.92908, 174.22932, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1752.37158, 780.15802, 174.22932, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1744.06750, 779.74738, 174.22932, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1766.28955, 764.69904, 168.54120, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1743.22437, 764.93964, 168.54120, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1766.28955, 764.69904, 168.54120, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1743.22437, 764.93964, 168.54120, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1774.05896, 774.17719, 168.39337, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1774.03223, 784.32123, 168.39337, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1774.00366, 794.26978, 168.39337, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1774.07361, 805.47406, 168.39337, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1766.94690, 795.36481, 166.59729, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1767.67834, 789.19318, 166.59729, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1767.58838, 782.20294, 166.59729, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1742.22107, 795.15344, 166.60779, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1742.22778, 789.51678, 166.60779, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1742.17041, 782.18506, 166.60779, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1734.08972, 806.35828, 168.23134, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1733.98816, 796.45825, 168.23134, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1734.02966, 785.73511, 168.23134, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1734.39221, 773.08496, 168.23134, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1755.33472, 803.83698, 166.60779, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1746.55688, 801.01849, 174.27007, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1752.35779, 801.12927, 174.27007, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1748.36548, 789.42651, 166.60779, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1761.39917, 789.22473, 166.59729, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1766.02844, 815.00385, 167.98318, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1753.73547, 814.99573, 167.98318, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1744.25513, 815.03125, 167.98318, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1748.68921, 795.19330, 166.60779, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1761.43872, 795.26221, 166.59729, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1761.31079, 782.31293, 166.59729, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1748.67859, 782.21063, 166.60779, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1753.37720, 794.05072, 174.23012, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1753.27991, 787.92670, 174.34773, 0.25);
    RemoveBuildingForPlayer(playerid, 2780, -1755.48560, 768.98016, 166.96951, 0.25);
}
When you add that you can do something like:

Remove objects when player connects (means it will automatically remove objects for every player)
pawn Code:
public OnPlayerConnect(playerid)
{
    RemoveObjectsForPlayer(playerid);
    return 1;
}
Or create a command that player can use to remove objects for himself
pawn Code:
CMD:removeobjects(playerid)
{
    RemoveObjectsForPlayer(playerid);
    return 1;
}
Reply
#6

Remove "Object" Differs from Remove "Objects"

The person who posted this thread is looking forward to removing the object infront of him in game, Which is kinda impossible, Unless this object is created in game by another command, And this object should have an ID so it can be deleted in game, That's about the CMD.

About removing the objects u posted, Put them Under "OnPlayerConnect" That's all.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)