PHP код:
ShowMainMenuDialog(playerid, frame)
{
new titlestring[64];
new string[256];
switch(frame)
{
case 1:
{
new ip[32];
GetPlayerIp(playerid, ip, 32);
format(titlestring, sizeof(titlestring), "Login - %s", GetPlayerNameEx(playerid));
format(string, sizeof(string), "Welcome to The Social World Roleplay, %s.\n\nIP Address: *<*<*<*<*<*<*<\n\nThe name that you are using is registered, please enter a password to login:", GetPlayerNameEx(playerid), ip);
ShowPlayerDialog(playerid,MAINMENU,DIALOG_STYLE_INPUT,titlestring,string,"Login","Exit");
}
case 2:
{
new ip[32];
GetPlayerIp(playerid, ip, 32);
format(titlestring, sizeof(titlestring), "Register - %s", GetPlayerNameEx(playerid));
format(string, sizeof(string), "Welcome to The Social World RP, %s.\n\nIP Address: %s\n\nYou may register an account by entering a desired password here:", GetPlayerNameEx(playerid), ip);
ShowPlayerDialog(playerid,MAINMENU2,DIALOG_STYLE_INPUT,titlestring,string,"Register","Exit");
}
case 3:
{
new ip[32];
GetPlayerIp(playerid, ip, 32);
format(titlestring, sizeof(titlestring), "Login - %s", GetPlayerNameEx(playerid));
format(string, sizeof(string), "Invalid Password!\n\nWelcome to TSW-RP, %s.\n\nIP Address: %s\n\nThe name that you are using is registered, please enter a password to login:", GetPlayerNameEx(playerid), ip);
ShowPlayerDialog(playerid,MAINMENU,DIALOG_STYLE_INPUT,titlestring,string,"Login","Exit");
}
}
}
public SafeLogin(playerid)
{
// Main Menu Features.
ShowMainMenuGUI(playerid);
SetPlayerJoinCamera(playerid);
ClearChatbox(playerid);
SetPlayerVirtualWorld(playerid, 0);
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
if(doesAccountExist(playername))
{
gPlayerAccount[playerid] = 1;
ShowMainMenuDialog(playerid, 1);
return 1;
}
else
{
if( strfind( playername, "_", true) == -1 )
{
SendClientMessageEx( playerid, COLOR_WHITE, "Connection rejected. Please get a name in the correct format: Firstname_Lastname." );
}
else
{
gPlayerAccount[playerid] = 0;
ShowMainMenuDialog(playerid, 2);
}
return 1;
}
}