Makeadmin with security cod
#4

Here you go, combined with Codys command

PHP код:
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(playeridparams[]) //credits Cody
{
    if(
PlayerInfo[playerid][pAdmin] < 7)
        return 
SendClientMessage(playeridCOLOR_BLUE"You don't have acces to that command.");
    new 
idstring[128], level;
    if(
sscanf(params"dd"idlevel))
        return 
SendClientMessage(playeridCOLOR_RED"SERVER: /makeadmin [ID] [LEVEL]");
    
//ShowPlayerDialog(id,DIALOG_ADMINBOX,DIALOG_STYLE_MSGBOX, "You are an admin", string, "Ok", "");
    
format(stringsizeof(string), "%s promoted you to level %i."PlayerName(playerid), level);
    
SendClientMessage(idCOLOR_BLUEstring);
    
PlayerInfo[id][pAdmin] = level;
    
GiveAdminCode(id); //Giving them a code
    
return 1;

EDIT: translated to English + fixed the code,
Reply


Messages In This Thread
Makeadmin with security cod [ solved] - by Deny1 - 26.01.2016, 22:54
Re: Makeadmin with security cod - by Mikeydoo - 26.01.2016, 23:17
Re: Makeadmin with security cod - by itsCody - 26.01.2016, 23:30
Re: Makeadmin with security cod - by TwinkiDaBoss - 27.01.2016, 00:34
Re: Makeadmin with security cod - by itsCody - 27.01.2016, 01:02
Re: Makeadmin with security cod - by Deny1 - 27.01.2016, 15:29
Re: Makeadmin with security cod - by Deny1 - 27.01.2016, 15:42
Re: Makeadmin with security cod - by Deny1 - 27.01.2016, 17:16

Forum Jump:


Users browsing this thread: 2 Guest(s)