Class Selection Camera
#1

Hello, Ive got a little problem regarding my class selection

my code
pawn Code:
SetPlayerPos(playerid,1481.1670,-1767.8672,18.7958);
SetPlayerFacingAngle(playerid,0.0816);
InterpolateCameraPos(playerid, 1467.488403, -1620.849975, 43.885395, 1481.209350, -1758.466552, 19.101547, 8000);
InterpolateCameraLookAt(playerid, 1468.074707, -1625.690917, 42.779933, 1481.169799, -1763.463745, 18.939575, 8000);
The problem is, whenever i change my skin(click the next arrow) in the class selection, my camera movement starts from the start again, i want to to be at the same spot and only the skin to change when we click the arrow.

Thanks in advance.
Reply
#2

why not put that camera movement stuff in side an if statement?

for example, the player connects to your server, you set some var "firstrun = 1" after your camera stuff (or use some already existing var temporary for just that purpose which is more resource friendly)

and once disconnected or spawned, you set it to 0

should look like

PHP Code:
if(firstrun[playerid] == 1)
{
InterpolateCameraPos(playerid1467.488403, -1620.84997543.8853951481.209350, -1758.46655219.1015478000);
InterpolateCameraLookAt(playerid1468.074707, -1625.69091742.7799331481.169799, -1763.46374518.9395758000);

ya, well, something like that maybe
you mainly just need 2 make sure that these camera movements take place just once
Reply
#3

^ ye, i dont know how to make the camera move once only.
Reply
#4

PHP Code:
new firstrun[MAX_PLAYERS];//some global var
public OnPlayerConnect(playerid)
{
//............
    
firstrun[playerid] = 1;
//............
    
return 1;
}
public 
OnPlayerRequestClass(playeridclassid)
{
//............
    
if(firstrun[playerid])
    {
        
//do your camera stuff here
        
firstrun[playerid] = 0;
    }
//............
    
return 1;

and when some1 want to change his class, you just set firstrun to 1 for that playerid
but thats just a workaround though... you could also do something else but i can't remember, sorry
i paused samp 'n scripting for like 6 months i remember most of the stuff but not everything :/
Reply
#5

It Worked!, thanks

+rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)