Команда /addmoderaotr | Выдачи прав администрации.100% самп-рп

Description: Готовые команды
Moderator: SJplayer

May
Topic author, Ефрейтор
Ефрейтор
Avatar
May
Topic author, Ефрейтор
Ефрейтор
Posts: 22
Joined: 8 May 2013
With us: 11 years 5 months

#1by May » 8 May 2013, 18:09

Команда /addmoderaotr | Выдачи прав администрации.100% самп-рп

ко всем case

Code: Select all

    case 327:
        {
            if(
response==1)
            {

                if(
listitem == 0)
                {
                    
ShowPlayerDialog(playerid,2131,DIALOG_STYLE_INPUT,"{ff0014}Добавть модератора","\n'        Введите ник игрока        '","Добавить","Закрыть");
                }
                if(
listitem == 1)
                {
                    
printf("test");
                    new 
iniFile ini_openFile("data/admins.db");
                    new 
kolbo;
                    new 
chis[10];
                    new 
nik[30];
                    new 
string[5000];
                    new 
string2[100];
                    
ini_getInteger(iniFile"Total",kolbo);
                    
printf("kolbo = %d",kolbo);
                    for(new 
0kolboi++)
                    {
                        
format(chissizeof(chis), "%d",i);
                        
ini_getString(iniFile,chis,nik);
                        
printf("%d = %s",i,nik);
                        
format(string2sizeof(string2), "%s\n",nik);
                        
printf("string2 = %s",string2);
                        
//strins(string, string2, sizeof(string));
                        
format(stringsizeof(string), "%s%s\n",string,nik);
                        
printf("string = %s",string);
                    }

                    
ShowPlayerDialog(playerid,2335,DIALOG_STYLE_LIST,"{139BEC}Список модераторов",string,"Выбрать","Закрыть");
                }

            }
            else
            {

                return 
true;
            }
        }
    case 
2131:
        {
            if(
response)
            {
                if(!
strlen(inputtext)) return ShowPlayerDialog(playerid,2131,DIALOG_STYLE_INPUT,"{ff0014}Добавть модератора","\n'        Введите ник игрока        '","Добавить","Закрыть");

                new 
str[228];
                
format(strsizeof(str), "INSERT INTO `admin` (`nick`, `password`) VALUES ('%s', '255')"inputtext);
                
mysql_query(str);
                                    
format(stringsizeof(string), "{139BEC}Модератор %s добавлен успешно!",inputtext);
                    
SendClientMessage(playeridCOLOR_GREYstring);
                
                
/*if(slot00[playerid] == 65535)
                {
                    new iniFile = ini_openFile("data/adminlvls.dat");
                    ini_setInteger(iniFile, inputtext,1);
                    ini_closeFile(iniFile);
                    new total;
                    new total1[255];
                    new File3 = ini_openFile("data/admins.db");
                    ini_getInteger(File3,"Total",total);
                    format(total1, sizeof(total1), "%d",total);
                    ini_setString(File3,total1,inputtext);
                    ini_closeFile(File3);
                    total++;
                    new File = ini_openFile("data/admins.db");
                    ini_setInteger(File,"Total",total);
                    ini_closeFile(File);
                    format(string, sizeof(string), "{139BEC}Модератор %s добавлен успешно!",inputtext);
                    SendClientMessage(playerid, COLOR_GREY, string);
                }
                else
                {
                    new iniFile = ini_openFile("data/adminlvls.dat");
                    ini_setInteger(iniFile, inputtext,1);
                    ini_closeFile(iniFile);
                    new total;
                    new total1[255];
                    new File3 = ini_openFile("data/admins.db");
                    format(total1, sizeof(total1), "%d",slot00[playerid]);
                    ini_setString(File3,total1,inputtext);
                    ini_closeFile(File3);
                    //    total++;
                    format(string, sizeof(string), "{139BEC}Модератор в слот(%d) %s добавлен успешно!",slot00[playerid],inputtext);
                    SendClientMessage(playerid, COLOR_GREY, string);
                    slot00[playerid] = 65535;
                }*/
            
}
        }

    case 
