case DIALOG_HOUSEPASSWORDENTER:
{
if(response)
{
if(strlen(inputtext) != 4)
{
ShowPlayerDialog(playerid, DIALOG_HOUSEPASSWORDENTER, DIALOG_STYLE_INPUT,""COL_YELLOW"Lock Password (Numbers Only)",""COL_WHITE"Enter The House Password","Confirm","Close");
return true;
}
for(new x = 0; x < MAX_HOUSES; x++)
{
new pName4[MAX_PLAYER_NAME];
new string41[128];
new labelString[128];
GetPlayerName(playerid, pName4, MAX_PLAYER_NAME);
if(house[x][hLockCode] == strval(inputtext))
{
switch(house[x][hHouseLocked])
{
case 1:
{
format(string41, sizeof(string41), "%s places their fingers on the keypad", pName4);
SendLocalMessage(playerid, string41, 15.0, COLOR_PURPLE, COLOR_PURPLE);
house[x][hHouseLocked] = 0;
format(labelString, sizeof(labelString), "House ID: %d\nOwner: %s\n\nPress ~k~~PED_DUCK~ to enter.", x, house[x][hHouseOwner]);
UpdateDynamic3DTextLabelText(house[x][hLabelID], COLOR_LIMEGREEN, labelString);
}
case 0:
{
format(string41, sizeof(string41), "%s places their fingers on the keypad", pName4);
SendLocalMessage(playerid, string41, 15.0, COLOR_PURPLE, COLOR_PURPLE);
house[x][hHouseLocked] = 1;
format(labelString, sizeof(labelString), "House ID: %d\nOwner: %s\n\n(Locked)", x, house[x][hHouseOwner]);
UpdateDynamic3DTextLabelText(house[x][hLabelID], COLOR_LIMEGREEN, labelString);
}
}
break;
}
else
{
format(string41, sizeof(string41), "%s places their fingers on the keypad", pName4);
SendLocalMessage(playerid, string41, 15.0, COLOR_PURPLE, COLOR_PURPLE);
PlayerActionMessage(playerid,15.0,"Incorrect Password");
}
}
}
}
stock GetClosestHouseID(playerid)
{
new ClosestHouse;
new Float:ClosestDistance = 10000000;
for (new i = 1; i<MAX_HOUSES; i++)
{
new Float:Distance = GetPlayerDistanceFromPoint(playerid,HouseInfo[i][XPos],HouseInfo[i][YPos],HouseInfo[i][ZPos]);
if(Distance<ClosestDistance)
{
ClosestDistance = Distance;
ClosestHouse = i;
}
}
return ClosestHouse;
}
case DIALOG_HOUSEPASSWORDENTER:
{
if(response)
{
if(strlen(inputtext) != 4)
{
ShowPlayerDialog(playerid, DIALOG_HOUSEPASSWORDENTER, DIALOG_STYLE_INPUT,""COL_YELLOW"Lock Password (Numbers Only)",""COL_WHITE"Enter The House Password","Confirm","Close");
return true;
}
new pName4[MAX_PLAYER_NAME];
new string41[128];
new labelString[128];
GetPlayerName(playerid, pName4, MAX_PLAYER_NAME);
new x = GetClosestHouseID(playerid);
if(house[x][hLockCode] == strval(inputtext))
{
switch(house[x][hHouseLocked])
{
case 1:
{
format(string41, sizeof(string41), "%s places their fingers on the keypad", pName4);
SendLocalMessage(playerid, string41, 15.0, COLOR_PURPLE, COLOR_PURPLE);
house[x][hHouseLocked] = 0;
format(labelString, sizeof(labelString), "House ID: %d\nOwner: %s\n\nPress ~k~~PED_DUCK~ to enter.", x, house[x][hHouseOwner]);
UpdateDynamic3DTextLabelText(house[x][hLabelID], COLOR_LIMEGREEN, labelString);
}
case 0:
{
format(string41, sizeof(string41), "%s places their fingers on the keypad", pName4);
SendLocalMessage(playerid, string41, 15.0, COLOR_PURPLE, COLOR_PURPLE);
house[x][hHouseLocked] = 1;
format(labelString, sizeof(labelString), "House ID: %d\nOwner: %s\n\n(Locked)", x, house[x][hHouseOwner]);
UpdateDynamic3DTextLabelText(house[x][hLabelID], COLOR_LIMEGREEN, labelString);
}
}
break;
}
else
{
format(string41, sizeof(string41), "%s places their fingers on the keypad", pName4);
SendLocalMessage(playerid, string41, 15.0, COLOR_PURPLE, COLOR_PURPLE);
PlayerActionMessage(playerid,15.0,"Incorrect Password");
}
}
}
pawn Код:
|
new x = GetClosestHouseID(playerid);
format(string41, sizeof(string41), "Right code: %d Entered code: %d", house[x][hLockCode], strval(inputtext));
SendClientMessage(playerid, -1, string41);
if(house[x][hLockCode] == strval(inputtext))
{