SA-MP Forums Archive
(HELP) /v lock - 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 (/showthread.php?tid=271066)



(HELP) /v lock - spaty2 - 22.07.2011

Hey, when I lock my car is locked and logout and login back my car is opened, i dont know why?
Someone know?

You can look on this
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;
                    }



Re: (HELP) /v lock - MoroDan - 22.07.2011

You have to check again the car ( if it's locked or not ), at OnVehicleStreamIn ...


Re: (HELP) /v lock - Sil3nc3 - 22.07.2011

You could also set a vehicle lock timer if you want the car to automatically unlock itself after lets say 30 minutes, 60 minutes, etc.


Re: (HELP) /v lock - spaty2 - 22.07.2011

I don't want, I want them lock for always


Re: (HELP) /v lock - MadeMan - 22.07.2011

pawn Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
    if(CarInfo[vehicleid][cLock] == 1)
    {
        SetVehicleParamsForPlayer(vehicleid,forplayerid,0,1);
    }
    return 1;
}