Доступ к готовым решениям

Переход в группу "Пользователь"

300.00 ₽
Одноразовый платёж
Быстрый переход в группу "Пользователи", без надобности написания постов и ожидания.

Покупка дает возможность:
Быть полноправным участником форума
Нормальное копирование кода
Создавать темы
Скачивать файлы
Доступ к архиву Pawno-Info
  • Новые темы в этом разделе публикуются автоматически при добавлении файла в менеджер ресурсов.
    Ручное создание новых тем невозможно.

Плавающий авианосец (С видео)

of_Lex

Дебютант
Решили создать плавающий авианосец. Может кому-то пригодится, кто-то доработает. Скрипт позволяет заставить громадный авианосец (объект) плавать.


1. Для начала создаём переменные в начале мода.
PHP:
new avia, avia_part[8], Float:avia_X, Float:avia_Y, Float:avia_Z;
2. Далее в public OnGameModeInit() добавляем начальные координаты авианосца (на базе Naval Base San Fierro).
PHP:
avia_X = -1357.69531;
avia_Y = 501.29688;
avia_Z = 5.44531;
avia = CreateObject(10771, avia_X, avia_Y, avia_Z, 0.00000, 0.00000, 0.00000);
avia_part[0] = CreateObject(11148, -1366.68750, 501.29688, 12.88281, 0.00000, 0.00000, 0.00000);
avia_part[1] = CreateObject(11146, -1366.68750, 501.85156, 12.28906, 0.00000, 0.00000, 0.00000);
avia_part[2] = CreateObject(11149, -1363.77344, 496.09375, 11.98438, 0.00000, 0.00000, 0.00000);
avia_part[3] = CreateObject(10772, -1356.35156, 501.11719, 17.27344, 0.00000, 0.00000, 0.00000);
avia_part[4] = CreateObject(10770, -1354.46875, 493.75000, 38.67969, 0.00000, 0.00000, 0.00000);
avia_part[5] = CreateObject(11237, -1354.42188, 493.75000, 38.67969, 0.00000, 0.00000, 0.00000);
avia_part[6] = CreateObject(11145, -1420.57813, 501.29688, 4.25781, 0.00000, 0.00000, 0.00000);
avia_part[7] = CreateObject(11147, -1418.41406, 501.29688, 5.07813, 0.00000, 0.00000, 0.00000);
AttachObjectToObject(avia_part[0], avia, -8.99219, 0.00000, 7.4375, 0.0, 0.0, 0.0, 1);
AttachObjectToObject(avia_part[1], avia, -8.99219, 0.55468, 6.84375, 0.0, 0.0, 0.0, 1);
AttachObjectToObject(avia_part[2], avia, -6.07813, -5.20313, 6.53907, 0.0, 0.0, 0.0, 1);
AttachObjectToObject(avia_part[3], avia, 1.34375, -0.17969, 11.82813, 0.0, 0.0, 0.0, 1);
AttachObjectToObject(avia_part[4], avia, 3.22656, -7.54688, 33.23438, 0.0, 0.0, 0.0, 1);
AttachObjectToObject(avia_part[5], avia, 3.27343, -7.54688, 33.23438, 0.0, 0.0, 0.0, 1);
AttachObjectToObject(avia_part[6], avia, -62.88282, 0.00000, -1.1875, 0.0, 0.0, 0.0, 1);
AttachObjectToObject(avia_part[7], avia, -60.71875, 0.00000, -0.36718, 0.0, 0.0, 0.0, 1);
3. Создаём команды в public OnPlayerCommandText(playerid, cmdtext[])
PHP:
else if(strcmp(command, "/move_krb",true) == 0)
{
command = strtok(cmdtext, index);
new Float:speed = floatstr(command);
command = strtok(cmdtext, index);
new Float:distance = floatstr(command);
new Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ;
GetObjectPos(avia, X, Y, Z);
GetObjectRot(avia, rX, rY, rZ);
new Float:newX = floatcos(rZ, degrees) * distance + X;
new Float:newY = floatsin(rZ, degrees) * distance + Y;
MoveObject(avia, newX, newY, Z, speed, rX, rY, rZ);
return 1;
}
else if(strcmp(command, "/set_krb",true) == 0)
{
command = strtok(cmdtext, index);
new Float:rZ = floatstr(command);
SetObjectRot(avia, 0, 0, rZ);
return 1;
}
Примечание: Система требует наличие strtok в моде.

