02.02.2011, 11:37
problem is that, what i can open these doors with any password, except which i set "45823"
pawn Код:
#define doorPw "45823"
new bool:DoorStatus;
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_SECONDARY_ATTACK && IsPlayerInRangeOfPoint(playerid, 1.5, 2678.04663086,3966.71850586,7.23182821))
if(newkeys & KEY_SECONDARY_ATTACK && IsPlayerInRangeOfPoint(playerid, 1.5, 2675.45922852,3964.38964844,7.23459196))
{
ShowPlayerDialog(playerid, 1, 1, "Doors", "Please type in the password to continue:", "Go", "Cancel");
}
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1)
{
if(!strcmp(inputtext, doorPw, false) == false)
{
if(!DoorStatus)
{
MoveDynamicObject(labdoor, 2674.99414062,3967.00097656,8.58553982, 2.0);
SetTimer("labdoor", 4500, false);
SetTimer("CloseDoors", 4500, false);
DoorStatus = true;
}
return 1;
}
else return ShowPlayerDialog(playerid, 2, 0, "Error", "That's not the right password!", "Ok", "");
}
return 0;
}
forward CloseDoors();
public CloseDoors()
{
MoveDynamicObject(labdoor, 2674.99438477,3967.00122070,5.57493162, 2.0); // close the doors here
DoorStatus = false;
return 1;
}