30.04.2014, 05:04
I have made some changes after my previous topic. Yet, I'm still having the same problem.
The 'bug' occurs after I restart my server.
Here's the updated script:
OnGameModeExit:
OnPlayerConnect:
DIALOG_LOGIN
If you need more, just let me know.
Helpers +rep
OnPlayerConnect:
LOGIN_DIALOG:
The 'bug' occurs after I restart my server.
Here's the updated script:
OnGameModeExit:
pawn Код:
public OnGameModeExit()
{
for (new i = 0; i != MAX_PLAYERS; ++i)
{
if (IsPlayerConnected(i))
{
SavePlayer(i);
}
}
return 1;
}
pawn Код:
public OnPlayerConnect(pID)
{
TogglePlayerSpectating(pID,1);
TogglePlayerControllable(pID,0);
SetPlayerCameraPos(pID, 1982.5140,-1703.8862,124.3137);
SetPlayerCameraLookAt(pID, 1765.5276,-1451.8524,137.7477);
new name1[MAX_PLAYER_NAME], string[2048], logstring[256];
new day, month, year;
new hour, minute, second;
if(!IsValidName(pID))
{
format(string, sizeof(string), "[AdmCmd] %s has been kicked by Vagismajis, reason: Inappropiate name", name1);
SendClientMessage(pID, COLOR_LIGHTRED, "You've been kicked by Vagismajis, reason: Inappropiate name, remove all numbers and special characters!");
new INI:File = INI_Open(UserPath(pID));
INI_RemoveEntry(File, UserPath(pID));
INI_Close(File);
SetTimerEx("kickbugfix", 1000, false, "i", pID);
getdate(day, month, year);
gettime(hour, minute, second);
format(logstring, sizeof(logstring), "[AdmCmd] %s has been kicked by Vagismajis, reason: Inappropiate name [%d-%d-%d](%d:%d:%d)", name1, day, month, year, hour, minute, second);
KickLog(logstring);
}
if(IsValidName(pID))
{
if(fexist(UserPath(pID)) || gPlayerRegistered[pID] == 1)
{
INI_ParseFile(UserPath(pID), "LoadUser_%s", .bExtra = true, .extra = pID);
ShowPlayerDialog(pID, DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","{FFFFFF}Welcome back to {00FF26}West Coast Life Roleplay!{FFFFFF}\n\nThat name is registered. Please enter your password below.","Login","Quit"); //login
}
else
{
format(string, sizeof(string), "{FFFFFF}Welcome %s to {00FF00}West Coast Life Roleplay!{FFFFFF}\n\nThe registration process will be as following:\n\nStep 1: Agreement on server rules.\nStep 2: Password selection.\nStep 3: Age selection.\nStep 4: A roleplay test that consists out of 5 random questions.\n\nGood luck!\n Kind regards, the WCL community!", GetName(pID));
ShowPlayerDialog(pID, DIALOG_REGISTER, DIALOG_STYLE_MSGBOX, "West Coast Life Roleplay",string, "Continue", "Quit");
}
if(gPlayerLogged[pID] == 1)
{
SpawnPlayer(pID);
}
}
ResetPlayerCash(pID);
return 1;
}
pawn Код:
if(dialogid == DIALOG_LOGIN) // login
{
if(!response) return Kick(pID);
if(response)
{
if(udb_hash(inputtext) == PlayerInfo[pID][pPass])
{
INI_ParseFile(UserPath(pID), "LoadUser_%s", .bExtra = true, .extra = pID);
gPlayerLogged[pID] = 1;
SetSpawnInfo(pID, 0, PlayerInfo[pID][pSkin], PlayerInfo[pID][pLastX], PlayerInfo[pID][pLastY], PlayerInfo[pID][pLastZ], PlayerInfo[pID][pFacingAngle], 0, 0, 0, 0, 0, 0);
SpawnPlayer(pID);
GivePlayerCash(pID, PlayerInfo[pID][pCash]);
SetPlayerScore(pID, PlayerInfo[pID][pLevel]);
SetPlayerHealth(pID, PlayerInfo[pID][pHealth]);
SetPlayerArmour(pID, PlayerInfo[pID][pArmour]);
SetPlayerInterior(pID, PlayerInfo[pID][pInt]);
SetPlayerVirtualWorld(pID, PlayerInfo[pID][pVW]);
format(tmp2, sizeof(tmp2), "~g~Welcome ~n~~w~ %s", GetName(pID));
GameTextForPlayer(pID, tmp2, 5000, 1);
TogglePlayerSpectating(pID, 0);
SetPlayerColor(pID, TRANSPARENT_WHITE);
if(PlayerInfo[playerid][pAdmin] >= 1)
{
format(tmp2, sizeof(tmp2), "[SERVER] You are logged in as a Level %d Admin.",PlayerInfo[playerid][pAdmin]);
SendClientMessage(playerid, COLOR_WHITE,tmp2);
}
return 1;
}
else
{
ShowPlayerDialog(pID, DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","{FFFFFF}Welcome back to {00FF26}West Coast Life Roleplay!{FFFFFF}\n\nThat name is registered. Please enter your password below.\n\n{FF0000} You have entered an incorrect password!","Login","Quit"); //login
return 1;
}
}
return 1;
}
Helpers +rep
Quote:
Originally Posted by Previous topic
Hello folks
I'm having a weird bug with my Login Dialog. When I make a new account everything works, logging off and back in and loading the correct information works good. But when I restart my server the login dialog disappears when I enter an incorrect password or the correct password leaving me with the "spawn" button. When I do click "spawn" I get spawned in Blueberry with the CJ skin. Let me give you a concrete example of the problem: I restart the server and go on the server. I enter an incorrect password and the dialog disappears leaving me with only the "Spawn" button available. Let's say for an instance that I click the "spawn" button, I get spawned in Blueberry in CJ skin. I have to delete my Bible.ini (Player file) and make the account again to make it work properly again. |
pawn Код:
if(fexist(UserPath(pID)) || gPlayerRegistered[pID] == 1)
{
INI_ParseFile(UserPath(pID), "LoadUser_%s", .bExtra = true, .extra = pID);
ShowPlayerDialog(pID, DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","{FFFFFF}Welcome back to {00FF26}SERVER NAME!{FFFFFF}\n\nThat name is registered. Please enter your password below.","Login","Quit"); //login
}
else
{
format(string, sizeof(string), "{FFFFFF}Welcome %s to {00FF00}SERVER NAME!{FFFFFF}\n\nThe registration process will be as following:\n\nStep 1: Agreement on server rules.\nStep 2: Password selection.\nStep 3: Age selection.\nStep 4: A roleplay test that consists out of 5 random questions.\n\nGood luck!\n Kind regards, the SERVER's community!", GetName(pID));
ShowPlayerDialog(pID, DIALOG_REGISTER, DIALOG_STYLE_MSGBOX, "SERVER NAME",string, "Continue", "Quit");
}
pawn Код:
if(dialogid == DIALOG_LOGIN) // login
{
if(!response) return SetTimerEx("kickbugfix", 1000, false, "i", pID);
if(response)
{
if(udb_hash(inputtext) == PlayerInfo[pID][pPass])
{
INI_ParseFile(UserPath(pID), "LoadUser_%s", .bExtra = true, .extra = pID);
SetSpawnInfo(pID, 0, PlayerInfo[pID][pSkin], PlayerInfo[pID][pLastX], PlayerInfo[pID][pLastY], PlayerInfo[pID][pLastZ], PlayerInfo[pID][pFacingAngle], 0, 0, 0, 0, 0, 0);
SpawnPlayer(pID);
GivePlayerCash(pID, PlayerInfo[pID][pCash]);
SetPlayerScore(pID, PlayerInfo[pID][pLevel]);
SetPlayerHealth(pID, PlayerInfo[pID][pHealth]);
SetPlayerArmour(pID, PlayerInfo[pID][pArmour]);
SetPlayerInterior(pID, PlayerInfo[pID][pInt]);
SetPlayerVirtualWorld(pID, PlayerInfo[pID][pVW]);
format(tmp2, sizeof(tmp2), "~g~Welcome ~n~~w~ %s", GetName(pID));
GameTextForPlayer(pID, tmp2, 5000, 1);
TogglePlayerSpectating(pID, 0);
SetPlayerColor(pID, TRANSPARENT_WHITE);
gPlayerLogged[pID] = 1;
return 1;
}
else
{
ShowPlayerDialog(pID, DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","{FFFFFF}Welcome back to {00FF26}SERVER!{FFFFFF}\n\nThat name is registered. Please enter your password below.\n\n{FF0000} You have entered an incorrect password!","Login","Quit"); //login
gPlayerLogged[pID] = 0;
return 1;
}
}
}