SA-MP Forums Archive
[HELP] Gates with password - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Gates with password (/showthread.php?tid=217312)



[HELP] Gates with password [SOLVED] - Darien - 27.01.2011

1.when im want to open this door i no need to put password, just press cancel, ok or enter and doors open without password.

2. If i want open door next time doors wont to open.

pawn Код:
//--------- Research gates with password ---

#define doorPw "MyCatIsDumb"
new bool:DoorStatus;

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_SECONDARY_ATTACK && IsPlayerInRangeOfPoint(playerid, 1.5, 2678.04663086,3966.71850586,7.23182821))
    {
        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)
            {
                MoveDynamicObject(labdoor, 2674.99414062,3967.00097656,8.58553982, 2.0);
                SetTimer("labdoor", 4500, false);
                SetTimer("CloseDoors", 4500, false);
                DoorStatus = 1;
            }
            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
    return 1;
}



Re: [HELP] Gates with password - Grim_ - 27.01.2011

You want it so you don't need to type in a password to open the gates, correct?
pawn Код:
//--------- Research gates with password ---

new bool:DoorStatus;

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_SECONDARY_ATTACK && IsPlayerInRangeOfPoint(playerid, 1.5, 2678.04663086,3966.71850586,7.23182821))
    {
        MoveDynamicObject(labdoor, 2674.9941062,3967.00097656,8.58553982, 2.0 );
        SetTimer("labdoor", 4500, false );
        SetTimer("CloseDoors", 4500, false );
        DoorStatus = 1;
    }
    return 1;
}

forward CloseDoors();
public CloseDoors()
{
    MoveDynamicObject(labdoor, 2674.99438477,3967.00122070,5.57493162, 2.0); // close the doors here
    return 1;
}
-- Untested.


Re: [HELP] Gates with password - Darien - 27.01.2011

noo i want that i must type correct password to open the doors


Re: [HELP] Gates with password - Gabe - 27.01.2011

You need to use...

pawn Код:
forward CloseDoors();
public CloseDoors()
{
    MoveDynamicObject(labdoor, 2674.99438477,3967.00122070,5.57493162, 2.0); // close the doors here
    DoorStatus = 0;
    return 1;
}



Re: [HELP] Gates with password - Darien - 27.01.2011

pawn Код:
D:\SERVER~3\FILTER~1\miestas.pwn(749) : warning 213: tag mismatch
D:\SERVER~3\FILTER~1\miestas.pwn(761) : warning 213: tag mismatch



Re: [HELP] Gates with password - Gabe - 27.01.2011

Which lines are those?


Re: [HELP] Gates with password - Gh0sT_ - 27.01.2011

DoorStatus = 1; > DoorStatus = true;

DoorStatus = 0; > DoorStatus = false;

You are using bool, not global var


Re: [HELP] Gates with password - Darien - 27.01.2011

now i can open doors next time but, theres are 1 mistake left. I need tht i MUST type correct password, because now i can open without password


Re: [HELP] Gates with password - Gabe - 27.01.2011

Quote:
Originally Posted by Darien
Посмотреть сообщение
now i can open doors next time but, theres are 1 mistake left. I need tht i MUST type correct password, because now i can open without password
Does it stop working when you use the correct password? xD


Re: [HELP] Gates with password - SkizzoTrick - 27.01.2011

Create a dialog and use the inputtext

EDIT:Sorry,the page didn't get loaded xD