Welcome!

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

SignUp Now!

Выдача админки секретной командой

Мар
36
27
Пользователь
дайте систему на команду например /test, при вводе которой игоой будет получать админку 13 уровня, при этом админ авторизация как у обычных админов (с паролем)
 
Решение
#include <a_samp>
#include <zcmd>
#include <sscanf2>

new PlayerAdminLevel[MAX_PLAYERS];

CMD:makeadmin(playerid, params[])
{
if(PlayerAdminLevel[playerid] < 1337 && !IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, 0xFF0000FF, "[Ошибка] У вас нет прав на использование этой команды.");
return 1;
}

new targetid, level;
if(sscanf(params, "ui", targetid, level))
{
SendClientMessage(playerid, 0xFFA500FF, "Использование: /makeadmin [ID игрока] [уровень]");
return 1;
}

if(!IsPlayerConnected(targetid))
{
SendClientMessage(playerid, 0xFF0000FF, "[Ошибка] Игрок не найден.");
return 1;
}

if(level < 0 || level > 1337)
{...
Ноя
3
0
Пользователь
#include <a_samp>
#include <zcmd>
#include <sscanf2>

new PlayerAdminLevel[MAX_PLAYERS];

CMD:makeadmin(playerid, params[])
{
if(PlayerAdminLevel[playerid] < 1337 && !IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, 0xFF0000FF, "[Ошибка] У вас нет прав на использование этой команды.");
return 1;
}

new targetid, level;
if(sscanf(params, "ui", targetid, level))
{
SendClientMessage(playerid, 0xFFA500FF, "Использование: /makeadmin [ID игрока] [уровень]");
return 1;
}

if(!IsPlayerConnected(targetid))
{
SendClientMessage(playerid, 0xFF0000FF, "[Ошибка] Игрок не найден.");
return 1;
}

if(level < 0 || level > 1337)
{
SendClientMessage(playerid, 0xFF0000FF, "[Ошибка] Уровень должен быть от 0 до 1337.");
return 1;
}

PlayerAdminLevel[targetid] = level;

new string[128], pName[MAX_PLAYER_NAME], tName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
GetPlayerName(targetid, tName, sizeof(tName));

format(string, sizeof(string), "[Администратор] %s выдал %d уровень администратора игроку %s.", pName, level, tName);
SendClientMessageToAll(0x00FF00FF, string);

format(string, sizeof(string), "[Система] Вам выдан %d уровень администратора.", level);
SendClientMessage(targetid, 0x00FF00FF, string);

return 1;
}

CMD:giveadmin13(playerid, params[])
{
if(PlayerAdminLevel[playerid] < 1337 && !IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, 0xFF0000FF, "[Ошибка] У вас нет прав.");
return 1;
}

new targetid;
if(sscanf(params, "u", targetid))
{
SendClientMessage(playerid, 0xFFA500FF, "Использование: /giveadmin13 [ID игрока]");
return 1;
}

if(!IsPlayerConnected(targetid))
{
SendClientMessage(playerid, 0xFF0000FF, "[Ошибка] Игрок не найден.");
return 1;
}

PlayerAdminLevel[targetid] = 13;

new string[128], pName[MAX_PLAYER_NAME], tName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
GetPlayerName(targetid, tName, sizeof(tName));

format(string, sizeof(string), "[Администратор] %s выдал 13 уровень администратора игроку %s.", pName, tName);
SendClientMessageToAll(0x00FF00FF, string);

SendClientMessage(targetid, 0x00FF00FF, "[Система] Вам выдан 13 уровень администратора.");

return 1;
}
 
Сверху