TagSpray-System: DestroyObject
#1

Hey Guys,
I am working on a TagSpray System, which saves the tags in a file and that tags can be oversprayed from another gang.
It works with Objects, which will be destroyed an created during the spraying. But it only happens with the second one.
So, here is my snippet:

Код:
public OnPlayerSpray(playerid)
{
	new keys,updown,leftright;
	GetPlayerKeys(playerid,keys,updown,leftright);
	if (keys == KEY_FIRE)
	{
	  if (PlayerInfo[playerid][pFaction] == 4) // BloodZ
	  {
			for(new i = 0; i < sizeof(DynamicTags); i++)
			{
				if (PlayerToPoint(2.0, playerid,DynamicTags[i][TagX], DynamicTags[i][TagY], DynamicTags[i][TagZ]))
				{
	    			new name[24];
					GetPlayerName(playerid,name,24);
					
  				DynamicTags[i][TagModel] = BLOOD_TAG;
					DynamicTags[i][TagSprayer] = name;
  				DynamicTags[i][TagFaction] = PlayerInfo[playerid][pFaction];
  				
					DestroyStreamObject(DynamicTags[i][tagID]);
					DynamicTags[i][tagID] = CreateStreamObject(BLOOD_TAG, DynamicTags[i][TagX], DynamicTags[i][TagY], DynamicTags[i][TagZ], 0.0, 0.0, DynamicTags[i][TagAngle]+90,500.0);
  				PlayerPlaySound(playerid,1057,0,0,0);
          SaveDynamicTags();
					PlayerActionMessage(playerid,15.0,"sprayt etwas an die Wand");
  				return 1;
				}
			}
		}
		if (PlayerInfo[playerid][pFaction] == 3) // CripZ
	  {
			for(new i = 0; i < sizeof(DynamicTags); i++)
			{
				if (PlayerToPoint(2.0, playerid,DynamicTags[i][TagX], DynamicTags[i][TagY], DynamicTags[i][TagZ]))
				{
	    			new name[24];
					GetPlayerName(playerid,name,24);

  				DynamicTags[i][TagModel] = CRIP_TAG;
					DynamicTags[i][TagSprayer] = name;
  				DynamicTags[i][TagFaction] = PlayerInfo[playerid][pFaction];

					DestroyStreamObject(DynamicTags[i][tagID]);
					DynamicTags[i][tagID] = CreateStreamObject(CRIP_TAG, DynamicTags[i][TagX], DynamicTags[i][TagY], DynamicTags[i][TagZ], 0.0, 0.0, DynamicTags[i][TagAngle]+90,500.0);
  				PlayerPlaySound(playerid,1057,0,0,0);
					SaveDynamicTags();
					PlayerActionMessage(playerid,15.0,"sprayt etwas an die Wand");
  				return 1;
				}
			}
		}
		else
		{
			SendClientMessage(playerid,COLOR_LIGHTRED,"[ERROR:] Du gehцrst zu keiner Gang, die Tags sprayt!");
		}
	}
	return 1;
}
When I am a Grove/Crip an I am spraying, the Ballas/Blood-Tag won't be destroyed. Just covered with the object of the crips.
But when I am a Blood, it works perfect. The Crip-Tag will be destroyed and the Blood Tag created on that position.

Tried it without the MidoStream ... same problem.
Reply
#2

Come on, guys. Here are many pros. Somebody must know a solution.
Reply
#3

More than likely your problem is that you have
Код:
DynamicTags[i][tagID]
defined as both CreateStreamObject's. You can't have something equal 2 different things like that.
Reply
#4

And what can I do? I have no idea how i can make it on another way.
Reply
#5

Name it something different
Reply
#6

How should I name it? It is the same object?

Код:
enum Tags
{
	TagModel,
	Float:TagX,
	Float:TagY,
	Float:TagZ,
	Float:TagAngle,
	TagFaction,
	TagSprayer[MAX_PLAYER_NAME],
	tagID,
};
new DynamicTags[MAX_TAGS][Tags];
Reply
#7

No idea what to do, please help ...
Reply
#8

Push .. Problem not solved
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)