PHP код:
if(strcmp(cmd, "/lock", true) == 0)
{
new house = PINFO[playerid][pHouse];
new carid;
if (PINFO[playerid][pHouse] == 999) return true;
if(HomeInfo[house][hCar] == 0) return SendMe(playerid, CGRADD, "У вас нет машины.");
carid = PINFO[playerid][pHouse]+1;
if(HomeInfo[house][hCar] != 299)
{
carid = HomeInfo[house][hCar];
}
new lockstatus = gCarLock[carid];
new Float:cx,Float:cy,Float:cz;
GetVehiclePos(carid, cx, cy, cz);
if(UgnaliCar[HomeInfo[house][hCar]] == true) return SendMe(playerid, CGRADD, "Машина закрыта. Выкупите её");
switch (lockstatus)
{
case 0:
{
if(PlayerToPoint(4.0, playerid, cx, cy, cz) )
{
if(HomeInfo[house][hCar] == carid )
{
GameTextForPlayer(playerid, "~w~CAR ~r~LOCK", 5000, 3);
PlayerPlaySound(playerid, 24600, 0.0, 0.0, 0.0);
LockCar(HomeInfo[house][hCar]);
gCarLock[HomeInfo[house][hCar]] = true;
if(MotoCikl(HomeInfo[house][hCar])) return SetPlayerChatBubble(playerid,"закрыл(а) мотоцикл",CPURPLE,20.0,10000);
else { SetPlayerChatBubble(playerid,"закрыл(а) автомобиль",CPURPLE,20.0,10000); }
IsLocked[HomeInfo[house][hCar]] = true;
}
}
}
case 1:
{
if(PlayerToPoint(4.0, playerid, cx, cy, cz) )
{
if(HomeInfo[house][hCar] == carid )
{
GameTextForPlayer(playerid, "~w~CAR ~g~UNLOCK", 5000, 3);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
if(MotoCikl(HomeInfo[house][hCar])) return SetPlayerChatBubble(playerid,"открыл(а) мотоцикл",CPURPLE,20.0,10000);
else { SetPlayerChatBubble(playerid,"открыл(а) автомобиль",CPURPLE,20.0,10000); }
gCarLock[HomeInfo[house][hCar]] = false;
UnLockCar(HomeInfo[house][hCar]);
IsLocked[HomeInfo[house][hCar]] = false;
return true;
}
}
}
}
return true;
}