Movable gate with keypad
#1

Hi,
I've made a movable gate and i want to open it with keypad and password.

Код:
#define KEYPAD_GATE 1
new var = 4284;
new MyKey[5];
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/go", cmdtext, true, 10) == 0)
	{
		if(IsPlayerInRangeOfPoint(playerid, 10, 164.2189,-1945.5867,3.7734))
		{
			valstr(MyKey,var);
                        ShowPlayerKeypad(playerid, KEYPAD_GATE, MyKey);
		}
		return 1;
	}
Код:
public OnPlayerKeypadInput(playerid, keypadID, type, key)
{
	if(!strcmp(GetPlayerKeypad(KEYPAD_GATE), "4284"))
	{
	    MoveObject(housegate, 164.53700, -1945.84595, 1.01000, 3, 0, 0, -57); //////////LS Beach House///////
	}
	return 1;
}
When i enter /go in game,i see the keypad and when i enter the password, gate opens but it opens with wrong password too.
I think it has alot of mistakes.
Reply
#2

try like this:
PHP код:

public OnPlayerKeypadInput(playeridkeypadIDtypekey)
{
    if(
type == KEYPAD_INPUT_GOOD)
    {
         if(
keypadID == KEYPAD_GATEMoveObject(housegate164.53700, -1945.845951.01000300, -57); 
    }

if that helps, don't forget to +rep ^^
Reply
#3

Oh, Thanks. +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)