SA-MP Forums Archive
Actor disapperars. - 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: Actor disapperars. (/showthread.php?tid=665515)



Actor disapperars. - darkwing - 07.04.2019

I am making a pet system by using actors. When I create a actor it works but when I restart the server, actor doesn't show. Just actor's text is showing. The codes that I am using to create a actor:
Code:
PetData[i][petActor] = CreateActor(PetData[i][petSkin], PetData[i][petPos][0], PetData[i][petPos][1], PetData[i][petPos][2], PetData[i][petPos][3]);
SetActorVirtualWorld(PetData[i][petActor], PetData[i][petExteriorVW]);



Re: Actor disapperars. - GeorgeLimit - 07.04.2019

put at gamemodeinit


Re: Actor disapperars. - darkwing - 07.04.2019

Actor is showing before, but after it disappears.


Re: Actor disapperars. - darkwing - 07.04.2019

Code:
Pet_Refresh(petid)
{
	if (petid != -1 && PetData[petid][petExists])
	{
		if (IsValidDynamic3DTextLabel(PetData[petid][petText3D]))
		    DestroyDynamic3DTextLabel(PetData[petid][petText3D]);
		    
		if (IsValidActor(PetData[petid][petActor]))
			DestroyActor(PetData[petid][petActor]);

        PetTur_Guncelle(petid);
		new string[1024];
        format(string, sizeof(string), "%s %s (#%d)\n%s\nSaglik: %.4f\nAclik: %.4f", PetData[petid][petAdi], petdurum(petid), petid, PetData[petid][petTurAdi], PetData[petid][petSaglik], PetData[petid][petAclik]);
		PetData[petid][petText3D] = CreateDynamic3DTextLabel(string, 0x33AA33FF, PetData[petid][petPos][0], PetData[petid][petPos][1], PetData[petid][petPos][2], 5.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, PetData[petid][petExteriorVW], PetData[petid][petExterior]);
        PetData[petid][petActor] = CreateActor(PetData[petid][petSkin], PetData[petid][petPos][0], PetData[petid][petPos][1], PetData[petid][petPos][2], PetData[petid][petPos][3]);
        SetActorVirtualWorld(PetData[petid][petActor], PetData[petid][petExteriorVW]);
	}
	return 1;
}
I made pet_save, pet_load and pet_refresh. These are working successfully. Pet_load is at gamemodeinit.