PDA

View Full Version : Password Door {Dialog}


zT KiNgKoNg
13/07/2012, 11:50 AM
Hello samp community i would like some help on how to make a door that requires a password that you can input via dialog any help will give you +rep+

DarrenReeder
13/07/2012, 12:00 PM
Do you mean a built in entrance on gta sa? Or a custom made door anywhere in san andreas?

clarencecuzz
13/07/2012, 12:02 PM
Give me your gate co-ordinates, open and closed position, and tell me what the password you want is.

zT KiNgKoNg
13/07/2012, 12:04 PM
Give me your gate co-ordinates, open and closed position, and tell me what the password you want is.

All i need is a code that allows be to do this i can do the rest if you can do the code 12345 so i can change it im still mapping it out but this is the close cords CreateObject(19302, 1441.62, -7.53, 1002.17, 0.00, 0.00, 90.00);

clarencecuzz
13/07/2012, 12:09 PM
Does your gate just move up and down?

zT KiNgKoNg
13/07/2012, 12:09 PM
Does your gate just move up and down?

Don't worry about open or closing just put a comment were it should go and ill put it there thanks

Lordzy
13/07/2012, 12:12 PM
Try this if you are using 0.3e
forum.sa-mp.com/showthread.php?t=329097

This is like a password system.
Credits:MP2

zT KiNgKoNg
13/07/2012, 12:14 PM
Lordz;1983629']Try this if you are using 0.3e
forum.sa-mp.com/showthread.php?t=329097

This is like a password system.
Credits:MP2

Thanks Anyway id rather have dialog not textdraw

milanosie
13/07/2012, 12:15 PM
Thanks Anyway id rather have dialog not textdraw

I don't know why you would prefer a dialog but okay.
Is it just s number password or also text?
And are there any lenght limits?
Should the password be editable ingame or just be static?
Must there be a limit of attempts to break the password?

etc. etc.

DarrenReeder
13/07/2012, 12:17 PM
Whatever door system you currently use. Just add a string variable that saves a password, then when a user opens a specific door, ask them (in a dialog) for a password, if they are right open it, if not then dont.

zT KiNgKoNg
13/07/2012, 12:18 PM
I don't know why you would prefer a dialog but okay.
Is it just s number password or also text?
And are there any lenght limits?
Should the password be editable ingame or just be static?
Must there be a limit of attempts to break the password?

etc. etc.

Well milan thanks for your reply but id rather not talk to you about any thing i want since all you do is start arguments

milanosie
13/07/2012, 12:19 PM
Well milan thanks for your reply but id rather not talk to you about any thing i want since all you do is start arguments

Uhm what? I'm trying to help you out here.
But whatever, if you don't want my help for no reason, I guess I wont help you.

clarencecuzz
13/07/2012, 12:30 PM
#include <a_samp>
#define GATE_PASS "12345" //Try to keep it less than 20 characters. You can have more but you would need to edit strlen(inputtext) > 20 in OnDialogResponse.
new gate;
new bool:IsGateOpen;

public OnGameModeInit() //Or OnFilterScriptInit()
{
gate = CreateObject(19302, 1441.62, -7.53, 1002.17, 0.00, 0.00, 90.00);
IsGateOpen = false;
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/opengate", true) == 0) //Change /opengate to whatever command you want.
{
if(IsPlayerInRangeOfPoint(playerid, 10, 1441.62, -7.53, 1002.17))
{
if(IsGateOpen == false)
{
ShowPlayerDialog(playerid, 8000, DIALOG_STYLE_PASSWORD, "You must enter the password for this gate.", "{FF0000}Enter Your Password Here:","Enter","Cancel");
}
else return SendClientMessage(playerid, 0xFF0000AA, "The gate is already open!");
}
else return SendClientMessage(playerid, 0xFF0000AA, "You must be near the gate to access it.");
return 1;
}

if(strcmp(cmdtext, "/closegate", true) == 0) //Change /closegate to whatever command you want.
{
if(IsPlayerInRangeOfPoint(playerid, 10, 1441.62, -7.53, 1002.17))
{
if(IsGateOpen == true)
{
MoveObject(gate, 1441.62, -7.53, 1002.17, 4, 0, 0, 90);
SendClientMessage(playerid, 0x00FF00AA, "The gate is now closing.");
}
else return SendClientMessage(playerid, 0xFF0000AA, "The gate is already closed!");
}
else return SendClientMessage(playerid, 0xFF0000AA, "You must be near the gate to access it.");
return 1;
}
return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 8000)
{
if(response)
{
if(strlen(inputtext) > 0 || strlen(inputtext) > 20)
{
if(strcmp(inputtext, GATE_PASS, true) == 0)
{
//MoveObject(gate, OpenX, OpenY, OpenZ, 4, 0, 0, 90);
SendClientMessage(playerid, 0x00FF00AA, "Gate is now opening.");
}
else return ShowPlayerDialog(playerid, 8000, DIALOG_STYLE_PASSWORD, "You have entered an incorrect password.", "{FF0000}Enter Your Password Here:","Enter","Cancel");
}
else return ShowPlayerDialog(playerid, 8000, DIALOG_STYLE_PASSWORD, "Password must be at least 1-20 characters long.", "{FF0000}Enter Your Password Here:","Enter","Cancel");
}
else return SendClientMessage(playerid, 0xFF0000AA, "You have cancelled.");
return 1;
}
return 1;
}

zT KiNgKoNg
13/07/2012, 12:32 PM
Thanks so mutch +REP+