streamer - DestroyDynamicObject
#1

Hello Guys,
I want to destroy objects, what is create with CreateDynamicObject.

Код:
enum ItemSpawns{
	itemid,
	Float:i_x,
	Float:i_y,
	Float:i_z
}

new iInfo[][ItemSpawns] = {
    {19165, -1571.1134, -2731.9644, 47.5438}
};
Код:
OnGameModeInit

for(new i=0; i < sizeof(iInfo); i++)
{
     CreateDynamicObject(iInfo[i][itemid],iInfo[i][i_x],iInfo[i][i_y],iInfo[i][i_z], 0.0, 0.0, 0.0, 0);
}
Код:
for(new i=0; i<sizeof(iInfo); i++)
{
     if(!IsPlayerInRangeOfPoint(playerid, 2, iInfo[i][i_x], iInfo[i][i_y], iInfo[i][i_z]))continue;
     if(GetObjectModel(iInfo[i][itemid] == 19165))
     {
          if(PlayerInfo[playerid][pMap] == 1)
          {
	         SendClientMessage(playerid, Color_Red, "You have already a map!");
          }
          else
         {
                DestroyDynamicObject(iInfo[i][itemid]);
                PlayerInfo[playerid][pMap] = 1;
                GangZoneHideForPlayer(playerid, blackmap);
         }
     }
}
but with this code it doesn't work
Reply
#2

I fixed it. I made

Код:
new obj[2000];
and then
Код:
	for(new i=0; i < sizeof(iInfo); i++)
	{
	    obj[i] = CreateDynamicObject(iInfo[i][itemid],iInfo[i][i_x],iInfo[i][i_y],iInfo[i][i_z], 0.0, 0.0, 0.0, 0);
	}
Код:
if(GetObjectModel(iInfo[i][itemid] == 19165))
 		        {
					if(PlayerInfo[playerid][pMap] == 1)
					{
					    SendClientMessage(playerid, Color_Red, "Du hast bereits eine Karte!");
					}
					else
					{
					    DestroyDynamicObject(obj[i]);
					    PlayerInfo[playerid][pMap] = 1;
					    GangZoneHideForPlayer(playerid, blackmap);
					}
				}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)