/lock not working
#1

When you type /lock it doesn't lock/unlock the vehicle, but it locks a business/house perfectly fine.
Код:
CMD:lock(playerid, params[])
{
	new str[128], id = GetNearestVehicle(playerid, 5.0);
	if(id != INVALID_VEHICLE_ID)
	{
		if(Vehicles[id][Locked] == 0)
		{
			SetVehicleParamsEx(id, Engine[id], Lights[id], alarm[id], doors[id], bonnet[id], boot[id], objective[id]);

		}
		return 1;
	}

	id = InRangeOfHouse(playerid);
    if(id != 0)
 	{
 	    if(Character[playerid][House] == id)
 	    {
 	        if(Houses[id][Locked] == 0)
 	        {
         		format(str, sizeof(str), "* %s places the key in the door, locking it.*", GetRoleplayName(playerid), str);
				SendLocalMessage(playerid, str, Range_Short, COLOR_RP, COLOR_RP);
				Houses[id][Locked] = 1;
				MYSQL_Update_Interger(Houses[id][SQLID], "Houses", "Locked", 1);
				return 1;
 	        }
 	        else
 	        {
 	            format(str, sizeof(str), "* %s places the key in the door, unlocking it.*", GetRoleplayName(playerid), str);
				SendLocalMessage(playerid, str, Range_Short, COLOR_RP, COLOR_RP);
				Houses[id][Locked] = 0;
				MYSQL_Update_Interger(Houses[id][SQLID], "Houses", "Locked", 0);
				return 1;
 	        }
 	    }
 	}

    id = InRangeOfBiz(playerid);
    if(id != 0)
 	{
 	    if(Character[playerid][Business_1] == id || Character[playerid][Business_2] == id)
 	    {
 	        if(Business[id][Locked] == 0)
 	        {
         		format(str, sizeof(str), "* %s places the key in the door, locking it.*", GetRoleplayName(playerid), str);
				SendLocalMessage(playerid, str, Range_Short, COLOR_RP, COLOR_RP);
				Business[id][Locked] = 1;
				MYSQL_Update_Interger(Houses[id][SQLID], "Business", "Locked", 1);
				return 1;
 	        }
 	        else
 	        {
 	            format(str, sizeof(str), "* %s places the key in the door, unlocking it.*", GetRoleplayName(playerid), str);
				SendLocalMessage(playerid, str, Range_Short, COLOR_RP, COLOR_RP);
				MYSQL_Update_Interger(Houses[id][SQLID], "Business", "Locked", 1);
				Business[id][Locked] = 0;
				return 1;
 	        }
 	    }
 	}

	return 0;
}
Reply
#2

Should do it:

PHP код:
SetVehicleParamsEx(idEngine[id], Lights[id], alarm[id], 1bonnet[id], boot[id], objective[id]);
doors[id] = 1
To me, it looks like, you are just reapplying the actual value
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)