Hey. In my mod there is a system which creates shop actors if a player goes inside, and destroys them when everybody went out.
Or at least that's the goal. Creating the actor works fine, as the mod detects if the actor is already created and doesnt spawn it again, etc.
But if anybody leaves the shop and my custom function gets called, the shop actor gets deleted immediately, no matter if someone else got the actor streamed in.
My code:
I know i messed up something with the code
Or at least that's the goal. Creating the actor works fine, as the mod detects if the actor is already created and doesnt spawn it again, etc.
But if anybody leaves the shop and my custom function gets called, the shop actor gets deleted immediately, no matter if someone else got the actor streamed in.
My code:
Code:
DestroyShopActorIfUnstreamed(virtualworldid)
{
? ? if (!IsValidDynamicActor(shopactor[virtualworldid])) return 1;
for(new i = 0; i < MAX_PLAYERS 1; i)
? ? {
? ? ? ? if (IsDynamicActorStreamedIn(shopactor[virtualworldid], i))
? ? ? ? {
? ? ? ? ? ? print("streamed");
? ? ? ? ? ?break;
? ? ? ? }
? ? printf("shopactor %i deleted", virtualworldid);
? ? DestroyDynamicActor(shopactor[virtualworldid]);
? ? }
return 1;
}
I know i messed up something with the code