Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Команда /giveslot

Янв
71
2
Пользователь
 Команда /giveslot позволяет админам добавлять игрокам слоты для машин (от 1 до 5), не превышая максимальное значение 10.

Проверяется уровень админки, валидность ID и количество слотов.

Изменения записываются в INI-файл пользователя и уведомляют игрока и админа.

/giveslot:
CMD:giveslot(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 2) return SCM(playerid, 0xFF0000FF, "Нет доступа.");

    new targetid, amount;
    if(sscanf(params, "ud", targetid, amount)) return SCM(playerid, -1, "Использование: /giveslot [ID/ник] [кол-во]");

    if(targetid == INVALID_PLAYER_ID || !IsPlayerConnected(targetid)) return SCM(playerid, 0xFF0000FF, "Игрок не в сети.");

    if(amount < 1 || amount > 5) return SCM(playerid, -1, "От 1 до 5 слотов.");

    PlayerInfo[targetid][pMaxVehicles] += amount;
    if(PlayerInfo[targetid][pMaxVehicles] > 10) PlayerInfo[targetid][pMaxVehicles] = 10;

    new string[128];
    format(string, sizeof(string), "Вы выдали %s +%d слот(ов). Теперь: %d", GetName(targetid), amount, PlayerInfo[targetid][pMaxVehicles]);
    SCM(playerid, 0x00FF00FF, string);

    format(string, sizeof(string), "Администратор %s выдал +%d слот(ов). Теперь макс: %d", GetName(playerid), amount, PlayerInfo[targetid][pMaxVehicles]);
    SCM(targetid, 0x00FF00FF, string);

    new INI:file = INI_Open(UserPath(targetid));
    INI_SetTag(file, "data");
    INI_WriteInt(file, "MaxVehicles", PlayerInfo[targetid][pMaxVehicles]);
    INI_Close(file);

    return 1;
}
 
Сверху