03.08.2011, 18:08
Alright hey guys!
I just did what Lorenc wrote in his tutorial..
And for there is no errors/warnings.
When i just connect it shows me the Register dialog.
And when i enter the password in that dialog after that nothing.
And i got everything correct + save file is there.
Here's my code:
And after that this:
OnPlayerConnect:
OnPlayerDisconnect:
And OnDialogResponse:
You can test it too, and see there is no errors or anything but it just does not work.
So please fix it for me.
I really don't understand this.
Thanks.
Davz~
I just did what Lorenc wrote in his tutorial..
And for there is no errors/warnings.
When i just connect it shows me the Register dialog.
And when i enter the password in that dialog after that nothing.
And i got everything correct + save file is there.
Here's my code:
pawn Код:
enum pInfo
{
pAdminLevel,
pCash,
pKills,
pDeaths,
pPass,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
new gPlayerLogged[MAX_PLAYERS];
pawn Код:
#define SERVER_USER_FILE "Users/%s.ini"
pawn Код:
gPlayerLogged[playerid] = 0;
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if (!dini_Exists(file))
{
ShowPlayerDialog(playerid, 2196, DIALOG_STYLE_INPUT, "{00FF00}Register Account.", "{00FF00}Welcome {F88017}to {FF0000}'FlatronX Gaming Offical [.R.U.] Server'\n\nPlease {00FF00}'Register' {F88017}your {00FF00}'Account' {F88017}to get started.", "Register", "Later");
}
if(fexist(file))
{
ShowPlayerDialog(playerid, 7407, DIALOG_STYLE_INPUT, "{00FF00}Succes!", "Thank you for regestering an {00FF00}'Account'..\n\n{F88017}Now its your wish to {00FF00}'Login' {F88017}your {00FF00}'Account' {F88017}or {FF0000}NOT.", "Login", "Later");
}
pawn Код:
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if(gPlayerLogged[playerid] == 1)
{
dini_IntSet(file, "Kills", PlayerInfo[playerid][pKills]);
dini_IntSet(file, "Deaths", PlayerInfo[playerid][pDeaths]);
dini_IntSet(file, "Money", PlayerInfo[playerid][pCash]);
dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel]);
dini_IntSet(file, "Password", PlayerInfo[playerid][pPass]);
}
gPlayerLogged[playerid] = 0;
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == 1)
{
new name[MAX_PLAYER_NAME], file[256], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if(!response) return SendClientMessage(playerid, 0xFF0000FF, "You skiped to register, Please type '/Register' to receive the dialog again.");
if (!strlen(inputtext)) return
ShowPlayerDialog(playerid, 2196, DIALOG_STYLE_INPUT, "{00FF00}Register Account.", "{00FF00}Welcome {F88017}to {FF0000}'FlatronX Gaming Offical [.R.U.] Server'\n\nPlease {00FF00}'Register' {F88017}your {00FF00}'Account' {F88017}to get started.", "Register", "Later");
dini_IntSet(file, "Password", udb_hash(inputtext));
dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel] = 0);
dini_IntSet(file, "Money",PlayerInfo[playerid][pCash] = 500);
dini_IntSet(file, "Kills",PlayerInfo[playerid][pKills] = 0);
dini_IntSet(file, "Deaths",PlayerInfo[playerid][pDeaths] = 0);
format(string, 2134, "Server: You {00FF00}'Succesfully Registered' {F88017}the {FF0000}'Nickname' %s {F88017}with {00FF00}'Password' %s.. You also been autologged in.", name, inputtext);
SendClientMessage(playerid, 0xF88017FF, string);
gPlayerLogged[playerid] = 1;
}
if (dialogid == 2)
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if(!response) return Kick(playerid);
if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2196, DIALOG_STYLE_INPUT, "{00FF00}Register Account.", "{00FF00}Welcome {F88017}to {FF0000}'FlatronX Gaming Offical [.R.U.] Server'\n\nPlease {00FF00}'Register' {F88017}your {00FF00}'Account' {F88017}to get started.", "Register", "Later");
new tmp;
tmp = dini_Int(file, "Password");
if(udb_hash(inputtext) != tmp) {
SendClientMessage(playerid, 0xFF0000FF, "The password you entered is 'Incorrect'.");
ShowPlayerDialog(playerid, 7407, DIALOG_STYLE_INPUT, "{00FF00}Succes!", "Thank you for regestering an {00FF00}'Account'..\n\n{F88017}Now its your wish to {00FF00}'Login' {F88017}your {00FF00}'Account' {F88017}or {FF0000}NOT.", "Login", "Later");
}
else
{
gPlayerLogged[playerid] = 1;
PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
PlayerInfo[playerid][pDeaths] = dini_Int(file, "Deaths");
SetPlayerScore(playerid, PlayerInfo[playerid][pKills]);
GivePlayerMoney(playerid, dini_Int(file, "Money")-GetPlayerMoney(playerid));
SendClientMessage(playerid,0x00FF00FF, "[SYSTEM]: Successfully logged in!");
}
}
return 1;
}
So please fix it for me.
I really don't understand this.
Thanks.
Davz~