23.01.2014, 14:13
(
Последний раз редактировалось MattTucker; 23.01.2014 в 15:10.
Причина: typos.
)
So, I decided to create a scratch gamemode and things were going pretty well until I started doing the saving/loading system. I tried scripting it with y_ini, SII, dini and they all showed the same problem.
When I login, and I type in the password, somehow it seems that I am getting kicked without being kicked.
Let me explain it, it means it doesn't say "Server closed connection." nor anything, just no commands working - nothing going like the AntiSpawn kill message for example, tried removing any kind of loading/saving system worked pretty good.
I suppose the bug is in the loading part, as for registering, I can register, functions are working pretty good, nothing wierd happens.
So, here you go...
On player connect part:
OnDialogResponse part:
LoadAccount part:
If anything else is needed, I am ready to post.
When I login, and I type in the password, somehow it seems that I am getting kicked without being kicked.
Let me explain it, it means it doesn't say "Server closed connection." nor anything, just no commands working - nothing going like the AntiSpawn kill message for example, tried removing any kind of loading/saving system worked pretty good.
I suppose the bug is in the loading part, as for registering, I can register, functions are working pretty good, nothing wierd happens.
So, here you go...
On player connect part:
pawn Код:
new str[150], file[70];
format(file, sizeof(file), "users/%s.ini", BFN(playerid));
if(!dini_Exists(file))
{
format(str, sizeof(str), "Welcome back %s to BattleField Deathmatch!\n Please enter your password below to login.", BFN(playerid));
ShowPlayerDialog(playerid, logd, DIALOG_STYLE_PASSWORD,"Welcome back!", str, "Okay", "Quit");
}
pawn Код:
if(dialogid == logd)
{
new str[150];
if(response)
{
if(strlen(inputtext) < 3)
{
format(str, sizeof(str), "Welcome back %s to BattleField Deathmatch!\n Please enter your password below to login.", BFN(playerid));
ShowPlayerDialog(playerid, logd, DIALOG_STYLE_PASSWORD,"Password too short!", str, "Okay", "Quit");
return 1;
}
if(sscanf(inputtext, "s[51]", inputtext))
{
format(str, sizeof(str), "Welcome back %s to BattleField Deathmatch!\n Please enter your password below to login.", BFN(playerid));
ShowPlayerDialog(playerid, logd, DIALOG_STYLE_PASSWORD,"Password too short!", str, "Okay", "Quit");
return 1;
}
new file[64], password[51];
format(file, sizeof(file), "users/%s.ini", BFN(playerid));
format(password, sizeof(password), "%s", dini_Get(file, "Password"));
if(strcmp(inputtext, password, false) == 0)
{
LoadAccount(playerid);
}
else
{
format(str, sizeof(str), "Welcome back %s to BattleField Deathmatch!\n Please enter your password below to login.", BFN(playerid));
ShowPlayerDialog(playerid, logd, DIALOG_STYLE_PASSWORD,"Wrong Password!", str, "Okay", "Quit");
return 1;
}
}
else
{
SendClientMessage(playerid, red, "You have decided to quit the server.");
Kick(playerid);
return 1;
}
}
pawn Код:
stock LoadAccount(playerid)
{
new file[64];
format(file, sizeof(file), "users/%s.ini", BFN(playerid));
PInfo[playerid][Admin] = dini_Int(file, "Admin");
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, dini_Int(file, "Money"));
SetPlayerScore(playerid, dini_Int(file, "Score"));
PInfo[playerid][Kills] = dini_Int(file, "Kills");
PInfo[playerid][Death] = dini_Int(file, "Death");
PInfo[playerid][Rank] = dini_Int(file, "Rank");
return 1;
}