Admins don't save
#6

Quote:

#include <dini>

Quote:

enum pInfo
{
AdminLevel
}

Quote:

#define DIALOG_REGISTER 2
#define DIALOG_LOGIN 3

REGISTER/LOGIN SYSTEM with dini
PHP код:
public OnPlayerConnect(playerid)
{
 new 
pData[120];
    
mutedtime[playerid] = 0;
    
GetPlayerName(playeridpNameMAX_PLAYER_NAME);
    
format(pDatasizeof pData"/Accounts/%s.txt"pName);
    if(
dini_Exists(pData))
    {
        
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_INPUT"Login""Enter your password""Login""Cancel");
    }
    else
    {
        
ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_INPUT"Register""Fill in a password to register""Register""Cancel");
    }
    return 
1;

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
if(
dialogid==DIALOG_LOGIN)
    {
        if(
response==0)
        {
            
SendClientMessage(playeridCOLOR_RED"You have been automatically kicked from the server!");
            
Kick(playerid);
            return 
1;
        }
        if(
response==1)
        {
            if(!
strlen(inputtext))
            {
            
SendClientMessage(playeridCOLOR_RED"Enter your password!");
              
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_INPUT"Login""Enter your password""Login""Cancel");
            return 
1;
            }
            else
            {
              
Login(playeridinputtext);
            return 
1;
            }
        }
    }
    if(
dialogid==DIALOG_REGISTER)
    {
        if(
response==0)
        {
            
SendClientMessage(playeridCOLOR_RED"You have been automatically kicked from the server!");
            
Kick(playerid);
            return 
1;
        }
        if(
response==1)
        {
            if(!
strlen(inputtext))
            {
                
SendClientMessage(playeridCOLOR_RED"Fill in a password to register!");
                
ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_INPUT"Register""Fill in a password to register""Register""Cancel");
                return 
1;
            }
            else
            {
                
Register(playeridinputtext);
                return 
1;
            }
        }
    } 
Setadmin cmd
PHP код:
CMD:setadmin(playeridparams[])
{
    if(!
IsPlayerAdmin(playerid)) return 0;
    new 
targetplayerpName[MAX_PLAYER_NAME], pName2[MAX_PLAYER_NAME], string[150], Levels;
    if(
sscanf(params"ui"targetplayerLevels)) return SendClientMessage(playeridCOLOR_ORANGE"Usage: /setadmin [ID] [Level 1-5]");
    if(
Levels || Levels 5) return SendClientMessage(playeridCOLOR_RED"Error: Available admin levels [1 - 5]");
    if(!
IsPlayerConnected(targetplayer)) return SendClientMessage(playeridCOLOR_RED"Error: Player is not connected!");
    if(
PlayerInfo[targetplayer][AdminLevel] == Levels) return SendClientMessage(playeridCOLOR_RED"Error: The player is already this admin level.");
    
GetPlayerName(playeridpNameMAX_PLAYER_NAME);
    
GetPlayerName(targetplayerpName2MAX_PLAYER_NAME);
    
format(stringsizeof string"%s has set your admin level to %d."pNameLevels);
    
SendClientMessage(targetplayerCOLOR_GREENstring);
    
format(stringsizeof string"You have set %s his admin level to %d."pName2Levels);
    
SendClientMessage(playeridCOLOR_WHITEstring);
    
PlayerInfo[targetplayer][AdminLevel] = Levels;
    return 
1;

NOTE: I've got an "Accounts" folder in my scriptfiles.
Reply


Messages In This Thread
Admins don't save - by saffierr - 07.09.2015, 10:10
Re: Admins don't save - by Gangster-rocks - 07.09.2015, 10:24
Re: Admins don't save - by saffierr - 07.09.2015, 10:27
Re: Admins don't save - by jlalt - 07.09.2015, 10:29
Re: Admins don't save - by Gangster-rocks - 07.09.2015, 10:33
Re: Admins don't save - by saffierr - 07.09.2015, 10:37
Re: Admins don't save - by Gangster-rocks - 07.09.2015, 10:38
Re: Admins don't save - by saffierr - 07.09.2015, 10:39
Re: Admins don't save - by jlalt - 07.09.2015, 10:42
Re: Admins don't save - by jlalt - 07.09.2015, 17:27

Forum Jump:


Users browsing this thread: 1 Guest(s)