How to make /enter with vehicles.
#1

I want to make an /enter command that makes it so that when you /enter your vehicles goes with you.
Reply
#2

Press 'F'.
Reply
#3

No, when you do /enter in a vehicle, both you and the vehicle are teleported.
Reply
#4

There is SetPlayerPos and also SetVehiclePos ..
Check if the player is in vehicle, If yes, then use SetVehiclePos to teleport, else , use SetPlayerPos to teleport..
Reply
#5

How do I check if their in it?
Reply
#6

IsPlayerInVehicle(playerid,vehicleid) ..
Reply
#7

Quote:
Originally Posted by Machida
View Post
There is SetPlayerPos and also SetVehiclePos ..
Check if the player is in vehicle, If yes, then use SetVehiclePos to teleport, else , use SetPlayerPos to teleport..
pawn Code:
new V;
public OnGameModeInit();
{
    V = CreateVehicle(411, 0.0, 0.0, 0.0, 0.0, 0, 0, 0);
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext)
{
    if(strcmp("/enter", cmdtext, true))
    {
        if(IsPlayerInAnyVehicle(playerid)) return Ban(playerid);
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(playerid, X,Y,Z);
        SetVehiclePos(V, X,Y,Z);
        PutPlayerInVehicle(playerid, V);
        return 1;
    }
    return 0;
}
Think....
EDIT: Thanks i fixed it, If he is in vehicle....
Reply
#8

I thought he wanted to Teleport the car only if the player was in a car...
Anyway i think you're right...
Reply
#9

I want it to be for all cars..
Reply
#10

pawn Code:
public OnPlayerCommandText(playerid, cmdtext)
{
    if(strcmp("/enter", cmdtext, true, 6))
    {
        if(cmdtext[6])return SendClientMessage(playerid, 0xFFFF00, "Usage /enter [Carid]");
        if(IsPlayerInAnyVehicle(playerid)) return Ban(playerid);
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(playerid, X,Y,Z);
        SetVehiclePos(cmdtext[7], X,Y,Z);
        PutPlayerInVehicle(playerid, cmdtext[7]);
        return 1;
    }
    return 0;
}
If it Wont Work Try This:

pawn Code:
public OnPlayerCommandText(playerid, cmdtext)
{
    if(strcmp("/enter", cmdtext, true, 6))
    {
        if(!cmdtext[6])return SendClientMessage(playerid, 0xFFFF00, "Usage /enter [Carid]");
        if(IsPlayerInAnyVehicle(playerid)) return Ban(playerid);
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(playerid, X,Y,Z);
        SetVehiclePos(cmdtext[7], X,Y,Z);
        PutPlayerInVehicle(playerid, cmdtext[7]);
        return 1;
    }
    return 0;
}
Type /enter <Number From 0 - The Number of your vehicles>
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)