I look for help for PutPlayerInVehicle.
#1

I look for help for PutPlayerInVehicle.
I want a command when use /tramenter, to enter into tram
Код:
AddStaticVehicle(449,1944.9480,-1953.7500,14.2082,270.0000,36,0);
I also want command /tramexit, with which I leave tram
Reply
#2

pawn Код:
new tram;

public OnGameModeInit( )
{
    tram = AddStaticVehicle(449,1944.9480,-1953.7500,14.2082,270.0000,36,0);
    //More
    return 1;
}

//Commands
CMD:tramenter(playerid, params[])
{
    PutPlayerInVehicle(playerid,tram,0);
    return 1;
}
Reply
#3

On the top of your script
new TramCar;

Under OnGameModeInIt ( or OnFilterScriptInIt if its a filterscript )

TramCar = AddStaticVehicle(449,1944.9480,-1953.7500,14.2082,270.0000,36,0);

The commands :

pawn Код:
if(strcmp(cmdtext,"/tramenter",true) == 0)
{
     PutPlayerInVehicle(playerid,TramCar);
     return 1;
}

if(strcmp(cmdtext,"/tramexit",true) == 0)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        if(GetPlayerVehicleID(playerid) == TramCar)
        {
            RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}
Reply
#4

Quote:
Originally Posted by Elka_Blazer
Посмотреть сообщение
On the top of your script
new TramCar;

Under OnGameModeInIt ( or OnFilterScriptInIt if its a filterscript )

TramCar = AddStaticVehicle(449,1944.9480,-1953.7500,14.2082,270.0000,36,0);

The commands :

pawn Код:
if(strcmp(cmdtext,"/tramenter",true) == 0)
{
     PutPlayerInVehicle(playerid,TramCar);
     return 1;
}

if(strcmp(cmdtext,"/tramexit",true) == 0)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        if(GetPlayerVehicleID(playerid) == TramCar)
        {
            RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}
You wrote
pawn Код:
PutPlayerInVehicle(playerid,TramCar);
You didn't add the seatid
Reply
#5

Yea srry ....
Reply
#6

As I get off the tram, the camera remains in it
Reply
#7

Destroy the tram then
pawn Код:
CMD:tramexit(playerid, params[])
{
    if(IsPlayerInAnyVehicle(playerid)) {
        if(GetPlayerVehicleID(playerid) == tram) {
            RemovePlayerFromVehicle(playerid);
            DestroyVehicle(tram);
        }
    }
    return 1;
}
Reply
#8

Not DestroyVehicle, because this Destroy the tram
Reply
#9

Use SetCameraBehindPlayer.
Reply
#10

The aim is to take me off the tram. Like /slap
SetCameraBehindPlayer with this command gives me the camera high, while the tram stops, go to my player
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)