SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 20/08/2012, 10:40 AM   #1
_Jake_
High-roller
 
_Jake_'s Avatar
 
Join Date: Apr 2012
Location: Land of Ooo
Posts: 2,255
Reputation: 238
Default Tram make player camera stuck.

Hello,
I'm having problem with Trams.
I notice this problem when i was testing the RC Vehicle Enterable/Exitable Tutorial by Hiddos.
Well in that time i also check about trams.

The problem is
When i exit the tram it stuck the camera.

I create a code OnPlayerStateChange checking if player press f/enter button while in tram the camera will go to behind player's back again.

It didn't work.
__________________
If your topic says "Rep+" I will laugh at it.


Go to my profile
then click Statistics.
Find all threads started by _Jake_ and find my releases to see my other releases

"Some times a man should retrieve his own disk"
- by Finn The Human

Leaving (In-Active) SA-MP soon. I will go back every March up to May.
_Jake_ is offline   Reply With Quote
Old 20/08/2012, 10:44 AM   #2
milanosie
High-roller
 
milanosie's Avatar
 
Join Date: Dec 2011
Location: Amsterdam, Netherlands
Posts: 1,722
Reputation: 358
Default Re: Tram make player camera stuck.

Show us the code please,
__________________
The Chat Topic of the Dutch Board Section has now over 10,000 posts! This record of 10,000 post was set after 1 year, 6 months and 7 days!
milanosie is offline   Reply With Quote
Old 20/08/2012, 10:49 AM   #3
_Jake_
High-roller
 
_Jake_'s Avatar
 
Join Date: Apr 2012
Location: Land of Ooo
Posts: 2,255
Reputation: 238
Default Re: Tram make player camera stuck.

pawn Code:
if(newkeys & 16)
{
    if(IsPlayerInAnyVehicle(playerid) && IsVehicleRCVehicle(GetPlayerVehicleID(playerid)))
    {
        GetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
        SetPlayerPos(playerid, x, y, z);
        return 1;
    }
    for(new v; v < MAX_VEHICLES; v++)
    {
        GetVehiclePos(v, x, y, z);
        if(IsPlayerInRangeOfPoint(playerid, 8, x, y, z) && IsVehicleRCVehicle(v))
        {
            PutPlayerInVehicle(playerid, v, 0);
            return 1;
        }
    }
    if(IsPlayerInAnyVehicle(playerid) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 449)
    {
        GetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
        SetPlayerPos(playerid, x, y, z);
        return 1;
    }
    for(new v; v < MAX_VEHICLES; v++)
    {
        GetVehiclePos(v, x, y, z);
        if(IsPlayerInRangeOfPoint(playerid, 8, x, y, z) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 449)
        {
            PutPlayerInVehicle(playerid, v, 0);
            return 1;
        }
    }
}
if(newkeys & KEY_SECONDARY_ATTACK)
{
    if(IsPlayerInAnyVehicle(playerid) && IsVehicleRCVehicle(GetPlayerVehicleID(playerid)))
    {
        RemovePlayerFromVehicle(playerid);
        return 1;
    }
    if(IsPlayerInAnyVehicle(playerid) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 449)
    {
        RemovePlayerFromVehicle(playerid);
        SetCameraBehindPlayer(playerid);
        return 1;
    }
}
__________________
If your topic says "Rep+" I will laugh at it.


Go to my profile
then click Statistics.
Find all threads started by _Jake_ and find my releases to see my other releases

"Some times a man should retrieve his own disk"
- by Finn The Human

Leaving (In-Active) SA-MP soon. I will go back every March up to May.
_Jake_ is offline   Reply With Quote
Old 20/08/2012, 11:11 AM   #4
AliveBG
Big Clucker
 
AliveBG's Avatar
 
Join Date: Apr 2012
Location: Bulgaria
Posts: 59
Reputation: 11
Default Re: Tram make player camera stuck.

