map wont disappear
#1

hey guys i have a command /minercrash and it makes to apear some objects but i want to remove them after i use /minerrework

Код HTML:
CMD:minerrework(playerid,params[])
{
	if(gLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_ERROR, "Tu nu esti logat si nu poti sa folosesti aceasta comanda!");
    if(PlayerInfo[playerid][pAdmin] >= 6)
    {
		format(gString, sizeof(gString), "NR Bot: Multumim pompierilor si politistilor pentru salvarea minerilor.");
		SendClientMessageToAll(COLOR_NEWS, gString);
		foreach(new i : Player)
		{
      		MinerCrashSistem[i] = 0;
		    Delete3DTextLabel(minerbox);
	        StopAudioStreamForPlayer(i);
	        DestroyDynamicObject(Miner[0]); DestroyDynamicObject(Miner[1]);
			DestroyDynamicObject(Miner[2]); DestroyDynamicObject(Miner[3]);
			DestroyDynamicObject(Miner[4]); DestroyDynamicObject(Miner[5]);
			DestroyDynamicObject(Miner[6]); DestroyDynamicObject(Miner[7]);
			DestroyDynamicObject(Miner[8]); DestroyDynamicObject(Miner[9]);
			DestroyDynamicObject(Miner[10]);
		}
    }
	return 1;
}
but the map wont disappear

Код HTML:
function CreateMinerCrashObjects()
{
    Miner[0] = CreateDynamicObject(897, -677.68127, -2008.70105, 22.11756,   0.00000, 0.00000, 32.16000);
	Miner[1] = CreateDynamicObject(898, -678.79425, -2010.16492, 26.04198,   0.00000, 0.00000, 3.12000);
	Miner[2] = CreateDynamicObject(896, -671.30634, -2005.63293, 18.56230,   0.00000, 0.00000, 16.26000);
	Miner[3] = CreateDynamicObject(897, -673.96576, -2009.34216, 28.79845,   0.00000, 0.00000, 205.57228);
	Miner[4] = CreateDynamicObject(898, -667.38385, -2006.36475, 20.23739,   0.00000, 0.00000, 3.12000);
	Miner[5] = CreateDynamicObject(897, -668.52734, -2007.67542, 25.84588,   0.00000, 0.00000, 102.53999);
	Miner[6] = CreateDynamicObject(2907, -669.60669, -2000.59509, 23.85830,   0.00000, 0.00000, -51.00000);
	Miner[7] = CreateDynamicObject(2908, -675.76202, -1999.86597, 20.68449,   0.00000, 0.00000, 0.00000);
	Miner[8] = CreateDynamicObject(2908, -670.29608, -2000.82019, 23.81120,   0.00000, 0.00000, -85.98000);
	Miner[9] = CreateDynamicObject(2906, -675.47223, -1999.71179, 23.30220,   0.00000, 0.00000, 41.76000);
	Miner[10] = CreateDynamicObject(2905, -672.59131, -2000.27856, 23.64310,   20.00000, 80.00000, -33.66000);
}
Reply
#2

Don't place it in foreach.

Quote:

Delete3DTextLabel(minerbox);
StopAudioStreamForPlayer(i);
DestroyDynamicObject(Miner[0]); DestroyDynamicObject(Miner[1]);
DestroyDynamicObject(Miner[2]); DestroyDynamicObject(Miner[3]);
DestroyDynamicObject(Miner[4]); DestroyDynamicObject(Miner[5]);
DestroyDynamicObject(Miner[6]); DestroyDynamicObject(Miner[7]);
DestroyDynamicObject(Miner[8]); DestroyDynamicObject(Miner[9]);
DestroyDynamicObject(Miner[10]);

Reply
#3

Quote:
Originally Posted by Rdx
Посмотреть сообщение
Don't place some in a foreach loop.
FTFY

StopAudioStream(i) - Keep that in there
Reply
#4

Put this below CreateMinerCrashObjects();

Код:
function DestroyMinerCrashObjects()
{
    DestroyDynamicObject( Miner[0] );
    DestroyDynamicObject( Miner[1] );
    DestroyDynamicObject( Miner[2] ); 
    DestroyDynamicObject( Miner[3] );
    DestroyDynamicObject( Miner[4] );
    DestroyDynamicObject( Miner[5] );
    DestroyDynamicObject( Miner[6] ); 
    DestroyDynamicObject( Miner[7] ); 
    DestroyDynamicObject( Miner[8] ); 
    DestroyDynamicObject( Miner[9] );
    DestroyDynamicObject( Miner[10] );

    return 1;
}
then where you have put this:

Код:
foreach(new i : Player)
{
	MinerCrashSistem[i] = 0;
    Delete3DTextLabel(minerbox);
    StopAudioStreamForPlayer(i);
    DestroyDynamicObject(Miner[0]); DestroyDynamicObject(Miner[1]);
	DestroyDynamicObject(Miner[2]); DestroyDynamicObject(Miner[3]);
	DestroyDynamicObject(Miner[4]); DestroyDynamicObject(Miner[5]);
	DestroyDynamicObject(Miner[6]); DestroyDynamicObject(Miner[7]);
	DestroyDynamicObject(Miner[8]); DestroyDynamicObject(Miner[9]);
	DestroyDynamicObject(Miner[10]);
}
change it to this:

Код:
foreach(new i : Player)
{
	MinerCrashSistem[i] = 0;
	StopAudioStreamForPlayer(i);
}

Delete3DTextLabel(minerbox);
DestroyMinerCrashObjects();
This should fix your problem.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)