SA-MP Forums Archive
(HELP) /v lock(1,2,3) - 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: (HELP) /v lock(1,2,3) (/showthread.php?tid=271692)



(HELP) /v lock(1,2,3) - spaty2 - 25.07.2011

Why when I lock my car, it's locked and after I relog it's opened? when I did not opening it?
pawn Код:
else if(strcmp(x_nr,"lock1",true) == 0)
            {
                new keycar = PlayerInfo[playerid][pPcarkey];
                if(keycar != 999)
                {
                    new locked[256];
                    locked = strtok(cmdtext, idx);
                    if(CarInfo[keycar][cLock] == 1)
                    {
                        for(new i = 0; i < MAX_PLAYERS; i++)
                        {
                            if (IsPlayerConnected(i))
                            {
                                SetVehicleParamsForPlayer(keycar,i,0,0);
                            }
                        }
                        format(string, sizeof(string), "~w~Vehicle~n~~g~Unlocked");
                        GameTextForPlayer(playerid, string, 4000, 3);
                        CarInfo[keycar][cLock] = 0;
                        OnPropUpdate();
                        return 1;
                    }
                    else if(CarInfo[keycar][cLock] == 0)
                    {
                        for(new i = 0; i < MAX_PLAYERS; i++)
                        {
                            if (IsPlayerConnected(i))
                            {
                                SetVehicleParamsForPlayer(keycar,i,0,1);
                            }
                        }
                        format(string, sizeof(string), "~w~Vehicle~n~~r~Locked");
                        GameTextForPlayer(playerid, string, 4000, 3);
                        CarInfo[keycar][cLock] = 1;
                        OnPropUpdate();
                        return 1;
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "  You don't have a vehicle at slot 1");
                    return 1;
                }



Re: (HELP) /v lock(1,2,3) - spaty2 - 25.07.2011

One Shity BUMP


Re: (HELP) /v lock(1,2,3) - Libra_PL - 25.07.2011

I'm not sure (!), but i think the car locks only for streamed in players... When the car streams out and streams in then, the car is opened.

Try to lock the car for player if the car is streamed in (OnVehicleStreamIn), if it works - this will be the anwser.


Re: (HELP) /v lock(1,2,3) - spaty2 - 25.07.2011

I don't have nothing like this..


Re: (HELP) /v lock(1,2,3) - dowster - 25.07.2011

what you need to do is inside of OnVehicleStreamIn you need to relock it, so have it check if the vehicle is locked, then lock it again, if its unlocked just have it skip the locking process.


Re: (HELP) /v lock(1,2,3) - spaty2 - 26.07.2011

OnVehicleStreamIn is not in my script


Re: (HELP) /v lock(1,2,3) - spaty2 - 26.07.2011

Second Bump


Re: (HELP) /v lock(1,2,3) - antonio112 - 26.07.2011

pawn Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}
This is what you need. And now use something like:

pawn Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
        if(CarInfo[vehicleid][cLock] == 1)
        {
              SetVehicleParamsForPlayer(vehicleid,forplayerid,0,1);
        }
    return 1;
}
There's no way you don't have that function.


Re: (HELP) /v lock(1,2,3) - spaty2 - 26.07.2011

I said milion time that i dont have
pawn Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
in my script


Re: (HELP) /v lock(1,2,3) - spaty2 - 26.07.2011

I'll try to add it