Makeadmin saving security cod
#1

Код:
new AdminKod[MAX_PLAYERS], 
    AdminLogovan[MAX_PLAYERS]; 

GiveAdminCode(playerid) { //When promoting, use 
    new rr = randomEx(1000,999999); 
    new string[128]; 
    format(string,sizeof(string),"Your admin code is %i",rr); 
    SendClientMessage(playerid,COLOR_RED,string); 
    AdminKod[playerid] = rr; 
    return true; 
} 


CMD:login(playerid,params[]) { //how to login as administrator 
    new nmr; 
    if(sscanf(params,"i",nmr)) return SendClientMessage(playerid,COLOR_RED,"Usage: /login [admin code]"); 
    if(nmr != AdminKod[playerid]) return SendClientMessage(playerid,COLOR_RED,"Wrong admin code"); 
    AdminLogovan[playerid] = 1; //admin logged in  
    SendClientMessage(playerid,COLOR_RED,"You have logged in as administrator!"); 
    return true; 
} 

CMD:makeadmin(playerid, params[]) //credits Cody 
{ 
    if(PlayerInfo[playerid][pAdmin] < 7) 
        return SendClientMessage(playerid, COLOR_BLUE, "You don't have acces to that command."); 

    new id, string[128], level; 
    if(sscanf(params, "dd", id, level)) 
        return SendClientMessage(playerid, COLOR_RED, "SERVER: /makeadmin [ID] [LEVEL]"); 

    //ShowPlayerDialog(id,DIALOG_ADMINBOX,DIALOG_STYLE_MSGBOX, "You are an admin", string, "Ok", ""); 
    format(string, sizeof(string), "%s promoted you to level %i.", PlayerName(playerid), level); 
    SendClientMessage(id, COLOR_BLUE, string); 
    PlayerInfo[id][pAdmin] = level; 
    GiveAdminCode(id); //Giving them a code 
    return 1; 
}
This is now makeadmin cmd but now problem is when player relog and try to use /login [code] he get error scm You don't have acces to that command
Reply


Messages In This Thread
Makeadmin saving security cod [ solved] - by Deny1 - 27.01.2016, 17:25
Re: Makeadmin saving security cod - by rambalili2 - 27.01.2016, 17:45
Re: Makeadmin saving security cod - by itsCody - 27.01.2016, 18:02

Forum Jump:


Users browsing this thread: 2 Guest(s)