Help problem in vehicle passenger command
#1

this is the command it returns no errors but when i try it in-game nothing happens, it should put the player in seat id 2 of any vehicle (specificly the ones that have no passenger seat)

pawn Код:
if(strcmp( cmd, "/getin", true ) == 0 )
{
    new Float:X, Float:Y, Float:Z;
    new pasv;
    pasv = GetVehiclePos(pasv, X, Y, Z );
    IsPlayerInRangeOfPoint(playerid, 5, X, Y, Z);
    PutPlayerInVehicle(playerid, pasv, 1);
    return 1;
}
i just cant figure it out any help is most welcome
Reply
#2

that doesn't work on 0.3d anymore..
You can just players into vehicle seats that players can enter by default
Reply
#3

so if i wish to do anything like this will i have to simulate it with spectating the vehicle and putting a textlabel on the vehicle?
Reply
#4

Yeah you've made an error with defining what vehicle you want.

vehicle id pasv = vehicle id pasv
That won't work xD

Try this
UNTESTED:
pawn Код:
stock IsPlayerInRangeOfVehicle(Float:radius, playerid, vehicleid)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:PX;
        new Float:PY;
        new Float:PZ;
        new Float:X;
        new Float:Y;
        new Float:Z;
        GetPlayerPos(playerid, PX, PY, PZ);
        GetVehiclePos(vehicleid, X, Y, Z);
        new Float:Distance = (X-PX)*(X-PX)+(Y-PY)*(Y-PY)+(Z-PZ)*(Z-PZ);
        if(Distance <= radius  * radius)
        {
            return 1;
        }
    }
    return 0;
}


if(strcmp( cmd, "/getin", true ) == 0 )
{
    new Float:X, Float:Y, Float:Z;
    new pasv = 99999;
    for(new i=0; i<MAX_VEHICLES; i++)
    {
        if(IsPlayerInRangeOfVehicle(3, playerid, i))
        {
            pasv = i;
        }
    }
    if (pasv == 99999) return 1;
    PutPlayerInVehicle(playerid, pasv, 1);
    return 1;
}
Reply
#5

you can try that correct version, although it still won't work I suppose
Reply
#6

Quote:
Originally Posted by Rob_Maate
Посмотреть сообщение
Yeah you've made an error with defining what vehicle you want.

vehicle id pasv = vehicle id pasv
That won't work xD

Try this
UNTESTED:
pawn Код:
stock IsPlayerInRangeOfVehicle(Float:radius, playerid, vehicleid)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:PX;
        new Float:PY;
        new Float:PZ;
        new Float:X;
        new Float:Y;
        new Float:Z;
        GetPlayerPos(playerid, PX, PY, PZ);
        GetVehiclePos(vehicleid, X, Y, Z);
        new Float:Distance = (X-PX)*(X-PX)+(Y-PY)*(Y-PY)+(Z-PZ)*(Z-PZ);
        if(Distance <= radius  * radius)
        {
            return 1;
        }
    }
    return 0;
}


if(strcmp( cmd, "/getin", true ) == 0 )
{
    new Float:X, Float:Y, Float:Z;
    new pasv = 99999;
    for(new i=0; i<MAX_VEHICLES; i++)
    {
        if(IsPlayerInRangeOfVehicle(3, playerid, i))
        {
            pasv = i;
        }
    }
    if (pasv == 99999) return 1;
    PutPlayerInVehicle(playerid, pasv, 1);
    return 1;
}
didnt work
Reply
#7

Quote:
Originally Posted by Sascha
Посмотреть сообщение
you can try that correct version, although it still won't work I suppose
Why?

Check here. There's no information or indication suggesting they've deprecated the command at all.

EDIT:

That stock needs to be placed OUTSIDE of OnPlayerCommandText().
Reply
#8

Quote:
Originally Posted by Rob_Maate
Посмотреть сообщение
That stock needs to be placed OUTSIDE of OnPlayerCommandText().
i did place it outside of it i placed it below OnPlayerCommandText
Reply
#9

And once more:
It is not possible anymore in 0.3d to put players into a seat which they can't enter by default. Just believe me, I know what I am talking about.
Reply
#10

Quote:
Originally Posted by Sascha
Посмотреть сообщение
And once more:
It is not possible anymore in 0.3d to put players into a seat which they can't enter by default. Just believe me, I know what I am talking about.
Yeah i know you do but i was just replying to his post & do you think there will ever be a way to put players into invalid seats released in 0.3d?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)