Makeadmin with security cod
#5

Or, if you wanted to, you could also assign random numbers and characters and save them.

PHP код:
CMD:makeadmin(playeridparams[])  

    new 
idstring[128], levelcode[5];
    
randomString(code5);
    if(
PlayerInfo[playerid][pAdmin] < 7)  
        return 
SendClientMessage(playeridCOLOR_BLUE"You don't have acces to that command.");  
  
    if(
sscanf(params"ii"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;  
    
PlayerInfo[id][pCode] = code// Assigns the random 5 character code to the player variable
    
return 1;  
}
PlayerName(playerid

    new 
name[21]; 
    
GetPlayerName(playeridnamesizeof(name)); 
    return 
name
}  
randomString(strDest[], strLen 10// ( https://sampforum.blast.hk/showthread.ph...pid1349155 )
{
    while(
strLen--)
        
strDest[strLen] = random(2) ? (random(26) + (random(2) ? 'a' 'A')) : (random(10) + '0');
}
/*
    And inside of admin commands you can do shit like
    if(!PlayerInfo[playerid][pUsedCode]) return Errormessage..
*/ 
Add pCode, and pUsedCode (or whatever) inside of your PlayerInfo enum, and add it to saving it, and loading it. as a string. All you have to do is work out the login command and/or dialog.

You can do it however you like, but that's similar how I would do it.
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: 1 Guest(s)