Jump to content
  • 0

pomoc Mizení objektů - lagování


Mishak

Dotaz

Ahoj, potřeboval bych poradit. Dělám mód a mám tam jednu věc, a to že příkazem spustíte, že každých 5 sec. zmizne jeden objekt, dohromady jich tam je 36. Jenže pokaždé, kdy má přijít řada na 3. - 5. objekt, hra se začne z ničeho nic neskutečně kousat a musím server vypnout. Nevím čím to je, tak bych potřeboval pomoct, jestli byste nevěděli čím to je. Díky.

#include <a_samp>

forward TimerPlocha();

new cas;
new timer;
new Plocha[36];

main()
{
	print("\n----------------------------------");
	print(" Neco");
	print("----------------------------------\n");
}

public OnGameModeInit()
{
	Plocha[0] = CreateObject(18763, 30.26608, 1532.82898, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[1] =	CreateObject(18763, 45.26330, 1547.82581, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[2] =	CreateObject(18763, 33.26830, 1544.82825, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[3] =	CreateObject(18763, 45.26330, 1532.82776, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[4] =	CreateObject(18763, 33.26834, 1532.82922, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[5] =	CreateObject(18763, 36.27110, 1532.82776, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[6] =	CreateObject(18763, 39.26900, 1532.82776, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[7] =	CreateObject(18763, 42.26090, 1532.82776, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[8] =	CreateObject(18763, 30.26610, 1535.83606, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[9] =	CreateObject(18763, 30.26610, 1538.83691, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[10] = CreateObject(18763, 30.26616, 1541.83398, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[11] = CreateObject(18763, 30.26610, 1544.82825, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[12] = CreateObject(18763, 30.26611, 1547.82581, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[13] = CreateObject(18763, 33.26830, 1547.82581, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[14] = CreateObject(18763, 36.27110, 1547.82581, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[15] = CreateObject(18763, 39.26900, 1547.82581, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[16] = CreateObject(18763, 42.26090, 1547.82581, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[17] = CreateObject(18763, 45.26330, 1544.82825, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[18] = CreateObject(18763, 33.26830, 1538.83691, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[19] = CreateObject(18763, 33.26830, 1541.83398, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[20] = CreateObject(18763, 33.26828, 1535.83813, 510.19473,   0.00000, 0.00000, 0.00000);
	Plocha[21] = CreateObject(18763, 42.26090, 1541.83398, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[22] = CreateObject(18763, 36.27110, 1538.83691, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[23] = CreateObject(18763, 36.27110, 1541.83398, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[24] = CreateObject(18763, 36.27110, 1544.82825, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[25] = CreateObject(18763, 39.26900, 1544.82825, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[26] = CreateObject(18763, 42.26090, 1544.82825, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[27] = CreateObject(18763, 36.27110, 1535.83813, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[28] = CreateObject(18763, 45.26330, 1535.83813, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[29] = CreateObject(18763, 45.26330, 1541.83398, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[30] = CreateObject(18763, 39.26900, 1535.83813, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[31] = CreateObject(18763, 42.26090, 1535.83813, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[32] = CreateObject(18763, 39.26900, 1538.83691, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[33] = CreateObject(18763, 39.26900, 1541.83398, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[34] = CreateObject(18763, 42.26090, 1538.83691, 510.19470,   0.00000, 0.00000, 0.00000);
	Plocha[35] = CreateObject(18763, 45.26330, 1538.83691, 510.19470,   0.00000, 0.00000, 0.00000);
	SetGameModeText("CzechMiniGames v. 0.1");
	AddPlayerClass(23, 33.24038, 1532.82776, 517.19470, 269.1425, 0, 0, 0, 0, 0, 0);
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 33.24038, 1532.82776, 517.19470);
	SetPlayerCameraPos(playerid, 33.24038, 1534.82776, 518.19470);
	SetPlayerCameraLookAt(playerid, 33.24038, 1532.82776, 517.19470);
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/Plocha", cmdtext, true, 10) == 0)
	{
		timer = SetTimer("TimerPlocha",5000,1);
		return 1;
    	}
	return 0;
}

public TimerPlocha()
{
	cas++;
	if(cas > 36) KillTimer(timer);
	Random:
	new Plosina = random(4);
	if(!IsValidObject(Plocha[Plosina]))	goto Random;
	switch(Plosina)
    {
		case 0: DestroyObject(Plocha[0]);
		case 1: DestroyObject(Plocha[1]);
		case 2: DestroyObject(Plocha[2]);
		case 3: DestroyObject(Plocha[3]);
		case 4: DestroyObject(Plocha[4]);
		case 5: DestroyObject(Plocha[5]);
		case 6: DestroyObject(Plocha[6]);
		case 7: DestroyObject(Plocha[7]);
		case 8: DestroyObject(Plocha[8]);
		case 9: DestroyObject(Plocha[9]);
		case 10: DestroyObject(Plocha[10]);
		case 11: DestroyObject(Plocha[11]);
		case 12: DestroyObject(Plocha[12]);
		case 13: DestroyObject(Plocha[13]);
		case 14: DestroyObject(Plocha[14]);
		case 15: DestroyObject(Plocha[15]);
		case 16: DestroyObject(Plocha[16]);
		case 17: DestroyObject(Plocha[17]);
		case 18: DestroyObject(Plocha[18]);
		case 19: DestroyObject(Plocha[19]);
		case 20: DestroyObject(Plocha[20]);
		case 21: DestroyObject(Plocha[21]);
		case 22: DestroyObject(Plocha[22]);
		case 23: DestroyObject(Plocha[23]);
		case 24: DestroyObject(Plocha[24]);
		case 25: DestroyObject(Plocha[25]);
		case 26: DestroyObject(Plocha[26]);
		case 27: DestroyObject(Plocha[27]);
		case 28: DestroyObject(Plocha[28]);
		case 29: DestroyObject(Plocha[29]);
		case 30: DestroyObject(Plocha[30]);
		case 31: DestroyObject(Plocha[31]);
		case 32: DestroyObject(Plocha[32]);
		case 33: DestroyObject(Plocha[33]);
		case 34: DestroyObject(Plocha[34]);
		case 35: DestroyObject(Plocha[35]);
	}
	return 1;
}
Link to comment
Share on other sites

3 odpovědí na tuto otázku

Recommended Posts

  • 0
for(new i;i<sizeof(Plocha);i++) SetTimerEx("ZnicPlochu",5000+random(55000),0,"i",i);
forward ZnicPlochu(i);
public ZnicPlochu(i)
{
	DestroyObject(Plocha[i]);
	return 1;
}

Funguje to tak ze ti to vytvori 36 timeru od 5-55 vterin. tim zajistis ze se to nezacykli a ze za minutu se znic ivsechny objekty.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...