GetObjectPos, SetPlayerCamerPos

well, I'm here with new problem xD
I got object that I spawn with /uavstart
And when I do /uavcontrol it should set camera on the object, so I look from air, bird perspective, but it doesn't do it :S
pawn Код:
new Float: Pos[4], Float: OPos[4], uavobj, UAVObject = 0, bool: UAVStarted;
YCMD:uavcontrol(playerid, params[], help)
    #pragma unused help
    #pragma unused params
    if(UAVStarted == false) return SendClientMessage(playerid, 0xFF0000FF, "You didn't started UAV!");
    TogglePlayerControllable(playerid, 0);
    GetObjectPos(uavobj, OPos[0], OPos[1], OPos[2]);
    SetPlayerCameraPos(playerid, OPos[0], OPos[1], OPos[2]);
    GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
    SetPlayerCameraLookAt(playerid, OPos[0], OPos[1], OPos[2]);
    SendClientMessage(playerid, 0x10F441AA, "You have started controlling the UAV!");
    return 1;

Set the Z coordinate to a bit more - like + 20 - 25!

pawn Код:
SetPlayerCameraPos(playerid, OPos[0], OPos[1], OPos[2] + (30));
Choose the distance you want.

pawn Код:
TogglePlayerSpectating(playerid, true);

Ok guys, gonna try it latter, thanks

Forum Jump:

Users browsing this thread: 1 Guest(s)