Problem with lock/unlock system in personal vehicles (RPG)
#1

Hello i'm curently working on a system for my private vehicles and i tried to make when i lock my car if i'm the owner i don't need it to unlock it when i press 'F' to get in it and a normal player can't do that only the owner so i tried something but when it's locked for the first time it's working to get in the car but after i exit the car and it's still locked i can't get it in car anymore only if i unlock it. Here i'll put the Lock and unlock function.

Код:
if (newkeys & KEY_NO)
   {
        if(SwitchKey[playerid] == 1)
        {
			new string[100];
			for(new v=0; v<MAX_PVEHS; v++)
			{
   				if(CheckPlayerDistanceToVehicle(3.0, playerid, personalcar[v][playerid]))
				{
	 				if(CarInfo[OwnedVeh(personalcar[v][playerid])][cLock] == 1)
		  			{
   						GetVehicleParamsEx(personalcar[v][playerid],engine,lights,alarm,doors,bonnet,boot,objective);
	  	    			SetVehicleParamsEx(personalcar[v][playerid],engine,lights,alarm,0,bonnet,boot,objective);
						format(string, sizeof(string), "~h~%s~n~~g~Unlocked",CarInfo[OwnedVeh(personalcar[v][playerid])][cDescription]);
						GameTextForPlayer(playerid, string, 4000, 4);
						PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
						CarInfo[OwnedVeh(personalcar[v][playerid])][cLock] = 0;
						SetVehicleParamsForPlayer(personalcar[v][playerid],playerid,0,0);
						gCarLock[personalcar[v][playerid]] = 0;
						vUpdate(OwnedVeh(personalcar[v][playerid]), cLockx); //
						return 1;
					}
					else if(CarInfo[OwnedVeh(personalcar[v][playerid])][cLock] == 0)
					{
 						GetVehicleParamsEx(personalcar[v][playerid],engine,lights,alarm,doors,bonnet,boot,objective);
	    				SetVehicleParamsEx(personalcar[v][playerid],engine,lights,alarm,1,bonnet,boot,objective);
						format(string, sizeof(string), "~h~%s~n~~r~Locked",CarInfo[OwnedVeh(personalcar[v][playerid])][cDescription]);
						GameTextForPlayer(playerid, string, 4000, 4);
						PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
						SetVehicleParamsForPlayer(personalcar[v][playerid],playerid,0,0);
						CarInfo[OwnedVeh(personalcar[v][playerid])][cLock] = 1;
						gCarLock[personalcar[v][playerid]] = 1;
						vUpdate(OwnedVeh(personalcar[v][playerid]), cLockx); //
     					return 1;
					}
				}
			}
			return 1;
        }
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)