Код
if(strcmp(cmd, "/lock", true) == 0)
{
new carid;
GetPlayerName(playerid, sendername, sizeof(sendername));
if(PlayerInfo[playerid][pPHousekey] == 255)
{
if(caridhouse[playerid] == 0) return SendClientMessage(playerid, COLOR_GREY, "В данный момент у вас нет машины");
}
carid = PlayerInfo[playerid][pPHousekey]+1;
if(caridhouse[playerid] != 299)
{
carid = caridhouse[playerid];
}
new lockstatus = gCarLock[carid];
new Float:cx,Float:cy,Float:cz;
GetVehiclePos(carid, cx, cy, cz);
switch (lockstatus)
{
case 0:
{
if(PlayerToPoint(4.0, playerid, cx, cy, cz))
{
if(caridhouse[playerid] == 0 && PlayerInfo[playerid][pPHousekey] == 255)
{
SendClientMessage(playerid, COLOR_GREY, "В данный момент у вас нет машины");
return true;
}
if(caridhouse[playerid] == carid)
{
format(string, sizeof(string), "~w~CAR ~r~LOCK");
GameTextForPlayer(playerid, string, 5000, 3);
LockCar(caridhouse[playerid]);
IsLocked[caridhouse[playerid]] = 1;
}
}
}
case 1:
{
if(PlayerToPoint(4.0, playerid, cx, cy, cz) )
{
if(caridhouse[playerid] == 0 && PlayerInfo[playerid][pPHousekey] == 255)
{
SendClientMessage(playerid, COLOR_GREY, "В данный момент у вас нет машины");
return true;
}
if(caridhouse[playerid] == carid )
{
format(string, sizeof(string), "~w~CAR ~g~UNLOCK");
GameTextForPlayer(playerid, string, 5000, 3);
UnLockCar(caridhouse[playerid]);
IsLocked[caridhouse[playerid]] = 0;
}
}
}
default:
{
SendClientMessage(playerid, COLOR_GREY, "Ошибка");
}
}
if(carid == 256)
{
SendClientMessage(playerid, COLOR_GREY, "В данный момент у вас нет машины");
}
return true;
}