car locking
#1

So I have a universal command for locking bussines,houses, cars...
Everything works fine with bussines and houses but when I lock car when im in it and than exit the car I cannot unlock it... Fragment of code for car locking/unlocking.

Code:
else if ((id = Car_Nearest(playerid)) != -1)
	{
	    static
	        engine,
	        lights,
	        alarm,
	        doors,
	        bonnet,
	        boot,
	        objective;

	    GetVehicleParamsEx(CarData[id][carVehicle], engine, lights, alarm, doors, bonnet, boot, objective);
	
	    if (Car_IsOwner(playerid, id) || (PlayerData[playerid][pFaction] != -1 && CarData[id][carFaction] == GetFactionType(playerid)))
	    {
			if (!CarData[id][carLocked])
			{
				CarData[id][carLocked] = true;
				Car_Save(id);

				ShowPlayerFooter(playerid, "You have ~r~locked~w~ the vehicle!");
				PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);

				SetVehicleParamsEx(CarData[id][carVehicle], engine, lights, alarm, 1, bonnet, boot, objective);
			}
			else
			{
				CarData[id][carLocked] = false;
				Car_Save(id);

				ShowPlayerFooter(playerid, "You have ~g~unlocked~w~ the vehicle!");
				PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);

				SetVehicleParamsEx(CarData[id][carVehicle], engine, lights, alarm, 0, bonnet, boot, objective);
			}
		}		
	}
	else SendErrorMessage(playerid, "You are not in range of anything you can lock.");
	return 1;
}
Code:
Car_Nearest(playerid)
{
	static
	    Float:fX,
	    Float:fY,
	    Float:fZ;

	for (new i = 0; i != MAX_DYNAMIC_CARS; i ++) if (CarData[i][carExists]) {
		GetVehiclePos(CarData[i][carVehicle], fX, fY, fZ);

		if (IsPlayerInRangeOfPoint(playerid, 3.0, fX, fY, fZ)) {
		    return i;
		}
	}
	return -1;
}
so when the car is locked I cannot unlock it... when I write /lock nothing happens... no wrong cmd masseges, nothing at all. I can unlock car if im inside it while its locked...
Reply
#2

bump
Reply
#3

Nice SC-RP script bro.
Reply
#4

Ye its SC-RP... Im not saying it's not... Can I get any help ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)