Доступ к архиву

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

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

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

[Мануал] 3D номера на машины

Статус
В этой теме нельзя размещать новые ответы.

xCKAYTz

Умник
Здравствуйте, пользователи PAWNO-INFO.
Вот, вырезал для вас систему 3д номеров из мода WorldLife.
Начнём :do:.
Ищем ваш enum в котором находятся личные тачки. У меня он enum aInfo,
в самое его начала пихайте эти букофки
PHP:
aNomer[64],
Теперь идём в паблик загрузки тачек, у меня он LoadAuto(), и выглядит так:
PHP:
public LoadAuto()
{
    new arrCoords[27][64];
    new strFromFile2[256];
    new File: file = fopen("auto.cfg", io_read);
    if (file)
    {
        new idx;
        while (idx < 500)
        {
            fread(file, strFromFile2);
            split(strFromFile2, arrCoords, ',');
            AutoInfo[idx][aStats] = strval(arrCoords[0]);
            AutoInfo[idx][aModel] = strval(arrCoords[1]);
            AutoInfo[idx][aAutoX] = floatstr(arrCoords[2]);
            AutoInfo[idx][aAutoY] = floatstr(arrCoords[3]);
            AutoInfo[idx][aAutoZ] = floatstr(arrCoords[4]);
            AutoInfo[idx][aAutoAngle] = floatstr(arrCoords[5]);
            AutoInfo[idx][aColor1] = strval(arrCoords[6]);
            AutoInfo[idx][aColor2] = strval(arrCoords[7]);
            strmid(AutoInfo[idx][aOwner], arrCoords[8], 0, strlen(arrCoords[8]), 255);
            AutoInfo[idx][aPrice] = strval(arrCoords[9]);
            AutoInfo[idx][aKey] = strval(arrCoords[10]);
            AutoInfo[idx][a0] = strval(arrCoords[11]);
            AutoInfo[idx][a1] = strval(arrCoords[12]);
            AutoInfo[idx][a2] = strval(arrCoords[13]);
            AutoInfo[idx][a3] = strval(arrCoords[14]);
            AutoInfo[idx][a4] = strval(arrCoords[15]);
            AutoInfo[idx][a5] = strval(arrCoords[16]);
            AutoInfo[idx][a6] = strval(arrCoords[17]);
            AutoInfo[idx][a7] = strval(arrCoords[18]);
            AutoInfo[idx][a8] = strval(arrCoords[19]);
            AutoInfo[idx][a9] = strval(arrCoords[20]);
            AutoInfo[idx][a10] = strval(arrCoords[21]);
            AutoInfo[idx][a11] = strval(arrCoords[22]);
            AutoInfo[idx][a12] = strval(arrCoords[23]);
            AutoInfo[idx][a13] = strval(arrCoords[24]);
            AutoInfo[idx][aPaintJob] = strval(arrCoords[25]);
            AutoInfo[idx][aPropysk] = strval(arrCoords[26]);
            idx++;
        }
        fclose(file);
    }
    return 1;
}
Увеличиваем значение arrCoords на еденицу.
И перед idx++; добавляем:
PHP:
strmid(AutoInfo[idx][aNomer], arrCoords[27], 0, strlen(arrCoords[27]), 255);
В итоге у меня получилось так:
PHP:
public LoadAuto()
{
    new arrCoords[28][64];
    new strFromFile2[256];
    new File: file = fopen("auto.cfg", io_read);
    if (file)
    {
        new idx;
        while (idx < 500)
        {
            fread(file, strFromFile2);
            split(strFromFile2, arrCoords, ',');
            AutoInfo[idx][aStats] = strval(arrCoords[0]);
            AutoInfo[idx][aModel] = strval(arrCoords[1]);
            AutoInfo[idx][aAutoX] = floatstr(arrCoords[2]);
            AutoInfo[idx][aAutoY] = floatstr(arrCoords[3]);
            AutoInfo[idx][aAutoZ] = floatstr(arrCoords[4]);
            AutoInfo[idx][aAutoAngle] = floatstr(arrCoords[5]);
            AutoInfo[idx][aColor1] = strval(arrCoords[6]);
            AutoInfo[idx][aColor2] = strval(arrCoords[7]);
            strmid(AutoInfo[idx][aOwner], arrCoords[8], 0, strlen(arrCoords[8]), 255);
            AutoInfo[idx][aPrice] = strval(arrCoords[9]);
            AutoInfo[idx][aKey] = strval(arrCoords[10]);
            AutoInfo[idx][a0] = strval(arrCoords[11]);
            AutoInfo[idx][a1] = strval(arrCoords[12]);
            AutoInfo[idx][a2] = strval(arrCoords[13]);
            AutoInfo[idx][a3] = strval(arrCoords[14]);
            AutoInfo[idx][a4] = strval(arrCoords[15]);
            AutoInfo[idx][a5] = strval(arrCoords[16]);
            AutoInfo[idx][a6] = strval(arrCoords[17]);
            AutoInfo[idx][a7] = strval(arrCoords[18]);
            AutoInfo[idx][a8] = strval(arrCoords[19]);
            AutoInfo[idx][a9] = strval(arrCoords[20]);
            AutoInfo[idx][a10] = strval(arrCoords[21]);
            AutoInfo[idx][a11] = strval(arrCoords[22]);
            AutoInfo[idx][a12] = strval(arrCoords[23]);
            AutoInfo[idx][a13] = strval(arrCoords[24]);
            AutoInfo[idx][aPaintJob] = strval(arrCoords[25]);
            AutoInfo[idx][aPropysk] = strval(arrCoords[26]);
            strmid(AutoInfo[idx][aNomer], arrCoords[27], 0, strlen(arrCoords[27]), 255);
            idx++;
        }
        fclose(file);
    }
    return 1;
}
Дальше идём в паблик загрузки тачек.
У меня он выглядит так:
PHP:
public SaveAuto()
{
    new idx;
    new File: file2;
    while (idx < 500)
    {
        new coordsstring[256];
        format(coordsstring, sizeof(coordsstring), "%d,%d,%f,%f,%f,%f,%d,%d,%s,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
        AutoInfo[idx+1][aStats],
        AutoInfo[idx+1][aModel],
        AutoInfo[idx+1][aAutoX],
        AutoInfo[idx+1][aAutoY],
        AutoInfo[idx+1][aAutoZ],
        AutoInfo[idx+1][aAutoAngle],
        AutoInfo[idx+1][aColor1],
        AutoInfo[idx+1][aColor2],
        AutoInfo[idx+1][aOwner],
        AutoInfo[idx+1][aPrice],
        AutoInfo[idx+1][aKey],
        AutoInfo[idx+1][a0],
        AutoInfo[idx+1][a1],
        AutoInfo[idx+1][a2],
        AutoInfo[idx+1][a3],
        AutoInfo[idx+1][a4],
        AutoInfo[idx+1][a5],
        AutoInfo[idx+1][a6],
        AutoInfo[idx+1][a7],
        AutoInfo[idx+1][a8],
        AutoInfo[idx+1][a9],
        AutoInfo[idx+1][a10],
        AutoInfo[idx+1][a11],
        AutoInfo[idx+1][a12],
        AutoInfo[idx+1][a13],
        AutoInfo[idx+1][aPaintJob],
        AutoInfo[idx+1][aPropysk],
        AutoInfo[idx+1][aLock]);
        if(idx == 0)
        {
            file2 = fopen("auto.cfg", io_write);
        }
        else
        {
            file2 = fopen("auto.cfg", io_append);
        }
        fwrite(file2, coordsstring);
        idx++;
        fclose(file2);
    }
    return 1;
}
После последнего %d(у вас может быть и %s и %f), добавляем:
PHP:
,%s
А также после AutoInfo[idx+1][aLock](у вас может быть другое, главное чтобы вы поняли суть) добавляем:
PHP:
AutoInfo[idx+1][aNomer]
В итоге у меня получилось так:

