Admin error
#1

I can't understand why it is giving me errors
Ignore everything NOT related to Admins stuff

PHP код:
public OnPlayerConnect(playerid)
{
                                                
// Map ICONS
    
SetPlayerMapIcon(playerid121365.3500,-1279.0601,13.546960MAPICON_LOCAL); // Ammu - LS
    
SetPlayerMapIcon(playerid112386.7107,1043.2142,10.8203420MAPICON_LOCAL); // Transfender - LV
    
SetPlayerMapIcon(playerid132156.5127,943.2316,10.820360MAPICON_LOCAL); // Ammu - LV
    
SetPlayerMapIcon(playerid102114.8137,921.0313,10.8203510MAPICON_LOCAL); // Gas station - Com a lot
    
SetPlayerMapIcon(playerid142023.2521,1007.5231,10.8203430MAPICON_LOCAL); // 4D Casino
    
SetPlayerMapIcon(playerid152193.5527,1677.0909,12.3672440MAPICON_LOCAL); // Caligula's Casino
    
SetPlayerMapIcon(playerid91970.1549,2161.5730,11.0703630MAPICON_LOCAL); // Pay n Spray LV
    
SetPlayerMapIcon(playerid162191.9939,1991.2040,12.0938380MAPICON_LOCAL); // 24/7 The strip
    
new string[350], pName[MAX_PLAYER_NAME];
    
GetPlayerName(playeridpNameMAX_PLAYER_NAME);
    
format(stringsizeof string"%s is connected to the server."pName);
    
SendClientMessageToAll(COLOR_GREYstring);
    new 
pData[120];
    
mutedtime[playerid] = 0;
    
GetPlayerName(playeridpNameMAX_PLAYER_NAME);
    
format(pDatasizeof pData"/Accounts/%s.txt"pName);
    if(
dini_Exists(pData))
    new 
Administrators[120];
    
format(Administratorssizeof Administrators"/Administrators/%s.txt"pName);
    if(
dini_Exists(Administrators))
    {
        
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;

I am not quite sure, but I am trying to save my admins, so I created a stock

PHP код:
stock Admins(playeridadminlevel[])
{
    new 
Administrators[120];
    new 
pName[MAX_PLAYER_NAME];
    
GetPlayerName(playeridpNameMAX_PLAYER_NAME);
    
format(Administratorssizeof Administrators"/Administrators/%s.txt"pName);
    
dini_Create(Administrators);
    
dini_Set(Administrators"AdminLevel"adminlevel);
    return 
1;

Errors:
Quote:

error 003: declaration of a local variable must appear in a compound block
error 017: undefined symbol "Administrators"
warning 215: expression has no effect
error 001: expected token: ";", but found "]"
fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

On this line:
PHP код:
    new Administrators[120]; 
Please help,
Reply
#2

PHP код:
public OnPlayerConnect(playerid)
{
                                                
// Map ICONS
    
SetPlayerMapIcon(playerid121365.3500,-1279.0601,13.546960MAPICON_LOCAL); // Ammu - LS
    
SetPlayerMapIcon(playerid112386.7107,1043.2142,10.8203420MAPICON_LOCAL); // Transfender - LV
    
SetPlayerMapIcon(playerid132156.5127,943.2316,10.820360MAPICON_LOCAL); // Ammu - LV
    
SetPlayerMapIcon(playerid102114.8137,921.0313,10.8203510MAPICON_LOCAL); // Gas station - Com a lot
    
SetPlayerMapIcon(playerid142023.2521,1007.5231,10.8203430MAPICON_LOCAL); // 4D Casino
    
SetPlayerMapIcon(playerid152193.5527,1677.0909,12.3672440MAPICON_LOCAL); // Caligula's Casino
    
SetPlayerMapIcon(playerid91970.1549,2161.5730,11.0703630MAPICON_LOCAL); // Pay n Spray LV
    
SetPlayerMapIcon(playerid162191.9939,1991.2040,12.0938380MAPICON_LOCAL); // 24/7 The strip
    
new string[350], pName[MAX_PLAYER_NAME];
    
GetPlayerName(playeridpNameMAX_PLAYER_NAME);
    
format(stringsizeof string"%s is connected to the server."pName);
    
SendClientMessageToAll(COLOR_GREYstring);
    new 
pData[120];
    
mutedtime[playerid] = 0;
    
GetPlayerName(playeridpNameMAX_PLAYER_NAME);
    
format(pDatasizeof pData"/Accounts/%s.txt"pName);
    if(
dini_Exists(pData)) {
    new 
Administrators[120];
    
format(Administratorssizeof Administrators"/Administrators/%s.txt"pName);
    if(
dini_Exists(Administrators))
    {
        
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;

Код:
if(dini_Exists(pData))
you miss to put { after if(dini_Exists(pData))
should be like:
PHP код:
if(dini_Exists(pData)) { 
Reply
#3

jhalt, Thank you for your reply, although it didn't fix it. BUT(Due to you, I tried puzzling, and Errors were fixed.)
New Code: I created a folder with "Administrators" in scriptfiles also.
PHP код:
public OnPlayerConnect(playerid)
{
                                                
// Map ICONS
    
new Administrators[120], pName[MAX_PLAYER_NAME];
    
GetPlayerName(playeridpNameMAX_PLAYER_NAME);
    
format(Administratorssizeof Administrators"/Administrators/%s.txt"pName);
    if(
dini_Exists(Administrators))
            
    
SetPlayerMapIcon(playerid121365.3500,-1279.0601,13.546960MAPICON_LOCAL); // Ammu - LS
    
SetPlayerMapIcon(playerid112386.7107,1043.2142,10.8203420MAPICON_LOCAL); // Transfender - LV
    
SetPlayerMapIcon(playerid132156.5127,943.2316,10.820360MAPICON_LOCAL); // Ammu - LV
    
SetPlayerMapIcon(playerid102114.8137,921.0313,10.8203510MAPICON_LOCAL); // Gas station - Com a lot
    
SetPlayerMapIcon(playerid142023.2521,1007.5231,10.8203430MAPICON_LOCAL); // 4D Casino
    
SetPlayerMapIcon(playerid152193.5527,1677.0909,12.3672440MAPICON_LOCAL); // Caligula's Casino
    
SetPlayerMapIcon(playerid91970.1549,2161.5730,11.0703630MAPICON_LOCAL); // Pay n Spray LV
    
SetPlayerMapIcon(playerid162191.9939,1991.2040,12.0938380MAPICON_LOCAL); // 24/7 The strip
    
new string[350];
    
format(stringsizeof string"%s is connected to the server."pName);
    
SendClientMessageToAll(COLOR_GREYstring);
    new 
pData[120];
    
mutedtime[playerid] = 0;
    
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 код:
stock Admins(playeridadminlevel[])
{
    new 
Administrators[120];
    new 
pName[MAX_PLAYER_NAME];
    
GetPlayerName(playeridpNameMAX_PLAYER_NAME);
    
format(Administratorssizeof Administrators"/Administrators/%s.txt"pName);
    
dini_Create(Administrators);
    
dini_Set(Administrators"AdminLevel"adminlevel);
    return 
1;

BUT, as I thought, the admins are still not saved when they re-connect. Although I've got no errors, I think I have to implement more into the script to have it saved. Anyone ? What do I miss?
Reply
#4

try this ?
PHP код:
public OnPlayerConnect(playerid)
{
    
PlayerInfo[playerid][AdminLevel] = 0;
    
    new 
Administrators[120];
    new 
pName[MAX_PLAYER_NAME];
    
GetPlayerName(playeridpNameMAX_PLAYER_NAME);
    
format(Administratorssizeof Administrators"/Administrators/%s.txt"pName);
    if(!
dini_Exists(Administrators)) {
    
dini_Create(Administrators);
    
dini_IntSet(Administrators"AdminLevel",0);
    }
    return 
1;
}

// and put loadplayer(playerid); in your dialog login code
loadplayer(playerid)
{
PlayerInfo[playerid][Deaths] = (dini_Set(Administrators,"AdminLevel",PlayerInfo[playerid][AdminLevel]);

Reply
#5

Where...?
PHP код:
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;
            }
        }
    } 
Reply
#6

can you show where Login(playerid give response?
Reply
#7

What do you mean?
Reply
#8

search for Login(playerid and tell me what you will find
Reply
#9

This is what I find....
a stock
PHP код:
stock Login(playeridkey[])
{
    new 
pData[120];
    new 
pName[MAX_PLAYER_NAME];
    
GetPlayerName(playeridpNameMAX_PLAYER_NAME);
    
format(pDatasizeof pData"/Accounts/%s.txt"pName);
    if(!
strcmp(keydini_Get(pData"Password"), false))
    {
        
SetPlayerScore(playeriddini_Int(pData"Level"));
        
SendClientMessage(playeridCOLOR_WHITE"Your account has been restored!");
    }
    else
    {
        
SendClientMessage(playeridCOLOR_RED"Password incorrect!");
         
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_INPUT"Login""Enter your password""Login""Cancel");
         return 
1;
    }
    return 
1;

Reply
#10

try to use this:
PHP код:
stock Login(playeridkey[])
{
    new 
pData[120],Administrators[120];
    new 
pName[MAX_PLAYER_NAME];
    
GetPlayerName(playeridpNameMAX_PLAYER_NAME);
    
format(pDatasizeof pData"/Accounts/%s.txt"pName);
    
format(Administratorssizeof Administrators"/Administrators/%s.txt"pName);
    if(!
strcmp(keydini_Get(pData"Password"), false))
    {
        
SetPlayerScore(playeriddini_Int(pData"Level"));
        
PlayerInfo[playerid][AdminLevel] = dini_Int(Administrators,"AdminLevel",PlayerInfo[playerid][AdminLevel]);
        
SendClientMessage(playeridCOLOR_WHITE"Your account has been restored!");
    }
    else
    {
        
SendClientMessage(playeridCOLOR_RED"Password incorrect!");
         
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_INPUT"Login""Enter your password""Login""Cancel");
         return 
1;
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)