2335:
        {
            if(
response==1)
            {
                if(!
strcmp(inputtext"Удален"true6))
                {
                    
SendClientMessage(playeridCOLOR_GREY"Слот пуст!");
                    
slot00[playerid] = listitem;
                    
ShowPlayerDialog(playerid,2131,DIALOG_STYLE_INPUT,"{ff0014}Добавть модератора","\n'        Введите ник игрока        '","Добавить","Закрыть");
                    return 
true;
                }
                new 
string[100];
                new 
strings[100];
                new 
admlvl;
                new 
iniFile ini_openFile("data/adminlvls.dat");
                
ini_getInteger(iniFileinputtext,admlvl);
                
ini_closeFile(iniFile);
                
format(stringsizeof(string), "{139BEC}Управление модератором %s",inputtext);
                
//    format(SelNik[playerid], sizeof(SelNik[playerid]),"%s",inputtext);
                
SelID[playerid] = listitem;
                if(
admlvl <= 2)
                {
                    
format(stringssizeof(strings), "{ff0014}Редактировать lvl {f0dc82}(%d)\n{ff0014}Удалить",admlvl);
                }
                if(
admlvl && admlvl 10)
                {
                    
format(stringssizeof(strings), "{ff0014}Редактировать lvl {adff2f}(%d)\n{ff0014}Удалить",admlvl);
                }
                if(
admlvl 9)
                {
                    
format(stringssizeof(strings), "{ff0014}Редактировать lvl {ff2f3b}(%d)\n{ff0014}Удалить",admlvl);
                }
                
ShowPlayerDialog(playerid,2135,DIALOG_STYLE_LIST,s  tring,strings,"Выбрать","Назад");
            }
            else
            {

            }
        }
    case 
2135:
        {
            if(
response==1)
            {
                if(
listitem == 0)
                {
                    
ShowPlayerDialog(playerid,2134,DIALOG_STYLE_INPUT,"{ff0014}Редактировать lvl","\n","Установить","Закрыть");
                }
                if(
listitem == 1)
                {

                    new 
nikk[30];
                    new 
cghi[255];
                    new 
total;
                    new 
File3 ini_openFile("data/admins.db");
                    
format(cghisizeof(cghi), "%d",SelID[playerid]);
                    
ini_getString(File3,cghi,nikk);
                    
ini_getInteger(File3,"Total",total);
                    
ini_closeFile(File3);
                    
total--;
                    new 
File ini_openFile("data/adminlvls.dat");
                    
ini_setInteger(File,nikk,0);
                    
ini_closeFile(File);
                    new 
File2 ini_openFile("data/admins.db");
                    
ini_setString(File2,cghi,"Удален");
                    
//    ini_setInteger(File2,"Total",total);
                    
ini_closeFile(File2);
                    
format(stringsizeof(string), "{139BEC}Модератор %s удален!",nikk);
                    
SendClientMessage(playeridCOLOR_GREYstring);

                }
            }
            else
            {
                
printf("test");
                new 
iniFile ini_openFile("data/admins.db");
                new 
kolbo;
                new 
chis[10];
                new 
nik[30];
                new 
string[5000];
                new 
string2[100];
                
ini_getInteger(iniFile"Total",kolbo);
                
printf("kolbo = %d",kolbo);
                for(new 
0kolboi++)
                {
                    
format(chissizeof(chis), "%d",i);
                    
ini_getString(iniFile,chis,nik);
                    
printf("%d = %s",i,nik);
                    
format(string2sizeof(string2), "%s\n",nik);
                    
printf("string2 = %s",string2);
                    
//strins(string, string2, sizeof(string));
                    
format(stringsizeof(string), "%s%s\n",string,nik);
                    
printf("string = %s",string);
                }

                
ShowPlayerDialog(playerid,2335,DIALOG_STYLE_LIST,"{139BEC}Список модераторов",string,"Выбрать","Закрыть");
            }
        }
    case 
