17.02.2017, 10:09
Quote:
if you meant that if an actor is being spawned?
PHP код:
PHP код:
but if you meant that if an actor is moved, by i.e players, objects, or bullet? PHP код:
NOTE: I don't know if there is somewhat a function like PHP код:
|
PHP код:
public OnActorLoad() {
new rows = cache_num_rows(),
count = 0,
string[30],
Sname[30],
SLib[30],
SAnimName[30];
for(new i=0; i < rows; i++) {
ActorData[i][ValidActor] = 1;
ActorData[i][aID] = cache_get_field_content_int(i,"ID");
ActorData[i][ActorSkin] = cache_get_field_content_int(i,"SkinID");
ActorData[i][aX] = cache_get_field_content_float(i,"X");
ActorData[i][aY] = cache_get_field_content_float(i,"Y");
ActorData[i][aZ] = cache_get_field_content_float(i,"Z");
ActorData[i][aA] = cache_get_field_content_float(i,"A");
ActorData[i][NameColor] = cache_get_field_content_int(i,"namecolor");
cache_get_field_content(i,"anim_lib",SLib);
strcpy(ActorData[i][Actor_AnimLib],SLib,50);
cache_get_field_content(i,"anim_name",SAnimName);
strcpy(ActorData[i][Actor_AnimName],SAnimName,50);
cache_get_field_content(i,"Name",Sname);
strcpy(ActorData[i][aName],Sname,24);
format(string,sizeof(string),"{FFFFFF}%s(%i)",ActorData[i][aName],ActorData[i][aID]);
ActorData[i][ActorText] = CreateDynamic3DTextLabel(string, ActorData[i][NameColor],ActorData[i][aX],ActorData[i][aY],ActorData[i][aZ]+1.05, 10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0);
ActorData[i][ActorPlayer] = CreateActor(ActorData[i][ActorSkin],ActorData[i][aX],ActorData[i][aY],ActorData[i][aZ],ActorData[i][aA]);
count += 1;
ApplyActorAnimation(ActorData[i][ActorPlayer],ActorData[i][Actor_AnimLib],ActorData[i][Actor_AnimName], 4.0, 1, 0, 0, 0, 0);
}
if(count == 0) print("ACTOR SYSTEM: No actors found the in the SQL.");
else printf("ACTOR SYSTEM: Total %i actors loaded.",count);
return true;
}
PHP код:
SetTimer("ActorRespawn", 1000, false);
PHP код:
forward ActorRespawn();
public ActorRespawn()
{
for(new i = 0; i < MAX_ACTORS; i++) {
new Float:ax, Float:ay, Float:az, Float:angle;
GetActorPos(i, ax, ay, az);
GetActorFacingAngle(i, angle);
if(ax != ActorData[i][aX] || ay != ActorData[i][aY])
{
SetActorPos(i, ActorData[i][aX], ActorData[i][aY], ActorData[i][aZ]);
SetActorFacingAngle(i, ActorData[i][aA]);
sql_LoadAllActors();
}
}
}