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;
}
PHP код:
SetVehicleParamsEx(id, Engine[id], Lights[id], alarm[id], 1, bonnet[id], boot[id], objective[id]);
doors[id] = 1;