16.02.2017, 14:17
if you meant that if an actor is being spawned?
you won't need to get the actors position coz it will spawn on your specified location.
but
if you meant that if an actor is moved, by i.e players, objects, or bullet?
This will keep the actor teleported back to it's location every time the timer reaches its interval or when you update each actor on the server. In theory
NOTE:
I don't know if there is somewhat a function like
That respawns the actor at a given time.
PHP код:
//actor variable
new Actor[MAX_ACTOR]; //assuming you have set the MAX_ACTOR to a ideal number
PHP код:
//Place this on gamemodinit
Actor[0] = CreateActor(0, 1605.8220, 1829.0625, 10.5251, 4.3929) //spawns actor CJ infront of Las Venturas Hospital
but
if you meant that if an actor is moved, by i.e players, objects, or bullet?
PHP код:
//Place this somewhere when you try to update the actors, i.e timers, callbacks, etc
new Float:ax, Float:ay, Float:az, Float:angle;
GetActorPos(Actor[0], ax, ay, az);
GetActorFacingAngle(Actor[0], angle);
if(ax != 1605.8220 || ay != 1829.0625) //or you could add Z, which is not ideal since a little movement on the ground changes the actors x and y axis
SetActorPos(actorid, 1605.8220, 1829.0625, 10.5251); //respawns actor CJ infront of Las Venturas Hospital
SetActorFacingAngle(Actor[0], 4.3929);
NOTE:
I don't know if there is somewhat a function like
PHP код:
AddStaticVehicleEx(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, color1, color2, respawn_delay, addsiren=0);