SA-MP Forums Archive
Help please cmds/dialog - 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: Help please cmds/dialog (/showthread.php?tid=362681)



Help please cmds/dialog - ergan - 25.07.2012

SATDM v9
I builded a mta and now im creating the pwn file.

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{

if(IsPlayerInRangeOfPoint(playerid, 7.0, 1001.2708, -640.7729, 121.1328))
{
    ShowPlayerDialog(playerid,DIALOG_GATE, DIALOG_STYLE_INPUT, "GATE PASSWORD", "Enter your password below or die in 10s:", "OK", "LEAVE");
//	MoveObject(gate, 1011.79998779,-639.70001221,123.40000153, 2.00); //object(airportgate) (1)

	return 1;
}

if(strcmp(cmdtext,"/cg",true)==0)//opened
{
	MoveObject(gate, 1002.70001221,-643.79998779,123.40000153, 2.00); //object(airportgate) (1)
	return 1;
}
return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_GATE)
	{
        if(!response) // If they clicked 'Cancel' or pressed esc
        {
            SendClientMessage(playerid, COLOR_RED, "You dont know gate password | Killed in 10seconds.");
            SetTimerEx("DelayKillPlayer", 10000,0,"d",playerid);
        }
        else // Pressed ENTER or clicked 'Login' button
        {
            if(CheckPassword(playerid, inputtext))
            {
                SendClientMessage(playerid, COLOR_RED, "You sucessful entered the gate password!");
                SendClientMessage(playerid, COLOR_RED, "Gate will open now, To close it type /cg!");
                MoveObject(gate, 1011.79998779,-639.70001221,123.40000153, 2.00); //object(airportgate) (1)
			}
            else
            {
                SendClientMessage(playerid, COLOR_RED, "GATE LOGIN FAILED | Killed in 10seconds.");
                SetTimerEx("DelayKillPlayer", 10000,0,"d",playerid);
        	}
  		}
  		return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
	}
	return 0; // You MUST return 0 here! Just like OnPlayerCommandText.
}
and i get this error:
Код:
D:\GTASAN~1\SATDM~~1\FILTER~1\ErgiMh.pwn(139) : error 017: undefined symbol "CheckPassword"
pls tell me how to fix this and how to create a password for gate that i can put on dialog box and will open gate?
PLS HELP ME I WILL REP U OR DO A FAVour to u buT HELP ME
THANKS!


Re: Help please cmds/dialog - Kindred - 25.07.2012

You do not have CheckPassword defined.

Define it, like so:

pawn Код:
stock CheckPassword(playerid, password)
{
    if(!strcmp(password, "Thisisthepasswordyouwanttobecorrect", false))
    {
        return true;
    }
    return false;
}
Pretty sure this is the context you are trying to do it in. If the password equals the correct password, it will return 1, which will continue with the if statement.


Re: Help please cmds/dialog - ergan - 25.07.2012

Kinderd this is my script now:

Код:
if(!strcmp(password, "ergi", false))
            {
                SendClientMessage(playerid, COLOR_RED, "You sucessful entered the gate password!");
                SendClientMessage(playerid, COLOR_RED, "Gate will open now, To close it type /cg!");
                MoveObject(gate, 1011.79998779,-639.70001221,123.40000153, 2.00); //object(airportgate) (1)
 			}
adn this is the error:
Код:
ErgiMh.pwn(139) : error 017: undefined symbol "password"



Re: Help please cmds/dialog - Kindred - 25.07.2012

pawn Код:
stock CheckPassword(playerid, password[])
{
    if(!strcmp(password, "ergi", false))
    {
        return true;
    }
    return false;
}
Password wasn't a string btw, forgot.

I have no idea why it says undefined symbol if you didn't remove password.

Ohh, and if you forgot how to use the stock, which you might have, do this:

pawn Код:
if(CheckPassword(playerid, passstring))
{
    //If he entered the password and got it correct, do something here
}



Re: Help please cmds/dialog - ergan - 25.07.2012

pls add me on skype ergan.nano

and name Ergi Nano(yesiam) and try throught team viewer


Re: Help please cmds/dialog - Kindred - 25.07.2012

I'd rather not. People with sense can easily do what I just described.

If not, I'd just like to inform you that you should check with a hospital about your illness.


Re: Help please cmds/dialog - ergan - 25.07.2012

ok thanks anyway