SA-MP Forums Archive
How to make /enter with vehicles. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to make /enter with vehicles. (/showthread.php?tid=278155)



How to make /enter with vehicles. - Rabbayazza - 21.08.2011

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


Re: How to make /enter with vehicles. - 4ir-W4ys - 21.08.2011

Press 'F'.


Re: How to make /enter with vehicles. - Rabbayazza - 21.08.2011

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


Re: How to make /enter with vehicles. - Machida - 21.08.2011

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..


Re: How to make /enter with vehicles. - Rabbayazza - 21.08.2011

How do I check if their in it?


Re: How to make /enter with vehicles. - Machida - 21.08.2011

IsPlayerInVehicle(playerid,vehicleid) ..


Re: How to make /enter with vehicles. - 4ir-W4ys - 21.08.2011

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....


Re: How to make /enter with vehicles. - Machida - 21.08.2011

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


Re: How to make /enter with vehicles. - Rabbayazza - 21.08.2011

I want it to be for all cars..


Re: How to make /enter with vehicles. - 4ir-W4ys - 21.08.2011

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>