PHP:
public SaveAuto()
{
    new idx;
    new File: file2;
    while (idx < 500)
    {
        new coordsstring[256];
        format(coordsstring, sizeof(coordsstring),  "%d,%d,%f,%f,%f,%f,%d,%d,%s,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%s\n",
        AutoInfo[idx+1][aStats],
        AutoInfo[idx+1][aModel],
        AutoInfo[idx+1][aAutoX],
        AutoInfo[idx+1][aAutoY],
        AutoInfo[idx+1][aAutoZ],
        AutoInfo[idx+1][aAutoAngle],
        AutoInfo[idx+1][aColor1],
        AutoInfo[idx+1][aColor2],
        AutoInfo[idx+1][aOwner],
        AutoInfo[idx+1][aPrice],
        AutoInfo[idx+1][aKey],
        AutoInfo[idx+1][a0],
        AutoInfo[idx+1][a1],
        AutoInfo[idx+1][a2],
        AutoInfo[idx+1][a3],
        AutoInfo[idx+1][a4],
        AutoInfo[idx+1][a5],
        AutoInfo[idx+1][a6],
        AutoInfo[idx+1][a7],
        AutoInfo[idx+1][a8],
        AutoInfo[idx+1][a9],
        AutoInfo[idx+1][a10],
        AutoInfo[idx+1][a11],
        AutoInfo[idx+1][a12],
        AutoInfo[idx+1][a13],
        AutoInfo[idx+1][aPaintJob],
        AutoInfo[idx+1][aPropysk],
         AutoInfo[idx+1][aLock],
         AutoInfo[idx+1][aNomer]);
        if(idx == 0)
        {
            file2 = fopen("auto.cfg", io_write);
        }
        else
        {
            file2 = fopen("auto.cfg", io_append);
        }
        fwrite(file2, coordsstring);
        idx++;
        fclose(file2);
    }
    return 1;
}
Далее идём паблик OnGameModeInit(), ищем там создание наших тачек при включении сервера.
Вот например у меня создаётся она вот так:
PHP:
new veh = CreateVehicle(AutoInfo[h][aModel], AutoInfo[h][aAutoX], AutoInfo[h][aAutoY], AutoInfo[h][aAutoZ], AutoInfo[h][aAutoAngle], AutoInfo[h][aColor1], AutoInfo[h][aColor2],SPAWN_CARS);[/CODE]
На следующей строчке вставляем:
[CODE]new strings[72];
format(strings,sizeof(strings),"{33AA33}%s",AutoInfo[h][aNomer]);
nomer[h] = CreateDynamic3DTextLabel(strings, COLOR_GREEN, 0.0, 0.0, 1.0, 20.0, INVALID_PLAYER_ID, veh, 1, -1, -1, -1, 100.0);
Вот сообстенно и всё!
Ах, да, дополнение(команда чтобы сбить все номера):
В public OnPlayerCommandText:
PHP:
    if (strcmp(cmd, "/resetnums", true) == 0)
    {
        if(PlayerInfo[playerid][Admin] >= 13)
        {
            for(new h = 0; h < 500; h++)
            {
                format(AutoInfo[h][aNomer],64,"%c %d%d%d %c%c",chars(),random(10),random(10),random(10),chars(),chars());
            }
        }
    }
И в конец мода:
PHP:
new valid_chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
stock chars()
{
    new asdbjas=random(sizeof(valid_chars));
    return valid_chars[asdbjas];
}
Всем спасибо за внимание, вырезано из мода WL, модифицировано мною. От плюса не откажусь.
 
Последнее редактирование модератором:
Статус
В этой теме нельзя размещать новые ответы.
Сверху Снизу