View Full Version : GetObjectPos, SetPlayerCamerPos

07/10/2011, 08:31 PM
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

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;

07/10/2011, 08:39 PM
Set the Z coordinate to a bit more - like + 20 - 25!

07/10/2011, 08:41 PM
SetPlayerCameraPos(playerid, OPos[0], OPos[1], OPos[2] + (30));

Choose the distance you want.

07/10/2011, 08:41 PM
TogglePlayerSpectating(playerid, true);

07/10/2011, 09:01 PM
Ok guys, gonna try it latter, thanks :D