SA-MP Forums Archive
I look for help for PutPlayerInVehicle. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: I look for help for PutPlayerInVehicle. (/showthread.php?tid=297311)



I look for help for PutPlayerInVehicle. - Join7 - 15.11.2011

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


Re: I look for help for PutPlayerInVehicle. - Kostas' - 15.11.2011

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;
}



Re: I look for help for PutPlayerInVehicle. - Elka_Blazer - 15.11.2011

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;
}



Re: I look for help for PutPlayerInVehicle. - Kostas' - 15.11.2011

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


Re: I look for help for PutPlayerInVehicle. - Elka_Blazer - 15.11.2011

Yea srry ....


Re: I look for help for PutPlayerInVehicle. - Join7 - 15.11.2011

As I get off the tram, the camera remains in it


Re: I look for help for PutPlayerInVehicle. - Kostas' - 15.11.2011

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



Re: I look for help for PutPlayerInVehicle. - Join7 - 15.11.2011

Not DestroyVehicle, because this Destroy the tram


Re: I look for help for PutPlayerInVehicle. - MP2 - 15.11.2011

Use SetCameraBehindPlayer.


Re: I look for help for PutPlayerInVehicle. - Join7 - 15.11.2011

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