[Unsolved]help with object destroy
#1

Hi i have a roadblock system which allows a police officer to spawn 5 roadblocks, i have one problem..
Lets say
Paul spawns 5 roadblocks
Johnny spawns 5 roadblocks.
Then Paul removes his roadblocks, but it removes Johnnys..
And then when johnnys are removed, johnny can't remove anything.. ( It only works for the last 5 created roadblocks)
Now i would like some help to create a command to just destroy them all, since i dont know how to fix the other problem.
This is how my /roadunblockall looks like it doesn't work it still doesn't delete Pauls 5 roadblocks.


Код:
	if(strcmp(cmd, "/roadunblockall", true) == 0 || strcmp(cmd, "/rball", true) == 0)
	{
		if(PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] != 1)
		{
			SendClientMessage(playerid, COLOR_GREY, "[Error] Invalid faction");
			return 1;
		}
  	DestroyObject(roadblock5);
  	DestroyObject(roadblock4);
  	DestroyObject(roadblock3);
  	DestroyObject(roadblock2);
  	DestroyObject(roadblock1);
  	RoadBlock5[playerid] -= 1;
  	RoadBlock5[playerid] -= 2;
  	RoadBlock5[playerid] -= 3;
  	RoadBlock5[playerid] -= 4;
  	RoadBlock5[playerid] -= 5;
		SendClientMessage(playerid, COLOR_LSPD, "[Info] Roadblocks removed");
		return 1;
	}
My roadblock line
roadblock5 = CreateObject(950, rbX, rbY, rbZ, 0.0, 0.0, rbA+180);
Remember i have five of these lines just the number "5" is also 4 -3 - 2 - 1

Is there any commands to just DELETE all object ID's 950, i beg you its a huge problem
Reply
#2

If you have created 5 objects (or saved 5 objects into variables, not sure about your code) and Paul and Johnny both of them spawn 5 objects, which is in total 10 objects, what goes wrong?
Reply
#3

They are only able to delete the last 5 with /rrb1-5 i'll show the code
Код:
	if(strcmp(cmd, "/roadunblock2", true) == 0 || strcmp(cmd, "/rrb2", true) == 0)
	{
		if(PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] != 1)
		{
			SendClientMessage(playerid, COLOR_GREY, "[Error] Invalid faction");
			return 1;
		}
		if (RoadBlock2[playerid] == 0)
		{
			SendClientMessage(playerid, COLOR_GREY, "[Error] You have not deployed a roadblock");
			return 1;
		}
  	DestroyObject(roadblock2);
  	RoadBlock2[playerid] -= 1;
		SendClientMessage(playerid, COLOR_LSPD, "[Info] Roadblock #2 removed");
		return 1;
	}
If you need more code, please say then.. Because i need this fixed
Reply
#4

Any help ? : (
Reply
#5

Bump, i still can't make it work
Reply
#6

:P Scripted wrong :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)