SA-MP Forums Archive
Problem with object - 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: Problem with object (/showthread.php?tid=566090)



Problem with object - X337 - 03.03.2015

I have some problem when i try to make locker in front of players, the object created, but won't show up when players attempted robbery.
Here's the code :
Код:
COMMAND:rob(playerid, params[])
{
	if(GetDistanceToPoint(playerid, 2325.4512, -6.8572, 22.8317) < 2)
	{
		SetPlayerFacingAngle(playerid, 273.2785);
		ClearAnimations(playerid);
		ApplyAnimation(playerid,"ROB_BANK","CAT_Safe_Open", 4.1, 1, 0, 0, 0, 0, 1);
		SetPlayerAttachedObject(playerid, 0, 1550, 1, 0.158482, -0.203833, 0.000000, 167.302505, 79.854949, 342.084838, 1.000000, 1.000000, 1.000000);
		SetTimerEx("startRobbery", 2000, false, "d", playerid);
	}
}
Код:
public startRobbery(playerid)
{
	ClearAnimations(playerid);
	ApplyAnimation(playerid, "ROB_BANK", "CAT_Safe_Rob", 1, 1, 0, 0, 0, 0, 1);
	DestroyDynamicObject(lockerBank);
	lockerBank = CreateDynamicObject(1829, 2326.22119, -6.84190, 22.63459,   0.00000, 0.00000, -90.00000); // The code to make a locker object
	return 1;
}
The object created but it's invisible when the robbery animation running.
Please help me.


Re : Problem with object - streetpeace - 03.03.2015

I don't understand. Are you talking about player's object or CreateDynamicObject ? I can't see an error in your script.


Re: Problem with object - X337 - 03.03.2015

Yeah, the code worked for me, but the object that i created with "CreateDynamicObject" won't show up when the players attempted robbery.


Re: Problem with object - FOTIS6 - 03.03.2015

Try to update the streamer after CreateDynamicObject

Код:
public startRobbery(playerid)
{
	ClearAnimations(playerid);
	ApplyAnimation(playerid, "ROB_BANK", "CAT_Safe_Rob", 1, 1, 0, 0, 0, 0, 1);
	DestroyDynamicObject(lockerBank);
	lockerBank = CreateDynamicObject(1829, 2326.22119, -6.84190, 22.63459,   0.00000, 0.00000, -90.00000);
        Streamer_Update(playerid);
	return 1;
}



Re: Problem with object - AchievementMaster360 - 03.03.2015

So in this

Код:
public startRobbery(playerid)
{
	ClearAnimations(playerid);
	ApplyAnimation(playerid, "ROB_BANK", "CAT_Safe_Rob", 1, 1, 0, 0, 0, 0, 1);
	DestroyDynamicObject(lockerBank); // You delete the object before adding it again
	lockerBank = CreateDynamicObject(1829, 2326.22119, -6.84190, 22.63459,   0.00000, 0.00000, -90.00000); // The code to make a locker object
	return 1;
}
try adding this
Код:
DestroyDynamicObject(lockerBank);
When the robbery is over or when it failed


Re: Problem with object - X337 - 04.03.2015

Quote:
Originally Posted by FOTIS6
Посмотреть сообщение
Код:
Streamer_Update(playerid);
Thanks