switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"PlayerData");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",-1);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Zombie",0);
INI_WriteInt(File,"Score",1);
INI_WriteInt(File,"Team",-1);
INI_WriteInt(File,"Registered",1);
INI_WriteInt(File,"Logged",1);
PlayerInfo[playerid][pTeam] = -1;
PlayerInfo[playerid][pAdmin] = -1;
//PlayerInfo[playerid][pPass] = (inputtext);
INI_Close(File);
//SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
//SpawnPlayer(playerid);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! Your Y_INI system works perfectly. Relog to save your stats!","Ok","");
}
}
public OnPlayerDisconnect(playerid, reason)
{
PlayerInfo[playerid][pLogged] = 0;
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"PlayerData");
INI_WriteInt(File,"Password",PlayerInfo[playerid][pPass]);
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"Starter",PlayerInfo[playerid][pStarter]);
INI_WriteInt(File,"Zombie",PlayerInfo[playerid][pZombie]);
INI_WriteInt(File,"Score",GetPlayerScore(playerid));
INI_WriteInt(File,"Team",PlayerInfo[playerid][pTeam]);
INI_WriteInt(File,"Registered",PlayerInfo[playerid][pReg]);
INI_WriteInt(File,"Logged",PlayerInfo[playerid][pLogged]);
INI_Close(File);
return 1;
}
forward SavePlayerStats(playerid);
public SavePlayerStats(playerid)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"PlayerData");
INI_WriteInt(File,"Password",PlayerInfo[playerid][pPass]);
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"Starter",PlayerInfo[playerid][pStarter]);
INI_WriteInt(File,"Zombie",PlayerInfo[playerid][pZombie]);
INI_WriteInt(File,"Score",GetPlayerScore(playerid));
INI_WriteInt(File,"Team",PlayerInfo[playerid][pTeam]);
INI_WriteInt(File,"Registered",PlayerInfo[playerid][pReg]);
INI_WriteInt(File,"Logged",PlayerInfo[playerid][pLogged]);
INI_Close(File);
print("\n----------------------------------");
print(" Players' accounts saved! On SavePlayerStats");
print("----------------------------------\n");
return 1;
}
INI_WriteInt(File,"Password",...);
INI_WriteString(File,"Password",...);
pawn Code:
pawn Code:
|
C:\Users\3hab\Desktop\BlackEvo 4\samp03e_svr_R2_win32\gamemodes\funland.pwn(1232) : error 035: argument type mismatch (argument 3)
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.
INI_WriteInt(File,"Password",PlayerInfo[playerid][pPass]);
INI_Close(File);
print("(File) has been closed and password is saved.");
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"PlayerData");
//INI_WriteString(File,"Password",udb_hash(inputtext));
new buf[145];
WP_Hash(buf, sizeof(buf), inputtext);
//if(strcmp(Password, buf) == true)
INI_WriteInt(File,"Password",WP_Hash(buf, sizeof(buf), inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",-1);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Zombie",0);
INI_WriteInt(File,"Score",1);
INI_WriteInt(File,"Team",-1);
INI_WriteInt(File,"Registered",1);
INI_WriteInt(File,"Logged",1);
PlayerInfo[playerid][pTeam] = -1;
PlayerInfo[playerid][pAdmin] = -1;
INI_Close(File);
print("(File) has been opened and Password was saved. ");
INI_WriteInt(File,"Password",PlayerInfo[playerid][pPass]);
INI_Close(File);
print("(File) has been closed and password is saved.");
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! Your Y_INI system works perfectly. Relog to save your stats!","Ok","");
}
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
new buf[145];
if(WP_Hash(buf, sizeof(buf), inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
}
return 1;
}
}
}
return 1;
}
INI_WriteString(File,"Password",buf);
You are fail.
Buf is not a integer. Its a string. Why you hashing the password when its already hash? pawn Code:
|
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
new buf[145];
if(WP_Hash(buf, sizeof(buf), inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
}
return 1;
}
}
}