[HELP!!] Gates with password -
Darien - 02.02.2011
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;
}
AW: [HELP!!] Gates with password -
!Phoenix! - 02.02.2011
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 '!' !
Re: AW: [HELP!!] Gates with password -
Darien - 02.02.2011
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
Re: [HELP!!] Gates with password -
Vince - 02.02.2011
I don't understand how you managed to mess up your script if you just had to remove 1 character ...
AW: [HELP!!] Gates with password -
!Phoenix! - 02.02.2011
Aum..
Look at the errors; they are obviously caused by the comment -> remove it.
Re: [HELP!!] Gates with password -
Darien - 02.02.2011
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
AW: [HELP!!] Gates with password -
!Phoenix! - 02.02.2011
if(!strcmp(inputtext, doorPw, false) == false) //Yours
if(strcmp(inputtext, doorPw, false) == false) //Mine
Now compare and have a guess
Re: [HELP!!] Gates with password -
Darien - 02.02.2011
lolololololololololololol xD small diferent it means what im blind
Re: [HELP!!] Gates with password -
Darien - 02.02.2011
but now one error warning 213: tag mismatch but not critical
AW: [HELP!!] Gates with password -
!Phoenix! - 02.02.2011
That could be because "doorPw" is a constant - not especial declared as string.
Does it work like this?