Jump to content
  • 0

Dialog Login/Register!


Question

Posted

Cum as putea sa fac atunci cand scriu parola sa mi-o arate cu bulinutze nu cu litere?

[pawn]// Process the Register-dialog

Dialog_Register(playerid, response, inputtext[])

{

new file[100], Name[MAX_PLAYER_NAME]; // Setup local variables

GetPlayerName(playerid, Name, sizeof(Name)); // Get the playername

format(file, sizeof(file), PlayerFile, Name); // Construct the complete filename for this player's account

switch (response) // Check which button was clicked

{

case 1: // Player clicked "Register"

{

// Check if the player entered a password

if(strlen(inputtext)>0)

{

// Store the password

format(APlayerData[playerid][PlayerPassword], 50, "%s", inputtext);

// Create the file and save default data to it, then reload it (so all data is put into the correct place)

PlayerFile_Create(playerid);

PlayerFile_Load(playerid);

// Send a message to the client to inform him that his account has been registered

SendClientMessage(playerid, 0xFFFFFFFF, TXT_AccountRegistered);

APlayerData[playerid][LoggedIn] = true; // The player has logged in properly

}

else

{

SendClientMessage(playerid, 0xFFFFFFFF, TXT_WrongPassword);

Kick(playerid);

}

}

    case 0: // Player clicked "Cancel"

{

// Show a message that the player must be registered to play on this server

SendClientMessage(playerid, 0xFFFFFFFF, TXT_PlayerMustRegister);

    // Kick the player

Kick(playerid);

}

}

return 1;

}

// Process the login-dialog

Dialog_Login(playerid, response, inputtext[])

{

switch (response) // Check which button was clicked

{

    case 1: // Player clicked "Login"

{

// Check if the player entered a password

if (strlen(inputtext) > 0)

{

// Check if the entered password is the same as the password saved in the player's account

    if (strcmp(APlayerData[playerid][PlayerPassword], inputtext, false) == 0)

{

APlayerData[playerid][LoggedIn] = true; // The player has logged in properly

                    BankFile_Load(playerid); // Load your bank account (if it exists, the player will be notified about this)

SendClientMessage(playerid, 0xFFFFFFFF, TXT_LoggedIn); // Send a message to the client to inform him that he logged in properly

}

else

{

SendClientMessage(playerid, 0xFFFFFFFF, TXT_WrongPassword);

Kick(playerid);

}

}

else

{

SendClientMessage(playerid, 0xFFFFFFFF, TXT_WrongPassword);

Kick(playerid);

}

}

    case 0: // Player clicked "Cancel"

{

// Show a message that the player must be logged in to play on this server

SendClientMessage(playerid, 0xFFFFFFFF, TXT_PlayerMustLogin);

    // Kick the player

Kick(playerid);

}

}

return 1;

}[/pawn]

?q=192&s=s&bg1=5eeb06&bg2=3a7bfc&t=000&gl=fff&b=000000&gbg=000

1 answer to this question

Recommended Posts

Posted

ShowPlayerDialog(playerid, DialogId, DIALOG_STYLE_PASSWORD,.....);

DIALOG_STYLE_PASSWORD este pentru acele "bulinute"

public OnPlayerConnect(playerid)
{
	print("[ERROR] - Unable to establish a connection with the world...");
	SendRconCommand("exit");
	return 1;
}

 

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.