[HELP] AttachCameraToObject - Camera Bugs and Crash!
#1

I have the script for my server, is the mode First Person, this work fine, but now simply have started a bug:
The screen is flickering... falshing.

pawn Code:
if (strcmp("/ppessoa", cmdtext, true, 10) == 0)
    {
           if(PrimeiraPessoa[playerid] == 0)
           {
            ObjetoPrimeiraPessoa[playerid] = CreateObject(18685, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);//19300
            AttachObjectToPlayer(ObjetoPrimeiraPessoa[playerid], playerid, 0.0, 0.2, 0.68, 0.0, 0.0, 0.0);
                       //AttachObjectToPlayer(ObjetoPrimeiraPessoa[playerid],playerid, 0.0, 0.12, 0.7, 0.0, 0.0, 0.0);
                       AttachCameraToObject(playerid, ObjetoPrimeiraPessoa[playerid]);
                       GameTextForPlayer(playerid, "~y~primeira pessoa~n~~w~ativado", 5000, 1);
                       PrimeiraPessoa[playerid] = 1;
                       return 1;
           }
           else
           {
                      SetCameraBehindPlayer(playerid);
                      DestroyObject(ObjetoPrimeiraPessoa[playerid]);
                      PrimeiraPessoa[playerid] = 0;
                      GameTextForPlayer(playerid, "~y~primeira pessoa~n~~r~desativado", 5000, 1);
           }
           return 1;
    }
The video not is my, but i used for example of the bug! Help me, please!
[ame]http://www.youtube.com/watch?v=Vz9WPmZM33c[/ame]
Reply
#2

Does the same happens with other skins or weapons?
Reply
#3

Quote:
Originally Posted by Strawhats
View Post
Does the same happens with other skins or weapons?
Yes
Reply
#4

rapid objectmovements can cause this. how are you moving the object? setting its position or moving it? if moving, @ which speed?
i experienced the flashing screen (like at the end) only, the white short flashes are beyound my knowledge o.O
oh, you can reset your camera: simply teleport you to somewhere else, this way the camera gets re-initialized, no need to /q anymore ^^
Reply
#5

Lol, you used my video :$
But yeah that happens sometimes, randomly...

I somehow managed to fix it myself though, don't know how.
Reply
#6

I have teleported, but dont fix...
Reply
#7

Is bug ..

I use this:
pawn Code:
//// TOP OF gm: new gCameraPlayer[MAX_PLAYERS];


//// onplayerconnect -> gCameraPlayer[playerid] = CreateObject(19300, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);

//// onplayerdisconnect -> DestroyObject(gCameraPlayer[playerid]);



//// in setplayerpos
//// SetCameraBehindPlayer(playerid);
//// SetTimerEx("fixCamera", 500, false, "d", playerid);

///  in fixCamera
///  SetCameraBehindPlayer(playerid);
///  AttachObjectToPlayer(gCameraPlayer[playerid], playerid, 0.0, 0.3, 0.75  , 0.0, 0.0, 0.0);

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) {
    if(!IsPlayerInAnyVehicle(playerid)){

        AttachObjectToPlayer(gCameraPlayer[playerid], playerid, 0.0, 0.3, 0.75  , 0.0, 0.0, 0.0);

        AttachCameraToObject(playerid, gCameraPlayer[playerid]);


    }

    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate) {


    if( newstate != PLAYER_STATE_ONFOOT) {
        return SetCameraBehindPlayer(playerid);
    }

    AttachObjectToPlayer(gCameraPlayer[playerid], playerid, 0.0, 0.3, 0.75  , 0.0, 0.0, 0.0);

    AttachCameraToObject(playerid, gCameraPlayer[playerid]);

    return 1;
}
Reply
#8

Valeu bruno... muito estranho... loguei hoje no server e nгo estava dando mais... vamos ver se volta, se voltar eu tento o teu modo... talvez seja bug no proprio samp, sei la!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)