SA-MP Forums Archive
Actors disappear - 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 disappear (/showthread.php?tid=650898)



Actors disappear - IndependentGaming - 09.03.2018

Hello, I have been placing actors around the map for some more RP, but sometimes they just disappear out of nowhere and when I restart the server they are back and then gone again. This doesn't happen every time just sometime out of nothing what is the cause of this ?

PHP код:
new    ActorDJ1 = CreateActor(299, 346.0761, -1845.4706, 7.7953, 85.1415);
    
ApplyActorAnimation(ActorDJ1, "SCRATCHING", "scdldlp", 4.0, 1, 0, 0, 0, 0); // /dj 1
    
new ActorDJ2 = CreateActor(45, 346.0746, -1844.1603, 7.7953, 85.8244);
    
ApplyActorAnimation(ActorDJ2, "SCRATCHING", "scdrulp", 4.0, 1, 0, 0, 0, 0); // /dj 4
    
new DancerMale1 = CreateActor(29, 326.8049, -1851.2158, 4.1103, 333.7950); // ActorDanceMale
    
ApplyActorAnimation(DancerMale1, "DANCING", "DAN_Loop_A", 4.0, 1, 0, 0, 0, 0); // /getjiggy 3
    
new DancerFemale1 = CreateActor(12, 327.3703, -1849.5652, 4.1103, 160.8896); // DancerFemale1
    
ApplyActorAnimation(DancerFemale1, "SCRATCHING", "dnce_M_b", 4.0, 1, 0, 0, 0, 0); // /getjiggy 7
    
new DancerMale2 = CreateActor(23, 331.5946, -1849.9648 ,4.1103 ,60.0515); // DancerMale2
    
ApplyActorAnimation(DancerMale2, "DANCING", "dnce_M_d", 4.0, 1, 0, 0, 0, 0); // /getjiggy 10
    
new DancerFemale2 = CreateActor(40, 324.5778, -1842.9836 ,4.1103, 269.0233); // DancerFemale2
    
ApplyActorAnimation(DancerFemale2, "STRIP", "PUN_HOLLER", 4.0, 1, 0, 0, 0, 0); // /cheer 8
    
new Cook1 = CreateActor(46, 305.3727, -1872.3318, 2.6476, 220.5824); // Cook1
    
ApplyActorAnimation(Cook1, "BD_FIRE", "wash_up", 4.0, 1, 0, 0, 0, 0); // /washhands
    
new Seller1 = CreateActor(40, 324.5778, -1842.9836, 4.1103, 269.0233); // DancerFemale2
    
ApplyActorAnimation(Seller1, "BAR", "Barserve_loop", 4.0, 1, 0, 0, 0, 0); // /bar 6
    
new Beachboy = CreateActor(97, 321.0659, -1875.4756, 2.5435, 174.6999); // Beachboy1
    
ApplyActorAnimation(Beachboy, "BEACH", "Lay_Bac_Loop", 4.0, 1, 0, 0, 0, 0); // /sit 2
    
new Beachwomen = CreateActor(140, 322.6432, -1875.6628, 2.5395, 178.0904); // Beachwomen1
     
ApplyActorAnimation(Beachwomen, "BEACH", "bather", 4.0, 1, 0, 0, 0, 0); // /lay 1 



Re: Actors disappear - IndependentGaming - 09.03.2018

Anyone ?


Re: Actors disappear - IndependentGaming - 10.03.2018

Does anyone can help me with this ? They also fall true custom objects


Re: Actors disappear - NaS - 10.03.2018

There's a certain distance where actors are movable (by gravity) but the map collision isn't loaded yet at that position.

Even on the original map they sometimes just fall through the ground and respawn somewhere else or get stuck somewhere. Same for custom objects, depending on stream distance it can be even worse.


What I did is use the streamer plugin for dynamic Actors with lower stream distances (so they stream in from closer distances) and put this code into the callback OnDynamicActorStreamIn:

Код:
new Float:x, Float:y, Float:z;
Streamer_GetFloatData(STREAMER_TYPE_ACTOR, actorid, E_STREAMER_X, x);
Streamer_GetFloatData(STREAMER_TYPE_ACTOR, actorid, E_STREAMER_Y, y);
Streamer_GetFloatData(STREAMER_TYPE_ACTOR, actorid, E_STREAMER_Z, z);

SetDynamicActorPos(actorid, x, y, z);
This will update their position everytime they stream in for someone (their server-side position will not change when falling through the map).
It's not perfect and it can still happen, but it's much less likely as everytime someone gets close they get reset. So even if it happens once, they will be back at their spot later.


Re: Actors disappear - Sew_Sumi - 10.03.2018

24 hour bumps only too.