SA-MP Forums Archive
Movable gate with keypad - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Movable gate with keypad (/showthread.php?tid=583281)



Movable gate with keypad - javad - 27.07.2015

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.


Re : Movable gate with keypad - nicolaskettler - 27.07.2015

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 ^^


Re: Movable gate with keypad - javad - 27.07.2015

Oh, Thanks. +rep