SA-MP Forums Archive
Need a vehicle lock system that.. - 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: Need a vehicle lock system that.. (/showthread.php?tid=136377)



Need a vehicle lock system that.. - FujiNNN - 24.03.2010

hey yo guys!,

could you help me.. i need a lock system that if player near the vehicle that ISN'T his and he tries to get in by pressing the 'ENTER' or 'F' (standard)

it will just ignore the vehicle and don't even try to get in..

i hope you know what I'm saying.. thank you.


Re: Need a vehicle lock system that.. - Zimon95 - 24.03.2010

In OnPlayerEnterVehicle callback put this:
pawn Код:
if(/*Something...*/) {}
else { //You can't enter the vehicle
new Float:cx, Float:cy, Float:cz;
GetPlayerPos(playerid, cx, cy, cz);
SetPlayerPos(playerid, cx, cy, cz); }



Re: Need a vehicle lock system that.. - Fabio11 - 24.03.2010

Try this

pawn Код:
new Frozen[MAX_PLAYERS];
forward Freeze();

public OnPlayerConnect(playerid)
{
    Frozen[playerid] = 0;
    return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(ispassenger) return 0;

    if(vehicleid == WHATEVER)
    {
        new PlayerName[MAX_PLAYER_NAME] = GetPlayerName(playerid,PlayerName,sizeof(PlayerName));
        if(!strcmp(PlayerName, "YouName", true))
        {
            SetTimer("Freeze",5,false); TogglePlayerControllable(playerid, 0);
            Frozen[playerid] = 1;
        } else return 0;
    }
    return 1;
}

public Freeze()
{
    for(new i; i<MAX_PLAYERS; i++)
    {
      if(Frozen[i] == 1)
      {
        TogglePlayerControllable(i, 1);
        SendClientMessage(i, 0xFFFFFFAA,"  You are not the owner of this vehicle!");
      }
    }
    return 1;
}



Re: Need a vehicle lock system that.. - FujiNNN - 24.03.2010

thank you ill try it now..