11.02.2012, 01:33
How can i make "Cancel" button to disconnect player from the server on login/register dialogs?
And i also made a little code to make "<" ">" "Spawn" button to dissapear, but is ther way to make it short like in 1-2 line?
I need to get "Cancel" button to close connection, cuz if i hit this button and later logging in, it spawns with Spectating view, and it's annoying
EDIT:
As i didn't get any answers so far, i tought maybe it's better to put dialog also...
And i also made a little code to make "<" ">" "Spawn" button to dissapear, but is ther way to make it short like in 1-2 line?
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
SetSpawnInfo( playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0 );
if(JustLogged[playerid] == 1)
{
SpawnPlayer(playerid);
}
else
{
TogglePlayerSpectating(playerid, 1);
}
return 1;
}
EDIT:
As i didn't get any answers so far, i tought maybe it's better to put dialog also...
pawn Код:
if(dialogid == DIALOG_LOGIN)
{
if(!response)
{
SendMessage(playerid, "~r~Error: ~w~You must login before you spawn!");
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""Blue"Please log-in", ""White"Welcome back to "Red""SERVER_NAME""White"!\n"White"In order to start playing, you have to log-in!\n\n"White"Please insert "Red"your"White" password below:", "Login", "Cancel");
}
if(response)
{
new query[200], pname[24], escapepass[100];
GetPlayerName(playerid, pname, 24);
mysql_real_escape_string(inputtext, escapepass);
format(query, sizeof(query), "SELECT `user` FROM playerdata WHERE user = '%s' AND password = SHA1('%s')", pname, escapepass);
mysql_query(query);
mysql_store_result();
new numrows = mysql_num_rows();
if(numrows == 1) MySQL_Login(playerid);
if(!numrows)
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""Blue"Please log-in", ""White"Welcome back to "Red""SERVER_NAME""White"!\n"White"In order to start playing, you have to log-in!\n\n"White"Please insert "Red"your"White" password below:", "Login", "Cancel");
SendMessage(playerid, "~r~Error: ~w~Incorrect password!");
}
mysql_free_result();
}
}
pawn Код:
if(IsRegistered[playerid] == 1)
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""Blue"Please log-in", ""White"Welcome back to "Red""SERVER_NAME""White"!\n"White"In order to start playing, you have to log-in!\n\n"White"Please insert "Red"your"White" password below:", "Login", "Cancel");
return 0;
}