SA-MP Forums Archive
Preventing a player from entering a locked vehicle? - 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: Preventing a player from entering a locked vehicle? (/showthread.php?tid=374240)



Preventing a player from entering a locked vehicle? - Deal-or-die - 02.09.2012

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(Vehicle[playerid][vLocked] == 1)
    {
        SendClientMessage(playerid, COLOR_GREY, "This vehicle seems to be locked.");
        return 1;
    }
Should this prevent the player from entering the vehicle? If not how shall I prevent the player from entering a locked vehicle?


Re: Preventing a player from entering a locked vehicle? - [MM]RoXoR[FS] - 02.09.2012

Quote:
Originally Posted by Deal-or-die
Посмотреть сообщение
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(Vehicle[playerid][vLocked] == 1)
    {
        SendClientMessage(playerid, COLOR_GREY, "This vehicle seems to be locked.");
        return 1;
    }
Should this prevent the player from entering the vehicle? If not how shall I prevent the player from entering a locked vehicle?
pawn Код:
if(Vehicle[playerid][vLocked] == 1)
    {
        new Float:X,Float:Y,Float:Z;
        GetPlayerPos(playerid,X,Y,Z);
        SetPlayerPos(playerid,X,Y,Z);
        SendClientMessage(playerid, COLOR_GREY, "This vehicle seems to be locked.");
        return 1;
    }
Also you can you SetVehicleParamsForPlayer


Re: Preventing a player from entering a locked vehicle? - Deal-or-die - 02.09.2012

Ahh True true... Cheers mate.


Re: Preventing a player from entering a locked vehicle? - XStormiest - 02.09.2012

pawn Код:
stock Removing(playerid)
      {
                 new Float:X,Float:Y,Float:Z;
                 GetPlayerPos(playerid,X,Y,Z);
                 RemovePlayerFromVehicle(playerid);
                 SetPlayerPos(playerid,X,Y,Z+2);
                SendClientMessage(playerid, COLOR_GREY, "This vehicle seems to be locked.");
                return 1;
      }
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(Vehicle[playerid][vLocked] == 1)
    {
         Removing(playerid);
        return 1;
    }



Re: Preventing a player from entering a locked vehicle? - Deal-or-die - 02.09.2012

I don't think I'll use it enough to bother about a stock.