SA-MP Forums Archive
Actors drop out of interior? - 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: Actors drop out of interior? (/showthread.php?tid=581198)



Actors drop out of interior? - Metharon - 11.07.2015

Some players report me that the actors from business'es drop out of interiors..

How the hell i fix this ?




Re: Actors drop out of interior? - Vince - 11.07.2015

There's really no straightforward way. This is caused by the player's network and/or computer being too slow. The actors are rendered before the interior is rendered and thus the actors fall down. But since actors are controlled by the individual clients you can't reset them.

One not particularly good solution is to spawn the actors on a timer as the player enters an interior. However that means also destroying the actor when the player leaves the interior. Keep in mind that this will be rather heavy on your server resources if you have a lot of actors and a lot of players entering and exiting interior.


Re: Actors drop out of interior? - liquor - 11.07.2015

Quote:
Originally Posted by Vince
Посмотреть сообщение
he actors are rendered before the interior is rendered and thus the actors fall down. /
If this is true (I don't doubt you, haven't tried scripting actors yet) this could work... If there isn't a way to ToggleActorControllable :P

pawn Код:
public OnActorStreamIn(actorid, forplayerid)
{
    new Float:pos[3];
    GetActorPos(actorid,pos[0],pos[1],pos[2]);
    if(floatcmp(pos[0],actorpos[0]) || floatcmp(pos[1],actorpos[1]) || floatcmp(pos[2],actorpos[2]))
    {
        SetActorPos(actorid,actorpos[0],actorpos[1],actorpos[2]);
        SetActorFacingAngle(actorid,actorpos[3]);
    }
    return 1;
}
Edit and corrected some...