16.05.2018, 19:53
You must first create the pickup..
And need a house enum that saves the password
Then do like that..
Then the dialog response
PHP код:
OnGameModeInIt()
{
EnterHouse = CreatePickup(Model ID, type, X, Y, Z, virtual world //By the way you can also create Dynamic one...
}
PHP код:
enum houseinfo
{
housepassword;
}
new HouseInfo[MAX_HOUSES][houseinfo];
PHP код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == EnterHouse)
{
ShowPlayerDialog(playerid, 1000, DIALOG_STYLE_PASSWORD, "House Password", "Enter the house password below:", "Enter", "Close");
}
}
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1000)
{
if(!response) // That's if he pressed ESC or Cancel button.
{
SendClientMessage(playerid,0xFF0000AA,"Wrong Password!");
}
else // That's if he pressed Okay or ENTER button.
{
if(strcmp(HouseInfo[houseid][hPassword], inputtext, true, 32)
{
SetPlayerPos(playerid,139.4020,1368.8059,1083.8636);
}
else
{
SendClientMessage(playerid,0xFF0000AA,"Wrong Password!");
// Re-show the login dialog
ShowPlayerDialog(playerid, 1000, DIALOG_STYLE_PASSWORD, "House Password", "Please enter your house password:", "Login", "Cancel");
}
}
return 1;
}
return 0;
}