SA-MP Forums

SA-MP Forums (
-   Help Archive (
-   -   Set a players camera inside them? (

dowster 11/08/2011 06:03 AM

Set a players camera inside them?
im trying to set a players camera so they don't see themselves, maybe a little infront of them but im doing it like
pawn Code:
public OnPlayerUpdate(playerid)
    new Float:x, Float:y, Float:z; /*, Float:cx, Float:cy, Float:cz*/
    GetPlayerPos(playerid, x, y, z);
    SetPlayerCameraPos(playerid, x, y, z);
    //GetPlayerCameraFrontVector(playerid, cx, cy, cz);
    //SetPlayerCameraLookAt(playerid, cx, cy, cz);
    return 1;
and it is not changing anything at all, will i need to add values to the x, y and z or what?

linuxthefish 11/08/2011 06:28 AM

Re: Set a players camera inside them?
Try some different way of setting the camera, i'm not sure you could calculate it with the player postions somewhere. OnPlayerRequestClass might work.

sorry if i don't make sense :D

Scenario 11/08/2011 06:32 AM

Re: Set a players camera inside them?
Sure, one command:

pawn Code:

That's a joke. You could use this function and perhaps reverse the coordinates:

pawn Code:
stock SetPlayerCameraInFrontOfPlayer(playerid, Float:distance, Float:heightoffset) // iPLEOMAX
    new Float:P[3];
    GetPlayerPos(playerid, P[0], P[1], P[2]);
    SetPlayerCameraLookAt(playerid, P[0], P[1], P[2]);
    GetXYInFrontOfPlayer(playerid, P[0], P[1], distance);
    SetPlayerCameraPos(playerid, P[0], P[1], P[2]+heightoffset);

stock GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{                                                 // Created by ******
    new Float:a;
    GetPlayerPos(playerid, x, y, a);
    GetPlayerFacingAngle(playerid, a);
    if (GetPlayerVehicleID(playerid)) { GetVehicleZAngle(GetPlayerVehicleID(playerid), a); }
    x += (distance * floatsin(-a, degrees));
    y += (distance * floatcos(-a, degrees));

dowster 11/08/2011 06:36 AM

Re: Set a players camera inside them?
I'll try adapting that code RealCop228, and if it doesn't work ill try the first code you gave xD. also, when i used the SetPlayerCameraLookAt, it wouldn't let me look around with the mouse, possibly because it was updating so much.

and @linuxthefish, I get what you mean, but this whole game mode i don't want the user to even see the player skin, kind of like first person.

This is going to end up being like a flying camera, god like thing, so i need to be able to move the camera to look. all the player movements will be server sided.

All times are GMT. The time now is 09:41 AM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.