2134:
        {
            if(
response)
            {
                if(!
strlen(inputtext)) return ShowPlayerDialog(playerid,2134,DIALOG_STYLE_INPUT,"{ff0014}Редактировать lvl","\n","Установить","Закрыть");
                new 
nikk[30];
                new 
cghi[255];
                new 
File3 ini_openFile("data/admins.db");
                
format(cghisizeof(cghi), "%d",SelID[playerid]);
                
ini_getString(File3,cghi,nikk);
                
ini_closeFile(File3);
                if(
strval(inputtext) > 6)
                {
                    
SendClientMessage(playeridCOLOR_GREY"Только от 1 до 6!");
                    
ShowPlayerDialog(playerid,2134,DIALOG_STYLE_INPUT,"{ff0014}Редактировать lvl","\n","Установить","Закрыть");
                }
                new 
File ini_openFile("data/adminlvls.dat");
                
ini_setInteger(File,nikk,strval(inputtext));
                
ini_closeFile(File);
                
format(stringsizeof(string), "{139BEC}Уровень установлен для %s[lvl: %d]",nikk,strval(inputtext));
                
SendClientMessage(playeridCOLOR_GREYstring);
                
printf("test");
                new 
iniFile ini_openFile("data/admins.db");
                new 
kolbo;
                new 
chis[10];
                new 
nik[30];
                new 
string[5000];
                new 
string2[100];
                
ini_getInteger(iniFile"Total",kolbo);
                
printf("kolbo = %d",kolbo);
                for(new 
0kolboi++)
                {
                    
format(chissizeof(chis), "%d",i);
                    
ini_getString(iniFile,chis,nik);
                    
printf("%d = %s",i,nik);
                    
format(string2sizeof(string2), "%s\n",nik);
                    
printf("string2 = %s",string2);
                    
//strins(string, string2, sizeof(string));
                    
format(stringsizeof(string), "%s%s\n",string,nik);
                    
printf("string = %s",string);
                }

                
ShowPlayerDialog(playerid,2335,DIALOG_STYLE_LIST,"{139BEC}Список модераторов",string,"Выбрать","Закрыть");
            }
        }
    case 
2934:
        {
            if(
response)
            {

                if(!
strlen(inputtext)) return ShowPlayerDialog(playerid,2934,DIALOG_STYLE_PASSWO  RD,"Админ авторизация","Введите пароль\n\nПароль должен состоять из латинских букв и цифр\nразмером от 6 до 15 символов","Вход","Отмена");
                if(
strlen(inputtext) < || strlen(inputtext) > 15) return ShowPlayerDialog(playerid,2934,DIALOG_STYLE_PASSWO  RD,"Админ авторизация","Введите пароль\n\nОшибка! Пароль должен состоять из латинских букв и цифр\nразмером от 6 до 15 символов","Вход","Отмена");
                
Dostup[playerid] = strval(inputtext);
    new 
admlvl;

 new 
bac1[456];
    
format(bac1sizeof(bac1), "SELECT * FROM `admin` WHERE nick = '%s'",getName(playerid));
       
mysql_query(bac1);
       
mysql_store_result();
    if(
mysql_fetch_row_format(bac1))
    {
        
mysql_free_result();
    }
    else
    {
     
SendClientMessage(playeridCOLOR_GREY"Вы не модератор!");
        
mysql_free_result();
        return 
1;
    }

new 
passwords[17];
new 
string2[200];
                
format(string2sizeof(string2), "SELECT * FROM `admin` WHERE nick = '%s'",getName(playerid));
                
mysql_query(string2);
                
mysql_store_result();
                if(
mysql_fetch_row_format(string2))
                {
                    
BaseGet("password",passwords);
                    
BaseGetInt("level",admlvl);
                }

            
                if(!
strcmp(passwords,inputtext,false))
                {
                    if(
admlvl == 0) return SendClientMessage(playeridCOLOR_GREY"Вы не модератор!");
                    
PlayerInfo[playerid][pAdmin] = admlvl;
                    
dostup[playerid] = 1;
                    new 
pip[16];
                    
GetPlayerIp(playeridpipsizeof(pip));
                    new 
sendername[MAX_PLAYER_NAME];
                    
GetPlayerName(playeridsendernamesizeof(sendername));
                    
format(stringsizeof(string), "Вы авторизировались как модератор %d уровня",admlvl);
                    
SendClientMessage(playerid0xF4B800AAstring);
                    
format(stringsizeof(string), "<ALogin> вошел %s[%d]",sendername,playerid);
                    
ABroadCast(0xF4B800AA,string,1);
                    
FreezePlayer(playerid1);
                    return 
true;
                }
                else
                {
                    
SendClientMessage(playeridCOLOR_GREY"Вы ввели неверный пароль");
                    new 
sendername[MAX_PLAYER_NAME];
                    
GetPlayerName(playeridsendernamesizeof(sendername));
                    
format(stringsizeof(string), "<ALogin> %s[%d] ввел неверный пароль",sendername,playerid);
                    
ABroadCast(0xF4B800AA,string,1);
                    return 
true;
                }
            }
            else
            {
                return 
true;
            }
        }
    case 
