SA-MP Forums Archive
CreateActor Bug - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: CreateActor Bug (/showthread.php?tid=657393)



CreateActor Bug - RichKiez - 06.08.2018

Hi everyone, sorry my english is not good.
I'm having trouble with CreateActor.
I am doing a test that I will put an Actor in any position along with Checkpoint as the location of the Actor. When I go to Checkpoint, I will use DestroyActor then CreateActor in the next location. And so I repeated, and I realized that sometimes Actor was not created but only Checkpoint. It just does not appear at all. I want to ask is why?


Re: CreateActor Bug - Dayrion - 06.08.2018

Without any codes that will be difficult to answer you.


Re: CreateActor Bug - RichKiez - 06.08.2018

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
Without any codes that will be difficult to answer you.
This is CODE:

Код:
new pactor[MAX_PLAYERS];
new cpoint[MAX_PLAYERS];

new Float:PosActor[4][4] =
{
	{1464.30004883, -725.00000000, 92.50000000, 290.00000000},
	{634.90002441, -1111.09997559, 46.50000000, 219.99511719},
	{-2697.69995117, -130.50000000, 4.09999990, 270.00000000},
	{-2648.60009766, 166.60000610, 4.09999990, 0.00000000}
}

CMD:setactor(playerid, params[])
{
	if(IsValidActor(pactor[playerid])) DestroyActor(pactor[playerid]);
	new rand = random(3);
	pactor[playerid] = CreateActor(1, PosActor[rand][0], PosActor[rand][1], PosActor[rand][2], PosActor[rand][3]);
	cpoint[playerid] = 1;
	SetPlayerCheckpoint(playerid, PosActor[rand][0], PosActor[rand][1], PosActor[rand][2], 3.0);
	return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
	if(cpoint[playerid] != 0)
	{
		if(IsValidActor(pactor[playerid])) DestroyActor(pactor[playerid]);
		new rand = random(3);
		pactor[playerid] = CreateActor(1, PosActor[rand][0], PosActor[rand][1], PosActor[rand][2], PosActor[rand][3]);
		cpoint[playerid] = 1;
		SetPlayerCheckpoint(playerid, PosActor[rand][0], PosActor[rand][1], PosActor[rand][2], 3.0);
	}
	return 1;
}



Re: CreateActor Bug - RichKiez - 07.08.2018

Help me , Please


Re: CreateActor Bug - Dayrion - 07.08.2018

Your code seems correct, try to debug it by printing step by step what your code is doing.