20.03.2016, 10:52
PHP код:
FinalCNR.pwn(210) : error 035: argument 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 035: argument type mismatch (argument 3)
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
4 Errors.
[Finished in 6.4s with exit code 1]
PHP код:
INI_WriteInt(File, "Password", buf);
PHP код:
if(hash == PlayerInfo[playerid][Pass])
PHP код:
if(hash2 == PlayerInfo[playerid][Pass])
PHP код:
INI_WriteInt(File, "Password", hash3);
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == REGISTER)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, REGISTER, DIALOG_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(playerid, 1057, 0.0, 0.0, 0.0);
SendClientMessage(playerid, 0x00FF00FF, "You registered succesfully.");
new String[256], Name[MAX_PLAYER_NAME], dd, mm, yy, h, m;
GetPlayerName(playerid, Name, sizeof(Name));
getdate(yy, mm, dd);
gettime(h, m);
format(String, sizeof(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).", Name, dd, mm, yy, h, m, inputtext);
ShowPlayerDialog(playerid,UNUSED, DIALOG_STYLE_MSGBOX, "{00FF00}Registration info", String, "Ok", "");
DestroyRegistrationMenu(playerid);
}
}
if(dialogid == LOGIN)
{
if(!response) return Kick(playerid);
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, LOGIN, DIALOG_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(playerid, PlayerInfo[playerid][Money]);
SetPlayerScore(playerid, PlayerInfo[playerid][Score]);
PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
SendClientMessage(playerid, 0x00FF00FF, "Logged in succesfully.");
DestroyRegistrationMenu(playerid);
}
else
{
if(Attempts[playerid] <= 2)
{
PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
Attempts[playerid] ++;
new String[80];
format(String, sizeof(String), "{FF0000}Wrong password {FFFF00}%d/3 {FFFFFF}attempts, left try again.", Attempts[playerid]);
ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "{FF0000}Login", String, "Login", "Quit");
}
if(Attempts[playerid] == 3)
{
PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
ShowPlayerDialog(playerid, 12, DIALOG_STYLE_MSGBOX, "{FF0000}Login fail", "{FF0000}You have been kicked because you failed to login 3/3 attempts.", "Ok", "");
SetTimerEx("KickForBadLogin", 500, false, "i", playerid);
DestroyRegistrationMenu(playerid);
}
}
}
}
if(dialogid == PASSCHANGE)
{
if(!response) return SendClientMessage(playerid, 0xFF0000FF, "You canceled login before password change.");
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, PASSCHANGE, DIALOG_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(playerid, 1057, 0.0, 0.0, 0.0);
SendClientMessage(playerid, 0x00FF00FF, "Password correct!! You can change your password now.");
ShowPlayerDialog(playerid,PASSCHANGE2, DIALOG_STYLE_PASSWORD, "{00FF00}Change password", "{00FF00}Change your password to whatever you want.", "Done", "Cancel");
}
else
{
PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
SendClientMessage(playerid, 0xFF0000FF, "Wrong password.");
}
}
}
if(dialogid == PASSCHANGE2)
{
if(!response) return SendClientMessage(playerid, 0xFF0000FF, "You canceled password change.");
if(!strlen(inputtext)) return ShowPlayerDialog(playerid,PASSCHANGE2, DIALOG_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(playerid, 1057, 0.0, 0.0, 0.0);
SendClientMessage(playerid, 0x00FF00FF, "Password changed succesfully.");
new String[128];
format(String, sizeof(String), "{FFFFFF}Password: {00FF00}%s\n{00773C}Press f8 to screenshot your new password.", inputtext);
ShowPlayerDialog(playerid, 17, DIALOG_STYLE_MSGBOX, "{00FF00}New password info", String, "Ok", "");
}
}
return 1;
}