[Help] Lock problem
#1

If i lock a car it works i cant enter it.. but if i enter another car and lock it i can enter my locked car ? what can be the problem ?
Reply
#2

The car gets un-locked as it gets streamed out (dissapear from your radar/field of view) and back in. You need to re-lock it under OnVehicleStreamIn
https://sampwiki.blast.hk/wiki/OnVehicleStreamIn
Reply
#3

mine looks like this

Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
	new p1, p2;
	p1 = vParams[vehicleid][forplayerid] & 2;
	p2 = vParams[vehicleid][forplayerid] & 1;
	SetVehicleParamsForPlayer(vehicleid, forplayerid, p1, p2);
    return 1;
}

public SetVehicleParamsForPlayerEx(vehicleid, playerid, para1, para2)
{
	vParams[vehicleid][playerid] = para1*2 + para2;
	if(IsVehicleStreamedIn(vehicleid, playerid))
	    SetVehicleParamsForPlayer(vehicleid, playerid, para1, para2);
	return 1;
}
Reply
#4

and this is carlock cmd

Код:
	if(strcmp(cmd, "/carlock10", true) == 0)
	{
                new keycar = PlayerInfo[playerid][pPcarkey10];
                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))
							{
								SetVehicleParamsForPlayerEx(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))
							{
								SetVehicleParamsForPlayerEx(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 for slot 1");
                    return 1;
                }
	        }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)