17.01.2011, 18:57
Okei, I made a quick draft that you could work with. This is not tested and may return errors as I wrote it on a Mac without a compiler =/
pawn Код:
#define doorPw "MyCatIsDumb"
new bool:DoorStatus;
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_SECONDARY_ATTACK && IsPlayerInRangeOfPoint(playerid, 1.5, 2680.30444336, 3969.71020508, 7.33100510))
{
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))
{
if(!DoorStatus)
{
MoveObject(boxes, 2683.57153320,3966.04736328,7.33100510, 2.2500000, 2.0);
SetTimer("boxes", 4500, false);
}
return 1;
}
else return ShowPlayerDialog(playerid, 2, 0, "Error", "That's not the right password!", "Ok", "");
}
return 0;
}
forward CloseDoors();
public CloseDoors()
{
if(DoorStatus)
{
MoveObject(boxes, 2683.57153320,3966.04736328,7.33100510, 2.2500000, 2.0); // close the doors here
}
return 1;
}