1. Добавьте следующее в начало public OnPlayerCommandText(playerid, cmdtext[]).
PHP:
new command[128], index;
command = strtok(cmdtext, index);
2. И следующее в любое место мода вне пабликов.
PHP:
strtok(const string[], &index)
{
while((index < strlen(string)) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < strlen(string)) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
Принцип действия:
Командой /move_krb [speed] [distance] выставляете какое расстояние должен проплыть корабль и с какой скоростью. Авианосец будет плыть вперёд. Например /move_krb 10 500 (будет плыть со скоростью 10 м/с на 500 метров вперёд).
Командой /set_krb [rotate] поворачиваете корабль. Вокруг своей оси. Например /set_krb 50.

Удаление стандартного авианосца:
Совсем забыл, что данный скрипт добавляет новый плавающий авианосец, а не заставляет плавать старый. Код ниже необходимо вставить в public OnPlayerConnect(playerid), чтобы стандартный авианосец не мешал.
PHP:
RemoveBuildingForPlayer(playerid, 10771, -1357.6953, 501.2969, 5.4453, 0.25);
RemoveBuildingForPlayer(playerid, 10901, -1357.6953, 501.2969, 5.4453, 0.25);
RemoveBuildingForPlayer(playerid, 11145, -1420.5781, 501.2969, 4.2578, 0.25);
RemoveBuildingForPlayer(playerid, 11146, -1366.6875, 501.8516, 12.2891, 0.25);
RemoveBuildingForPlayer(playerid, 11148, -1366.6875, 501.2969, 12.8828, 0.25);
RemoveBuildingForPlayer(playerid, 3884, -1394.8047, 493.3984, 18.0469, 0.25);
RemoveBuildingForPlayer(playerid, 3885, -1394.8047, 493.3984, 18.0078, 0.25);
RemoveBuildingForPlayer(playerid, 3884, -1324.3281, 493.8125, 21.0547, 0.25);
RemoveBuildingForPlayer(playerid, 3885, -1324.3281, 493.8125, 21.0156, 0.25);
RemoveBuildingForPlayer(playerid, 11404, -1354.4688, 493.7500, 38.6797, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1459.5703, 514.3516, 5.8672, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1459.5703, 488.2344, 5.8672, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1448.1172, 488.2344, 5.8672, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1448.1172, 514.3516, 5.8672, 0.25);
RemoveBuildingForPlayer(playerid, 11401, -1449.2969, 507.8047, 4.7188, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1436.6563, 488.2344, 5.8672, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1425.1953, 488.2344, 5.8672, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1435.8125, 488.6094, 13.8594, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1425.2500, 501.2891, 15.2734, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1436.6563, 514.3516, 5.8672, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1435.8125, 513.9844, 13.8594, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1425.1953, 514.3516, 5.8672, 0.25);
RemoveBuildingForPlayer(playerid, 11147, -1418.4141, 501.2969, 5.0781, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1414.6719, 488.6094, 13.8594, 0.25);
RemoveBuildingForPlayer(playerid, 3800, -1414.5234, 504.9453, 2.0391, 0.25);
RemoveBuildingForPlayer(playerid, 3798, -1414.0625, 506.4844, 2.0391, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1413.1172, 514.3516, 5.8672, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1413.1250, 488.2344, 5.8672, 0.25);
RemoveBuildingForPlayer(playerid, 3798, -1411.2500, 489.1406, 2.0391, 0.25);
RemoveBuildingForPlayer(playerid, 3800, -1410.7969, 490.6797, 2.0391, 0.25);
RemoveBuildingForPlayer(playerid, 3800, -1412.7969, 488.6797, 2.0391, 0.25);
RemoveBuildingForPlayer(playerid, 3799, -1408.7969, 489.5938, 1.9219, 0.25);
RemoveBuildingForPlayer(playerid, 3799, -1405.8672, 489.5938, 1.9219, 0.25);
RemoveBuildingForPlayer(playerid, 3799, -1405.8672, 492.5234, 1.9219, 0.25);
RemoveBuildingForPlayer(playerid, 3799, -1408.7969, 492.5234, 1.9219, 0.25);
RemoveBuildingForPlayer(playerid, 3798, -1409.2578, 492.9844, 4.2656, 0.25);
RemoveBuildingForPlayer(playerid, 3798, -1404.4766, 492.9844, 4.2656, 0.25);
RemoveBuildingForPlayer(playerid, 3800, -1407.6250, 493.2813, 4.2656, 0.25);
RemoveBuildingForPlayer(playerid, 3794, -1404.8281, 499.8828, 10.7188, 0.25);
RemoveBuildingForPlayer(playerid, 3793, -1403.8984, 500.0859, 10.8203, 0.25);
RemoveBuildingForPlayer(playerid, 3798, -1408.4297, 506.4844, 2.0391, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1401.6641, 488.2344, 5.8672, 0.25);
RemoveBuildingForPlayer(playerid, 3795, -1401.8359, 494.9063, 10.5469, 0.25);
RemoveBuildingForPlayer(playerid, 3792, -1401.0078, 494.6875, 10.7500, 0.25);
RemoveBuildingForPlayer(playerid, 3793, -1398.1797, 494.7734, 10.8203, 0.25);
RemoveBuildingForPlayer(playerid, 3788, -1399.0625, 494.4453, 10.7188, 0.25);
RemoveBuildingForPlayer(playerid, 3799, -1400.0078, 489.5938, 1.9219, 0.25);
RemoveBuildingForPlayer(playerid, 3799, -1402.9375, 489.5938, 1.9219, 0.25);
RemoveBuildingForPlayer(playerid, 3799, -1397.0781, 489.5938, 1.9219, 0.25);
RemoveBuildingForPlayer(playerid, 3799, -1397.0781, 492.5234, 1.9219, 0.25);
RemoveBuildingForPlayer(playerid, 3799, -1400.0078, 492.5234, 1.9219, 0.25);
RemoveBuildingForPlayer(playerid, 3799, -1402.9375, 492.5234, 1.9219, 0.25);
RemoveBuildingForPlayer(playerid, 3798, -1402.4766, 492.9844, 4.2656, 0.25);
RemoveBuildingForPlayer(playerid, 3798, -1396.6172, 489.1250, 4.2656, 0.25);
RemoveBuildingForPlayer(playerid, 3798, -1396.6172, 491.1250, 4.2656, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1403.6641, 501.2891, 15.2734, 0.25);
RemoveBuildingForPlayer(playerid, 3798, -1399.7578, 497.2891, 10.2031, 0.25);
RemoveBuildingForPlayer(playerid, 3796, -1398.1875, 502.7031, 10.2031, 0.25);
RemoveBuildingForPlayer(playerid, 3798, -1400.2109, 499.7422, 10.2031, 0.25);
RemoveBuildingForPlayer(playerid, 3792, -1401.2031, 502.2188, 11.6953, 0.25);
RemoveBuildingForPlayer(playerid, 3789, -1403.6172, 504.0938, 10.5469, 0.25);
RemoveBuildingForPlayer(playerid, 3799, -1400.0078, 495.4531, 1.9219, 0.25);
RemoveBuildingForPlayer(playerid, 3799, -1397.0781, 495.4531, 1.9219, 0.25);
RemoveBuildingForPlayer(playerid, 3798, -1396.6172, 495.9141, 4.2656, 0.25);
RemoveBuildingForPlayer(playerid, 3798, -1398.6172, 495.9141, 4.2656, 0.25);
RemoveBuildingForPlayer(playerid, 3800, -1400.2031, 496.4219, 4.2656, 0.25);
RemoveBuildingForPlayer(playerid, 3798, -1396.6172, 497.9141, 2.0391, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1401.6641, 514.3516, 5.8672, 0.25);
RemoveBuildingForPlayer(playerid, 3799, -1400.2578, 512.8359, 1.9219, 0.25);
RemoveBuildingForPlayer(playerid, 3799, -1397.3281, 512.8359, 1.9219, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1390.2031, 488.2344, 5.8672, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1366.3750, 490.0625, 13.2109, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1393.1172, 488.6094, 13.8203, 0.25);
RemoveBuildingForPlayer(playerid, 3800, -1395.0781, 492.6016, 2.0391, 0.25);
RemoveBuildingForPlayer(playerid, 3800, -1395.0781, 493.6797, 2.0391, 0.25);
RemoveBuildingForPlayer(playerid, 3800, -1395.0781, 494.7578, 2.0391, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1381.6094, 500.7109, 5.2656, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1371.9688, 501.6016, 13.8594, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1370.7422, 501.1172, 13.2656, 0.25);
RemoveBuildingForPlayer(playerid, 11149, -1363.7734, 496.0938, 11.9844, 0.25);
RemoveBuildingForPlayer(playerid, 11374, -1363.7734, 496.0938, 11.9844, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1390.2031, 514.3516, 5.8672, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1393.1016, 513.9844, 13.8594, 0.25);
RemoveBuildingForPlayer(playerid, 11406, -1396.2656, 504.5078, 5.3672, 0.25);
RemoveBuildingForPlayer(playerid, 3799, -1387.4609, 507.1875, 1.9219, 0.25);
RemoveBuildingForPlayer(playerid, 3798, -1387.6094, 504.7188, 2.0391, 0.25);
RemoveBuildingForPlayer(playerid, 3798, -1387.6094, 509.6563, 2.0391, 0.25);
RemoveBuildingForPlayer(playerid, 3800, -1389.1484, 505.1797, 2.0391, 0.25);
RemoveBuildingForPlayer(playerid, 3800, -1386.0703, 509.1953, 2.0391, 0.25);
RemoveBuildingForPlayer(playerid, 3800, -1388.0703, 509.3281, 4.0391, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1371.9688, 513.9844, 13.8594, 0.25);
RemoveBuildingForPlayer(playerid, 3799, -1365.6016, 502.7891, 10.0938, 0.25);
RemoveBuildingForPlayer(playerid, 3800, -1364.1172, 504.8359, 10.2031, 0.25);
RemoveBuildingForPlayer(playerid, 3798, -1362.5313, 505.7500, 10.2031, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1308.5781, 488.6094, 13.8594, 0.25);
RemoveBuildingForPlayer(playerid, 11150, -1292.4844, 490.7656, 11.9219, 0.25);
RemoveBuildingForPlayer(playerid, 3800, -1349.8203, 490.6563, 10.1875, 0.25);
RemoveBuildingForPlayer(playerid, 3800, -1350.0000, 490.6563, 11.2500, 0.25);
RemoveBuildingForPlayer(playerid, 3800, -1341.5547, 490.1875, 10.1875, 0.25);
RemoveBuildingForPlayer(playerid, 3800, -1342.7422, 490.1875, 10.1875, 0.25);
RemoveBuildingForPlayer(playerid, 3800, -1341.2344, 490.2031, 11.2500, 0.25);
RemoveBuildingForPlayer(playerid, 10770, -1354.4688, 493.7500, 38.6797, 0.25);
RemoveBuildingForPlayer(playerid, 3791, -1289.9766, 494.7734, 10.6719, 0.25);
RemoveBuildingForPlayer(playerid, 11237, -1354.4219, 493.7500, 38.6797, 0.25);
RemoveBuildingForPlayer(playerid, 955, -1350.1172, 492.2891, 10.5859, 0.25);
RemoveBuildingForPlayer(playerid, 11334, -1346.8984, 492.7969, 10.9609, 0.25);
RemoveBuildingForPlayer(playerid, 956, -1350.1172, 493.8594, 10.5859, 0.25);
RemoveBuildingForPlayer(playerid, 3800, -1341.2969, 493.7344, 12.1484, 0.25);
RemoveBuildingForPlayer(playerid, 3798, -1341.7109, 493.9766, 10.2031, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1350.1094, 499.1797, 20.2969, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1329.7031, 500.5391, 13.8594, 0.25);
RemoveBuildingForPlayer(playerid, 3796, -1335.9688, 499.9297, 10.2031, 0.25);
RemoveBuildingForPlayer(playerid, 3787, -1329.4297, 499.6016, 10.7734, 0.25);
RemoveBuildingForPlayer(playerid, 3787, -1328.3906, 497.9375, 10.7734, 0.25);
RemoveBuildingForPlayer(playerid, 3791, -1334.2891, 497.6094, 10.6719, 0.25);
RemoveBuildingForPlayer(playerid, 3791, -1333.0547, 496.0000, 10.6719, 0.25);
RemoveBuildingForPlayer(playerid, 3798, -1328.6016, 496.0469, 10.2031, 0.25);
RemoveBuildingForPlayer(playerid, 3800, -1349.9766, 495.8281, 10.1875, 0.25);
RemoveBuildingForPlayer(playerid, 3795, -1294.1172, 499.3359, 10.5469, 0.25);
RemoveBuildingForPlayer(playerid, 3791, -1290.5000, 496.4375, 10.6719, 0.25);
RemoveBuildingForPlayer(playerid, 3787, -1290.2656, 499.9609, 10.7734, 0.25);
RemoveBuildingForPlayer(playerid, 3787, -1290.3125, 497.9609, 10.7734, 0.25);
RemoveBuildingForPlayer(playerid, 3792, -1294.5938, 497.3750, 10.3359, 0.25);
RemoveBuildingForPlayer(playerid, 10772, -1356.3516, 501.1172, 17.2734, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1350.8359, 501.6016, 13.8594, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1350.8438, 513.9844, 13.8594, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1359.8281, 501.1172, 13.2656, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1348.2813, 501.1172, 13.2656, 0.25);
RemoveBuildingForPlayer(playerid, 3799, -1342.6016, 502.8047, 10.0938, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1329.7031, 501.6016, 13.8594, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1329.2734, 513.9844, 13.8594, 0.25);
RemoveBuildingForPlayer(playerid, 3800, -1340.5547, 504.0938, 10.2031, 0.25);
RemoveBuildingForPlayer(playerid, 3798, -1340.0859, 502.5469, 10.2031, 0.25);
RemoveBuildingForPlayer(playerid, 3798, -1328.2891, 503.1016, 10.2031, 0.25);
RemoveBuildingForPlayer(playerid, 3799, -1329.7891, 512.3984, 10.0938, 0.25);
RemoveBuildingForPlayer(playerid, 3798, -1328.4844, 509.4766, 10.2031, 0.25);
RemoveBuildingForPlayer(playerid, 3785, -1308.6016, 513.9844, 13.8594, 0.25);
RemoveBuildingForPlayer(playerid, 3787, -1300.6406, 504.0391, 10.7734, 0.25);
RemoveBuildingForPlayer(playerid, 3789, -1301.5859, 511.1094, 10.5469, 0.25);
RemoveBuildingForPlayer(playerid, 3792, -1301.5859, 511.9688, 10.7500, 0.25);
RemoveBuildingForPlayer(playerid, 3794, -1305.3359, 511.1953, 10.7188, 0.25);
RemoveBuildingForPlayer(playerid, 3793, -1305.2891, 512.1484, 10.8203, 0.25);
RemoveBuildingForPlayer(playerid, 3800, -1298.2109, 503.1641, 10.2031, 0.25);
RemoveBuildingForPlayer(playerid, 3798, -1297.7422, 501.6172, 10.2031, 0.25);
RemoveBuildingForPlayer(playerid, 3788, -1294.0156, 509.2188, 10.7188, 0.25);
RemoveBuildingForPlayer(playerid, 3793, -1294.0156, 510.1563, 10.8203, 0.25);
RemoveBuildingForPlayer(playerid, 3794, -1294.6172, 501.3281, 10.7188, 0.25);
RemoveBuildingForPlayer(playerid, 3798, -1293.2344, 512.4531, 10.2031, 0.25);
RemoveBuildingForPlayer(playerid, 3795, -1290.3984, 503.4688, 10.5469, 0.25);
RemoveBuildingForPlayer(playerid, 3792, -1289.7031, 503.9922, 10.7500, 0.25);
RemoveBuildingForPlayer(playerid, 3793, -1294.3750, 503.1094, 10.4297, 0.25);
RemoveBuildingForPlayer(playerid, 11400, -1288.8281, 504.5391, 13.0078, 0.25);
RemoveBuildingForPlayer(playerid, 3114, -1414.44800, 516.46698, 16.67990, 0.25);
RemoveBuildingForPlayer(playerid, 3115, -1456.65967, 501.28989, 16.88700, 0.25);
Автор: of_Lex.
 
Последнее редактирование:
Сверху Снизу