Switching between actors
#1

PHP код:
/*                ISTORIJU AKTORIAI        */
/*  Pos1, pos2, pos3, angle, cam1, cam2, cam3, skin id, historyType, Score, Money*/
enum aktoriai
{
    
Float:Pos_x,
    
Float:Pos_y,
    
Float:Pos_z,
    
Float:Pos_A,
    
Float:cPos_x,
    
Float:cPos_y,
    
Float:cPos_z
    
skin,
    
hType,
    
Score,
    
Money,
    
name[24]   
};
new 
Aktorius[  ][aktoriai] =
{
    {
46.3535,-257.0631,1.7107,264.0349,     58.7866,-258.4310,1.5781,    6,    0,        15,     1500"VEIKĖJAS NR. 1"},
    {
43.0988,-242.0966,1.6981,266.5415,     52.0630,-242.7368,1.5781,    6,    1,        20,     1200"VEIKĖJAS NR. 2"},
    {
39.6381,-227.6579,1.8262,262.7815,     48.8484,-228.8244,1.5781,    6,    2,        5,         2000"VEIKĖJAS NR. 3"}
};
new 
Text3D:AktoriausLabel[sizeof(Aktorius)],
    
AktoriusID[sizeof(Aktorius)]; 
Then ongamemodeinit()

PHP код:
for(new 0sizeof(Aktorius); x++)
    {
        
AktoriusID[x] = CreateActorAktorius[x][skin], Aktorius[x][Pos_x], Aktorius[x][Pos_y],  Aktorius[x][Pos_z], Aktorius[x][Pos_A]);
        
format(g_szBuffer450"{9090D4}%s{ffffff}\nProfesija: {9090D4}%s{ffffff}\nPatirtis:{9090D4}%i{ffffff}\nTurimi pinigai: {9090D4}%i{ffffff} "EURAS".\n \nNorėdami pasirinkt istoriją spauskite {9090D4}ENTER{ffffff} !"Aktorius[x][name], getActorType(Aktorius[x][hType]),Aktorius[x][Score],Aktorius[x][Money]);
        
AktoriausLabel[x] = Attach3DTextLabelToActor(AktoriusID[x] , g_szBuffer0x008080FF0.00.0, -0.130.010);
        
SetActorVirtualWorld(AktoriusID[x] , 1);
    } 
PHP код:
SendClientMessage(playerid, -1"{8DBA5F}!{ffffff} Istorijas keisti galite su {8DBA5F}Y{ffffff} ir {8DBA5F}N{ffffff} klaviљais !"); // you can switch histories with Y and N keys
        
lookingAtactor[playerid] = 0;
        
SetPlayerCameraPos(playeridAktorius[lookingAtactor[playerid]][cPos_x], Aktorius[lookingAtactor[playerid]][cPos_y], Aktorius[lookingAtactor[playerid]][cPos_z]);
        
SetPlayerCameraLookAt(playeridAktorius[lookingAtactor[playerid]][Pos_x], Aktorius[lookingAtactor[playerid]][Pos_y], Aktorius[lookingAtactor[playerid]][Pos_z]); 
PHP код:
public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if(
player[playerid][pNewbie] == 1)
    {
        if(
PRESSED(KEY_YES))
        {
            new 
next_array;
            if(
lookingAtactor[playerid] >= sizeof(Aktorius)-1next_array 0;
            else 
next_array lookingAtactor[playerid]++;
            
InterpolateCameraPos(playeridAktorius[lookingAtactor[playerid]][cPos_x], Aktorius[lookingAtactor[playerid]][cPos_y], Aktorius[lookingAtactor[playerid]][cPos_z], Aktorius[next_array][cPos_x], Aktorius[next_array][cPos_y], Aktorius[next_array][cPos_z], 3000CAMERA_MOVE);
            
format(g_szBuffer148"ћiūrimo aktoriaus ID: %i "lookingAtactor[playerid]);
            
SendClientMessage(playerid, -1g_szBuffer);
            
lookingAtactor[playerid] = next_array;
        }
        if(
PRESSED(KEY_NO))
        {
            new 
next_array;
            if(
lookingAtactor[playerid] <= 0next_array sizeof(Aktorius)-1;
            else 
next_array lookingAtactor[playerid]--;
            
InterpolateCameraPos(playeridAktorius[lookingAtactor[playerid]][cPos_x], Aktorius[lookingAtactor[playerid]][cPos_y], Aktorius[lookingAtactor[playerid]][cPos_z], Aktorius[next_array][cPos_x], Aktorius[next_array][cPos_y], Aktorius[next_array][cPos_z], 3000CAMERA_MOVE);
            
format(g_szBuffer148"ћiūrimo aktoriaus ID: %i "lookingAtactor[playerid]);
            
SendClientMessage(playerid, -1g_szBuffer);
            
lookingAtactor[playerid] = next_array;
        }
        
format(g_szBuffer148"aktoriaus ID: %i "lookingAtactor[playerid]);
        
SendClientMessage(playerid, -1g_szBuffer);
    }
    return 
1;

And it doesn't work as it should, camera sometimes starts moving not from that actor you are looking at, but from another one to that one you are looking at.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)