hey bro, test this:
PHP Code:
new lastveh[MAX_PLAYERS]; // as global variable
// OnPlayerStateChange
if(newstate == || newstate == 3lastveh[playerid] = GetVehicleModel(GetPlayerVehicleID(playerid));
if(
newstate == && (oldstate == || oldstate == 3) && lastveh[playerid] == 449SetCameraBehindPlayer(playerid); 
__________________
If I helped you, give me reputation. For give click here

IP: 87.120.157.105:7777

Last edited by AliveBG; 20/08/2012 at 11:28 AM. Reason: Work?
AliveBG is offline   Reply With Quote
Old 20/08/2012, 11:51 AM   #5
_Jake_
High-roller
 
_Jake_'s Avatar
 
Join Date: Apr 2012
Location: Land of Ooo
Posts: 2,255
Reputation: 238
Default Re: Tram make player camera stuck.

Thank you it works.
Now the problem is if i press the key f or enter (to leave tram)
the server keep putting me in tram, i need to /eject (myid) to leave tram..

here is my code

pawn Code:
if(newkeys & KEY_SECONDARY_ATTACK)
{
    if(IsPlayerInAnyVehicle(playerid) && IsVehicleRCVehicle(GetPlayerVehicleID(playerid)))
    {
        RemovePlayerFromVehicle(playerid);
        return 1;
    }
    if(IsPlayerInAnyVehicle(playerid) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 449)
    {
        RemovePlayerFromVehicle(playerid);
        SetCameraBehindPlayer(playerid);
        return 1;
    }
}
__________________
If your topic says "Rep+" I will laugh at it.


Go to my profile
then click Statistics.
Find all threads started by _Jake_ and find my releases to see my other releases

"Some times a man should retrieve his own disk"
- by Finn The Human

Leaving (In-Active) SA-MP soon. I will go back every March up to May.
_Jake_ is offline   Reply With Quote
Old 20/08/2012, 12:32 PM   #6
AliveBG
Big Clucker
 
AliveBG's Avatar
 
Join Date: Apr 2012
Location: Bulgaria
Posts: 59
Reputation: 11
Default Re: Tram make player camera stuck.

PHP Code:
if(newkeys KEY_SECONDARY_ATTACK)
{
    if(
IsPlayerInAnyVehicle(playerid) && IsVehicleRCVehicle(GetPlayerVehicleID(playerid)))
    {
        
RemovePlayerFromVehicle(playerid);
    }
    if(
IsPlayerInAnyVehicle(playerid) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 449)
    {
        
RemovePlayerFromVehicle(playerid);
        
SetCameraBehindPlayer(playerid);
    }

__________________
If I helped you, give me reputation. For give click here

IP: 87.120.157.105:7777
AliveBG is offline   Reply With Quote
Old 20/08/2012, 12:38 PM   #7
_Jake_
High-roller
 
_Jake_'s Avatar
 
Join Date: Apr 2012
Location: Land of Ooo
Posts: 2,255
Reputation: 238
Default Re: Tram make player camera stuck.

Thank you it work.
Rep+
__________________
If your topic says "Rep+" I will laugh at it.


Go to my profile
then click Statistics.
Find all threads started by _Jake_ and find my releases to see my other releases

"Some times a man should retrieve his own disk"
- by Finn The Human

Leaving (In-Active) SA-MP soon. I will go back every March up to May.
_Jake_ is offline   Reply With Quote
Reply

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
Cursor keeps stuck at one place, but the camera works! Jochemd Client Support 8 24/06/2012 11:08 AM
Train/Tram exit camera IstuntmanI Bug Reports 0 01/06/2012 01:51 PM
Moving Camera On Login The Camera On Player Spawn Does Not Go Back. Robert_Crawford Help Archive 5 20/06/2011 12:56 AM
[help] make the camera rotate around a player ғαιιοцт Help Archive 11 24/02/2009 10:24 AM


All times are GMT. The time now is 04:25 PM.


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