SA-MP Forums Archive
How to keep someone in their car - 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 keep someone in their car (/showthread.php?tid=242995)



How to keep someone in their car - Too - 21.03.2011

[PAWN] if (strcmp("/entergarage", cmdtext, true, 10) == 0)
{
SetPlayerPos(playerid, -709.9, 964.1, 581.0;
SendClientMessage(playerid, 0x388e8e, "Welcome to Johns Garage");
return 1;
}
[PAWN]


How can I keep the player in their car when they enter the garage?


Re: How to keep someone in their car - Jefff - 21.03.2011

SetVehiclePos ?


Re: How to keep someone in their car - Stigg - 21.03.2011

Quote:
Originally Posted by Too
Посмотреть сообщение
[PAWN] if (strcmp("/entergarage", cmdtext, true, 10) == 0)
{
SetPlayerPos(playerid, -709.9, 964.1, 581.0;
SendClientMessage(playerid, 0x388e8e, "Welcome to Johns Garage");
return 1;
}
[PAWN]


How can I keep the player in their car when they enter the garage?
Lock vehicle with player still in it ?


Re: How to keep someone in their car - s0nic - 21.03.2011

pawn Код:
if (strcmp("/entergarage", cmdtext, true, 10) == 0)
    {
        if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new tmpcar = GetPlayerVehicleID(playerid);
            SetVehiclePos(tmpcar, -709.9, 964.1, 581.0);
            //SetVehicleZAngle(tmpcar, 0.0); //Uncomment and set if you want to angle the car a specific way
        }
        else
        {
            SetPlayerPos(playerid, -709.9, 964.1, 581.0);
            //SetPlayerFacingAngle(playerid, 0.0); //Uncomment and set if you want to angle the player a specific way
        }
        SendClientMessage(playerid, 0x388e8e, "Welcome to Johns Garage");
        return 1;
    }



Re: How to keep someone in their car - PinkFloydLover - 21.03.2011

You could use a variable, on the command put, InGarage[playerid] = 1;
Under OnPlayerExitVehicle
pawn Код:
if(InGarage[playerid] == 1) return PutPlayerInVehicle
Make sure when you exit the garage you set the variable back to 0.


Re: How to keep someone in their car - [NRP]Blade - 21.03.2011

Код:
if(strcmp("/entergarage", cmdtext, true) == 0)
{
	new veh;
	veh = GetPlayerVehicleID(playerid);
	SetVehiclePos(veh, -709.9, 964.1, 581.0);
	SetPlayerPos(playerid, -709.9, 964.1, 581.0);
	PutPlayerInVehicle(playerid, veh, 0);
        SendClientMessage(playerid, 0x388e8e, "Welcome to Johns Garage");
        TogglePlayerControllable(playerid, 0);
        return 1;
}