Car lock problem
#1

Hello! I got a problem i kinda need help with, long story short its when u /lock you car, it sends the message it is locked, but you still can enter it, so does everyone else. Doesn't matter if you are admin or not.
All kinds of help is very much appreciated.

HERE IS THE /LOCK CODE:
Код:
		new key;
		if(ForwardOwnCar(1,playerid))
		{
			key = PlayerInfo[playerid][pCarkey];

		}
		else if(ForwardOwnCar(2,playerid))
		{
			key = PlayerInfo[playerid][pCarkey2];

		}
		else if(ForwardOwnCar(3,playerid))
		{
			key = PlayerInfo[playerid][pCarkey3];

		}
		else
		{
			return 1;

		}
		if(CarInfo[key][cLock] == 0)
		{
			CarInfo[key][cLock] = 0;
			format(string, sizeof(string), "~p~%s~n~~g~UNLOCKED",CarInfo[key][cDescription]);
			GameTextForPlayer(playerid, string, 7000, 4);
			SaveCars();
			return 1;


		}
		else if(CarInfo[key][cLock] == 1)
		{
			CarInfo[key][cLock] = 1;
			format(string, sizeof(string), "~g~%s~n~~r~LOCKED",CarInfo[key][cDescription]);
			GameTextForPlayer(playerid, string, 7000, 4);
			SaveCars();
			return 1;
HERE IS THE CODE, WHAT SHOULD HAPPEN, BUT DOESN'T:
Код:
	if(IsAnOwnableCar(vehicleid) && CarInfo[VehicleOwned[vehicleid]][cLock] != 1) {
		if(AdminDuty[playerid] == 0) {
			ApplyAnimationEx(playerid, "ped", "CAR_doorlocked_LHS", 3.0, 0, 0, 0, 0, 0);
			SetVehicleParamsForPlayer(vehicleid,playerid,0,1);
			new Float:cx, Float:cy, Float:cz;
			GetPlayerPos(playerid, cx, cy, cz);
			DOO_SetPlayerPos(playerid, cx, cy, cz);
			SendClientMessage(playerid,COLOR_LIGHTRED,"[ERROR] This vehicle is currently locked!");
			LockCar[playerid][0] = 3;
			LockCar[playerid][1] = vehicleid;
			ApplyAnimationEx(playerid, "ped", "CAR_doorlocked_LHS", 3.0, 0, 0, 0, 0, 0);
			}
		}
	}
	return 1;
}
Reply
#2

I know whats the problem make sure you make it ==1 because !=1 means its unlocked
Reply
#3

Doesn't seem to work, thanks though. I dont think thats the problem, since i have created most functions like that, all seem to work...except /lock :/
Reply
#4

oh yes, in the /lock use this code instead:
Код:
if(CarInfo[key][cLock] == 0)
{
	CarInfo[key][cLock] = 1;
	format(string, sizeof(string), "~p~%s~n~~g~LOCKED",CarInfo[key][cDescription]);
	GameTextForPlayer(playerid, string, 7000, 4);
	SaveCars();
	return 1;


}
else if(CarInfo[key][cLock] == 1)
{
	CarInfo[key][cLock] = 0;
	format(string, sizeof(string), "~g~%s~n~~r~UNLOCKED",CarInfo[key][cDescription]);
	GameTextForPlayer(playerid, string, 7000, 4);
	SaveCars();
	return 1;
}
Reply
#5

Im gonna go off atm, ill test it later, thanks very much.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)