[HELP!!] Gates with password
#1

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;
}
Reply
#2

You could solve that yourself; if everything exept the password works sth. have to be reversed.
Try:
Код:
if(strcmp(inputtext, doorPw, false) == 0) // False <-> 0 ; No '!' !
Reply
#3

Quote:
Originally Posted by !Phoenix!
Посмотреть сообщение
You could solve that yourself; if everything exept the password works sth. have to be reversed.
Try:
Код:
if(strcmp(inputtext, doorPw, false) == 0) // False <-> 0 ; No '!' !
D:\SERVER~3\FILTER~1\miestas.pwn(786) : warning 213: tag mismatch
D:\SERVER~3\FILTER~1\miestas.pwn(786) : error 017: undefined symbol "False"
D:\SERVER~3\FILTER~1\miestas.pwn(786) : warning 215: expression has no effect
D:\SERVER~3\FILTER~1\miestas.pwn(786) : error 017: undefined symbol "No"
D:\SERVER~3\FILTER~1\miestas.pwn(786) : warning 215: expression has no effect
D:\SERVER~3\FILTER~1\miestas.pwn(786) : error 001: expected token: ";", but found "!"
D:\SERVER~3\FILTER~1\miestas.pwn(786) : fatal error 107: too many error messages on one line
Reply
#4

I don't understand how you managed to mess up your script if you just had to remove 1 character ...
Reply
#5

Aum..
Look at the errors; they are obviously caused by the comment -> remove it.
Reply
#6

Quote:
Originally Posted by Vince
Посмотреть сообщение
I don't understand how you managed to mess up your script if you just had to remove 1 character ...
which one
Reply
#7



if(!strcmp(inputtext, doorPw, false) == false) //Yours
if(strcmp(inputtext, doorPw, false) == false) //Mine

Now compare and have a guess
Reply
#8

lolololololololololololol xD small diferent it means what im blind
Reply
#9

but now one error warning 213: tag mismatch but not critical
Reply
#10

That could be because "doorPw" is a constant - not especial declared as string.
Does it work like this?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)