SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

Thread Tools Display Modes
Old 11/08/2011, 05:03 AM   #1
dowster's Avatar
Join Date: Jun 2010
Location: San Fierro
Posts: 631
Reputation: 69
Default 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?
dowster is offline  
Old 11/08/2011, 05:28 AM   #2
linuxthefish's Avatar
Join Date: Dec 2010
Location: Al-Dunya
Posts: 2,858
Reputation: 690
Default 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
linuxthefish is offline  
Old 11/08/2011, 05:32 AM   #3
Scenario's Avatar
Join Date: Feb 2010
Location: Heaven
Posts: 7,804
Reputation: 701
Default 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));
Scenario is offline  
Old 11/08/2011, 05:36 AM   #4
dowster's Avatar
Join Date: Jun 2010
Location: San Fierro
Posts: 631
Reputation: 69
Default 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.
dowster is offline  

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Get players inside of a vehicle Ivan_Pantovic Help Archive 0 12/02/2011 11:13 PM
Move the players camera xLowrider Help Archive 3 26/03/2010 09:10 AM
How to enable players to go inside the buildings ? ( unless i create checkpoints AlbanianGuy Help Archive 14 07/02/2010 05:12 AM
How to check the ids of players inside the vehicle? Nakash Help Archive 3 22/12/2009 01:50 PM
How to make distance smaller between players camera xwy Help Archive 2 18/12/2009 06:34 PM

All times are GMT. The time now is 02:01 AM.

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