PHP код:
if (strcmp(cmd, "/break", true) == 0)
{
if (!IsACop(playerid)) return SendClientMessage(playerid, CWHITE, "Данная функция Вам недоступна");
if (GetPlayerInterior(playerid) != 0) return SendClientMessage(playerid, CWHITE, "Ошибка: вы находитесь в интерьере");
if (GetPVarInt(playerid, "breaked") == 1)
{
DestroyObject(object[playerid]);
SetPVarInt(playerid, "breaked", 0);
Delete3DTextLabel(Text3D:blocktext[playerid]);
SendClientMessage(playerid, -1, "Вы убрали ограждение");
return 1;
}
tmp = strtok(cmdtext, idx);
if (!strlen(tmp)) return SendClientMessage(playerid, CWHITE, "{"#cYELLOW"}• [Подсказка]: {"#cWHITE"}/break [тип (1-4)]");
new type = strval(tmp);
new Float:x, Float : y, Float : z, Float : angle;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, angle);
x += floatsin(-angle, degrees);
y += floatcos(-angle, degrees);
ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 2, 0, 0, 0, 0, 0);
if (GetPVarInt(playerid, "breaked") == 0)
{
switch (type)
{
case 1: object[playerid] = CreateObject(1228, x, y, z - 0.5, 0, 0, 0);
case 2: object[playerid] = CreateObject(1237, x, y, z - 1.0, 0, 0, 0);
case 3: object[playerid] = CreateObject(1423, x, y, z - 0.3, 0, 0, 0);
case 4: object[playerid] = CreateObject(1422, x, y, z - 0.49, 0, 0, 0);
}
if (object[playerid] >= MAX_OBJECTS)
return printf("У Вас превышен лимит объектов! Лимит: %d | Создано: %d", MAX_OBJECTS, object[playerid]);
print("Лимит объектов не превышен!");
new string[50];
format(string, 50, "%i", playerid);
blocktext[playerid] = Create3DTextLabel(string, COLOR_BLUE, x, y, z - 0.7, 30.0, 0, 1);
SetPVarInt(playerid, "breaked", 1);
SendClientMessage(playerid, CWHITE, "Вы установили ограждение. Введите '/break' ещё раз, что бы убрать его");
}
return 1;
}