error 035:argument type mismatch & error 033:array must be indexed
#1

PHP код:
FinalCNR.pwn(210) : error 035argument type mismatch (argument 3)
FinalCNR.pwn(233) : error 033: array must be indexed (variable "hash")
FinalCNR.pwn(271) : error 033: array must be indexed (variable "hash2")
FinalCNR.pwn(293) : error 035argument type mismatch (argument 3)
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
4 Errors
.
[
Finished in 6.4s with exit code 1
LINE 210
PHP код:
INI_WriteInt(File"Password"buf); 
LINE 233
PHP код:
if(hash == PlayerInfo[playerid][Pass]) 
LINE 271
PHP код:
if(hash2 == PlayerInfo[playerid][Pass]) 
LINE 293
PHP код:
INI_WriteInt(File"Password"hash3); 
Whole code

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    
    if(
dialogid == REGISTER)
    {
       if(!
strlen(inputtext)) return ShowPlayerDialog(playeridREGISTERDIALOG_STYLE_PASSWORD"{FFFF00}Register""{FF0000}You have to register.""Register""Quit");
       if(!
response) return Kick(playerid);
       if(
response)
       {
             new 
buf[129];
          new 
INI:File INI_Open(UserPath(playerid));
          
WP_Hash(buf,sizeof(buf),inputtext);
          
INI_WriteInt(File"Password"buf);
          
INI_Close(File);
          
PlayerPlaySound(playerid10570.00.00.0);
          
SendClientMessage(playerid0x00FF00FF"You registered succesfully.");
          new 
String[256], Name[MAX_PLAYER_NAME], ddmmyyhm;
          
GetPlayerName(playeridNamesizeof(Name));
          
getdate(yymmdd);
          
gettime(hm);
            
format(Stringsizeof(String), "{FFFFFF}Name: {FFFF00}%s\n{FFFFFF}Date: {FFFF00}%02d/%02d/%02d\n{FFFFFF}Time: {00FF00}%02d:%02d\n{FFFFFF}Password: {FFFF00}%s\n{00773C}Press f8 to screenshot of your registeration information(NOTE: this might be important later)."Nameddmmyyhminputtext);
          
ShowPlayerDialog(playerid,UNUSEDDIALOG_STYLE_MSGBOX"{00FF00}Registration info"String"Ok""");
          
DestroyRegistrationMenu(playerid);
       }
    }
    if(
dialogid == LOGIN)
    {
       if(!
response) return Kick(playerid);
       if(!
strlen(inputtext)) return ShowPlayerDialog(playeridLOGINDIALOG_STYLE_PASSWORD"{FF0000}Login""{FF0000}You have to login.""Login""Quit");
       if(
response)
       {
             new 
hash[129];
          
INI_ParseFile(UserPath(playerid), "PlayerData_%s", .bExtra true, .extra playerid);
          
WP_Hash(hash,sizeof(hash),inputtext);
          if(
hash == PlayerInfo[playerid][Pass])
          {
             
SpawnPlayer(playerid);
             
GivePlayerMoney(playeridPlayerInfo[playerid][Money]);
             
SetPlayerScore(playeridPlayerInfo[playerid][Score]);
             
PlayerPlaySound(playerid10570.00.00.0);
             
SendClientMessage(playerid0x00FF00FF"Logged in succesfully.");
             
DestroyRegistrationMenu(playerid);
          }
          else
          {
             if(
Attempts[playerid] <= 2)
             {
                
PlayerPlaySound(playerid10580.00.00.0);
                
Attempts[playerid] ++;
                new 
String[80];
                
format(Stringsizeof(String), "{FF0000}Wrong password {FFFF00}%d/3 {FFFFFF}attempts, left try again."Attempts[playerid]);
                
ShowPlayerDialog(playeridLOGINDIALOG_STYLE_PASSWORD"{FF0000}Login"String"Login""Quit");
             }
             if(
Attempts[playerid] == 3)
             {
                
PlayerPlaySound(playerid10580.00.00.0);
                
ShowPlayerDialog(playerid12DIALOG_STYLE_MSGBOX"{FF0000}Login fail""{FF0000}You have been kicked because you failed to login 3/3 attempts.""Ok""");
                
SetTimerEx("KickForBadLogin"500false"i"playerid);
                
DestroyRegistrationMenu(playerid);
             }
          }
       }
    }
    if(
dialogid == PASSCHANGE)
    {
       if(!
response) return SendClientMessage(playerid0xFF0000FF"You canceled login before password change.");
       if(!
strlen(inputtext)) return ShowPlayerDialog(playeridPASSCHANGEDIALOG_STYLE_PASSWORD"{00FF00}Change password""{FFFFFF}First confirm your old password to change password.""Confirm""Cancel");
       if(
response)
       {
             new 
hash2[129];
          
INI_ParseFile(UserPath(playerid), "PlayerData_%s", .bExtra true, .extra playerid);
          
WP_Hash(hash2,sizeof(hash2),inputtext);
          if(
hash2 == PlayerInfo[playerid][Pass])
          {
             
PlayerPlaySound(playerid10570.00.00.0);
             
SendClientMessage(playerid0x00FF00FF"Password correct!! You can change your password now.");
             
ShowPlayerDialog(playerid,PASSCHANGE2DIALOG_STYLE_PASSWORD"{00FF00}Change password""{00FF00}Change your password to whatever you want.""Done""Cancel");
          }
          else
          {
             
PlayerPlaySound(playerid10570.00.00.0);
             
SendClientMessage(playerid0xFF0000FF"Wrong password.");
          }
       }
    }
    if(
dialogid == PASSCHANGE2)
    {
       if(!
response) return SendClientMessage(playerid0xFF0000FF"You canceled password change.");
       if(!
strlen(inputtext)) return ShowPlayerDialog(playerid,PASSCHANGE2DIALOG_STYLE_PASSWORD"{00FF00}Change password""{00FF00}Change your password to whatever you want.""Done""Cancel");
       if(
response)
       {
             new 
hash3[129];
          new 
INI:File INI_Open(UserPath(playerid));
          
WP_Hash(hash3,sizeof(hash3),inputtext);
          
INI_WriteInt(File"Password"hash3);
          
INI_Close(File);
          
PlayerPlaySound(playerid10570.00.00.0);
          
SendClientMessage(playerid0x00FF00FF"Password changed succesfully.");
          new 
String[128];
          
format(Stringsizeof(String), "{FFFFFF}Password: {00FF00}%s\n{00773C}Press f8 to screenshot your new password."inputtext);
          
ShowPlayerDialog(playerid17DIALOG_STYLE_MSGBOX"{00FF00}New password info"String"Ok""");
       }
    }
    return 
1;

Thanks in advance
Reply
#2

LINE 210 & LINE 293
pawn Код:
INI_WriteInt(File, "Password", buf);
// WriteInt is only for Integers. I believe you're trying to save a string.
LINE 233 & LINE 271
pawn Код:
if(hash == PlayerInfo[playerid][Pass])
Use strcmp instead.
pawn Код:
if(!strcmp(hash,PlayerInfo[playerid][Pass]))
Reply
#3

Quote:
Originally Posted by introzen
Посмотреть сообщение
LINE 210 & LINE 293
pawn Код:
INI_WriteInt(File, "Password", buf);
// WriteInt is only for Integers. I believe you're trying to save a string.
LINE 233 & LINE 271
pawn Код:
if(hash == PlayerInfo[playerid][Pass])
Use strcmp instead.
pawn Код:
if(!strcmp(hash,PlayerInfo[playerid][Pass]))
silly me i forgot all about strcmp and password is string +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)