30.09.2012, 10:54
You must have a player name in your .ini file so
Name = &&&&&&&&&&& // The name
Name = &&&&&&&&&&& // The name
pawn Код:
CMD:changename(playerid,params[])
{
if(PlayerInfo[playerid][pCredits] >=1)
{
PlayerInfo[playerid][pCredits] -1;
ShowPlayerDialog(playerid,DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Change Your Name", "Enter Your New Name Below", "Next", "Cancel");
}
else{
SendClientMessage(playerid,-1,"You Do Not Have The Correct Amount Of Credits 5©");
}
return 1;
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_LOGIN)
{
if(!response) // If they clicked 'Cancel' or pressed esc
{
SendClientMessage(playerid, COLOR_RED, "You Canceled Your Name Change");
}
else // Pressed ENTER or clicked 'Login' button
{
if(CheckPassword(playerid, inputtext))
{
ShowPlayerDialog(playerid, DIALOG_WELCOME, DIALOG_STYLE_MSGBOX, "Notice", "You connected to the server", "Close", "");
}
}
return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
}
if(dialogid == DIALOG_WELCOME)
{
if(response) // If they clicked 'Yes' or pressed enter
{
PlayerInfo[playerid][Name] == inputtext;
}
else // Pressed ESC or clicked cancel
{
SendClientMessage(playerid, COLOR_RED, "You Canceled Your Name Change");
}
return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
}
return 0; // You MUST return 0 here! Just like OnPlayerCommandText.
}