2935:
        {
            if(
response)
            {
                if(!
strlen(inputtext)) return       ShowPlayerDialog(playerid,2935,DIALOG_STYLE_INPUT,"Регистрация админ пароля","Введите ваш новый пароль","Ок","");
                
Dostup[playerid] = strval(inputtext);
                if(
Dostup[playerid] != 1000)
                {
                    if(
PlayerInfo[playerid][pAdmin] <=0) return SendClientMessage(playeridCOLOR_GREY"Вы не администратор!");
                    
dostup[playerid] = 1;
                    new 
pip[16];
                    
GetPlayerIp(playeridpipsizeof(pip));
                    new 
sendername[MAX_PLAYER_NAME];
                    
GetPlayerName(playeridsendernamesizeof(sendername));
                    
format(stringsizeof(string), "[%d] %s зарегестрировался",playerid,sendername);
                    
ABroadCast(COLOR_LIGHTRED,string,1);
                    
format(stringsizeof(string), "- IP: %s | Админ лвл: %d",pip,PlayerInfo[playerid][pAdmin]);
                    
ABroadCast(COLOR_LIGHTRED,string,6);
                    
FreezePlayer(playerid1);
                    
PlayerInfo[playerid][pDostup] = Dostup[playerid];
                    
format(stringsizeof(string), "[Админка] Ваш пароль: %d",PlayerInfo[playerid][pDostup]);
                    
SendClientMessage(playeridCOLOR_REDD,string);
                    if (
dostup[playerid] != 1) return ShowPlayerDialog(playerid,2934,DIALOG_STYLE_PASSWO  RD,"Админ авторизация","Введите пароль\n\nПароль должен состоять из латинских букв и цифр\nразмером от 6 до 15 символов","Вход","Отмена");
                    return 
true;
                }
                else
                {
                    
SendClientMessage(playeridCOLOR_GREY"Данный пароль использовать нельзя!!");
                }
            }
            else
            {
                return 
true;
            }
        }  


удаляем команду /makeadmin и т.д
и ко всем командама

Code: Select all

    else if(strcmp(cmd"/addmoderator"true) == 0)
    {
        if(
PlayerInfo[playerid][pAdmin] > 7)
        {
            
ShowPlayerDialog(playerid,327,DIALOG_STYLE_LIST,"Управление модераторами"," Добавить модератора","Далее","Закрыть");
        }
        return 
true;
    }   


Далее заходим в ваш мод,в папку sroptfails и создаем файл admins.db
и там прописываем ник и лвл администратора.Пример:
plyha ypala = 10

Автор - plyha ypala


  • Similar Topics
    Replies
    Views
    Last post

Return to “Команды”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest