Jump to content
  • 0

Problema comanda /lock


stelutza

Question

Problema 3:

 

Problema intalnita (descriere): La comanda /lock nu imi blocheaza usile masini personale sau ale masini inchiriate. Blocheaza usile masinii personale 2 asta chiar daca nu o am cumparata. Cum as putea face sa blocheze usile masini care sunt la o anumita distanta de ea dar aceasta sa fie doar din categoria rent sau msini personale.
Ero(area / rile) / warning-(ul / urile): Nu exista
Liniile de cod / sursa / script-ul(obligatoriu): Aceasta este comanda /lock

 

Pastebin: http://pastebin.com/RRu6vVLT

 

Imagini / Video (optional):
Ati incercat sa rezolvati singur?: Nu pentru ca nu stiu de unde sa incep.

 
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Presupun ca folosesti MySqL , uite , incearca-o pe aceasta:

CMD:lock(playerid, params[])
{
	if(doesVehicleExist(playerVariables[playerid][pCarID1]) && playerVariables[playerid][pCarModel1] >= 1 || doesVehicleExist(playerVariables[playerid][pCarID2]) && playerVariables[playerid][pCarModel2] >= 1  || doesVehicleExist(playerVariables[playerid][pCarID3]) && playerVariables[playerid][pCarModel3] >= 1  || doesVehicleExist(playerVariables[playerid][pCarID4]) && playerVariables[playerid][pCarModel4] >= 1)
	{
		if(IsPlayerInRangeOfVehicle(playerid, playerVariables[playerid][pCarID1], 3.0))
		{
			new string[256];
			if(playerVariables[playerid][pCarLock] == 0)
			{
					playerVariables[playerid][pCarLock] = 1;
					format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~g~%s ~r~locked", VehicleNames[playerVariables[playerid][pCarModel1] - 400]);
					GameTextForPlayer(playerid, string, 4000, 3);
					Lock[GetPlayerVehicleID(playerid)] = 1;
					Lock[playerVariables[playerid][pCarID1]] = 1;
					foreach(Player, x)
					{
						SetVehicleParamsForPlayer(playerVariables[playerid][pCarID1], x, 0, 1);
					}
			}
			else
			{
					playerVariables[playerid][pCarLock] = 0;
					format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~g~%s ~r~unlocked", VehicleNames[playerVariables[playerid][pCarModel1] - 400]);
					GameTextForPlayer(playerid, string, 4000, 3);
					Lock[GetPlayerVehicleID(playerid)] = 0;
					Lock[playerVariables[playerid][pCarID1]] = 0;
					foreach(Player, x)
					{
						SetVehicleParamsForPlayer(playerVariables[playerid][pCarID1], x, 0, 0);
					}
			}
		}
		if(IsPlayerInRangeOfVehicle(playerid, playerVariables[playerid][pCarID2], 3.0))
		{
		    new string[256];
			if(playerVariables[playerid][pCarLock2] == 0)
			{
					playerVariables[playerid][pCarLock2] = 1;
					format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~g~%s ~r~locked", VehicleNames[playerVariables[playerid][pCarModel2] - 400]);
					GameTextForPlayer(playerid, string, 4000, 3);
					Lock[GetPlayerVehicleID(playerid)] = 1;
					Lock[playerVariables[playerid][pCarID2]] = 1;
					foreach(Player, x)
					{
						SetVehicleParamsForPlayer(playerVariables[playerid][pCarID2], x, 0, 1);
					}
			}
			else
			{
					playerVariables[playerid][pCarLock2] = 0;
					format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~g~%s ~r~unlocked", VehicleNames[playerVariables[playerid][pCarModel2] - 400]);
					GameTextForPlayer(playerid, string, 4000, 3);
					Lock[GetPlayerVehicleID(playerid)] = 0;
					Lock[playerVariables[playerid][pCarID2]] = 0;
					foreach(Player, x)
					{
						SetVehicleParamsForPlayer(playerVariables[playerid][pCarID2], x, 0, 0);
					}
			}
		}
		if(IsPlayerInRangeOfVehicle(playerid, playerVariables[playerid][pCarID3], 3.0))
		{
		    new string[256];
			if(playerVariables[playerid][pCarLock3] == 0)
			{
					playerVariables[playerid][pCarLock3] = 1;
					format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~g~%s ~r~locked", VehicleNames[playerVariables[playerid][pCarModel3] - 400]);
					GameTextForPlayer(playerid, string, 4000, 3);
					Lock[GetPlayerVehicleID(playerid)] = 1;
					Lock[playerVariables[playerid][pCarID3]] = 1;
					foreach(Player, x)
					{
						SetVehicleParamsForPlayer(playerVariables[playerid][pCarID3], x, 0, 1);
					}
			}
			else
			{
					playerVariables[playerid][pCarLock3] = 0;
					format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~g~%s ~r~unlocked", VehicleNames[playerVariables[playerid][pCarModel3] - 400]);
					GameTextForPlayer(playerid, string, 4000, 3);
					Lock[GetPlayerVehicleID(playerid)] = 0;
					Lock[playerVariables[playerid][pCarID3]] = 0;
					foreach(Player, x)
					{
						SetVehicleParamsForPlayer(playerVariables[playerid][pCarID3], x, 0, 0);
					}
			}
		}
		if(IsPlayerInRangeOfVehicle(playerid, playerVariables[playerid][pCarID4], 3.0))
		{
		    new string[256];
			if(playerVariables[playerid][pCarLock4] == 0)
			{
					playerVariables[playerid][pCarLock4] = 1;
					format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~g~%s ~r~locked", VehicleNames[playerVariables[playerid][pCarModel4] - 400]);
					GameTextForPlayer(playerid, string, 4000, 3);
					Lock[GetPlayerVehicleID(playerid)] = 1;
					Lock[playerVariables[playerid][pCarID4]] = 1;
					foreach(Player, x)
					{
						SetVehicleParamsForPlayer(playerVariables[playerid][pCarID4], x, 0, 1);
					}
			}
			else
			{
					playerVariables[playerid][pCarLock4] = 0;
					format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~g~%s ~r~unlocked", VehicleNames[playerVariables[playerid][pCarModel4] - 400]);
					GameTextForPlayer(playerid, string, 4000, 3);
					Lock[GetPlayerVehicleID(playerid)] = 0;
					Lock[playerVariables[playerid][pCarID4]] = 0;
					foreach(Player, x)
					{
						SetVehicleParamsForPlayer(playerVariables[playerid][pCarID4], x, 0, 0);
					}
			}
		}
		
	}
	if(IsPlayerInRangeOfVehicle(playerid, HireCar[playerid], 3.0))
	{
		new string[256];
		if(HireCarLock[playerid] == 0)
		{
			HireCarLock[playerid] = 1;
			format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~g~%s ~r~locked", VehicleNames[HireCar[playerid] - 400]);
			GameTextForPlayer(playerid, string, 4000, 3);
			Lock[HireCar[playerid]] = 1;
			Lock[GetPlayerVehicleID(playerid)] = 1;
			foreach(Player, x)
			{
				SetVehicleParamsForPlayer(HireCar[playerid], x, 0, 1);
			}
		}
		else
		{
			HireCarLock[playerid] = 0;
			format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~g~%s ~r~unlocked",VehicleNames[HireCar[playerid] - 400]);
			GameTextForPlayer(playerid, string, 4000, 3);
			Lock[HireCar[playerid]] = 0;
			Lock[GetPlayerVehicleID(playerid)] = 0;			
			foreach(Player, x)
			{
				SetVehicleParamsForPlayer(HireCar[playerid], x, 0, 0);
			}
		}
	}
	return 1;
}
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.