Help for Tram
#1

I need some help. When you enter the tram with the command /tramenter, by clicking the button F/ENTER, the camera remains on the tram, but my player exits the tram.
Must be put somewhere SetCameraBehindPlayer.

Note: I don't want DestroyVehicle or respawn vehicle.
Reply
#2

Quote:

Must be put somewhere SetCameraBehindPlayer.

Yes that should work.
Reply
#3

It works, but I do not know how to do it, to put it in pressing F/ENTER
Reply
#4

Try this.
But I didn't test it.
I hope it works!
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
    if(vehicleid == tram) {
        new
            playerState = GetPlayerState(playerid);
        if (playerState == PLAYER_STATE_PASSENGER || playerState == PLAYER_STATE_DRIVER) {
            tram = GetPlayerVehicleID(playerid);
            new
                Float:vehx, Float:vehy, Float:vehz;
            GetVehiclePos(tram, vehx, vehy, vehz);
            SetPlayerPos(playerid, vehx+1, vehy+1, vehz);
        }
    }
    return 1;
}
Reply
#5

no change
again so
Reply
#6

Again? Oh, God!
I don't know about the camera a lot and may be wrong.
I suggest you to respawn the car and I guess the camera will change
Reply
#7

There is a way without respawn tram
Reply
#8

As I read before with Camera
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
    if(vehicleid == tram) {
        new
            playerState = GetPlayerState(playerid);
        if (playerState == PLAYER_STATE_PASSENGER || playerState == PLAYER_STATE_DRIVER) {
            tram = GetPlayerVehicleID(playerid);
            new
                Float:vehx, Float:vehy, Float:vehz;
            GetVehiclePos(tram, vehx, vehy, vehz);
            SetPlayerPos(playerid, vehx+1, vehy+1, vehz);
            SetCameraBehindPlayer(playerid);
        }
    }
    return 1;
}
This is my last. I am out of other ways
Reply
#9

don't work
with this if(newkeys & 16) try?
Reply
#10

pawn Код:
new last_vehicle[MAX_PLAYERS];

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == 2 || newstate == 3) last_vehicle[playerid] = GetVehicleModel(GetPlayerVehicleID(playerid));
    if(newstate == 1 && (oldstate == 2 || oldstate == 3) && last_vehicle[playerid] == 449) SetCameraBehindPlayer(playerid);
    return 1;
}
Un-tested, though should work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)