Gate password help
#1

How can i make a command so i do /gate and then a password it will move a object to a x y z.

I can do the /gate part but i want to know how would i put a password in it.
Reply
#2

just create a comand like "/gate mipass". simple and not very secure.
Reply
#3

Quote:
Originally Posted by the_chaoz
Посмотреть сообщение
just create a comand like "/gate mipass". simple and not very secure.
and would there be a way to do it as a input text menu as well
Reply
#4

compare the inputtext of the menu, with the password you've saved (in the code, in a file or in a db)
Reply
#5

My example:
Top:
pawn Код:
#define GATE_PASSWORD "mypassword"
Command:
pawn Код:
CMD:gate(playerid, params[])
{
    if(params[0] == '\1' && params[1] == '\0')
        SendClientMessage(playerid, 0xFF0000FF, "Write: /gate [password].");
    else if(strcmp(params, GATE_PASSWORD, false))
        SendClientMessage(playerid, 0xFF0000FF, "Password is incorrect.");
    else
    {
        //write here MoveObject
    }
    return 1;
}
Reply
#6

Um Like this Enjoy!....


pawn Код:
#include <a_samp>
#include <streamer>

#define NEWSGATE_PASSWORD "password21" // change that its the password but include "password21"
#define error 0xFF0000FF
#define normal 0xFFFFFFFF
forward GateClose(playerid);
new newsgate1;
new newsgate;

main()
{
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
}

public GateClose(playerid)
{
      MoveDynamicObject(newsgate1,777.52178955078, -1384.7537841797, 14.225526809692 , 0.97); /// This lines to close the gate
      PlayerPlaySound(playerid, 1153, 1589.053344,-1638.123168,14.122960); /// just a gate sound
      newsgate = 0;
      return 1;
}

public OnGameModeInit()
{
    newsgate1 = CreateDynamicObject(975, 777.52178955078, -1384.7537841797, 14.225526809692, 0, 0, 180.09997558594);//Make sure you put the closed gate here
    SetGameModeText("Blank Script");
    AddPlayerClass(0, 777.52178955078, -1384.7537841797, 14.225526809692, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{ // I just use this here for shortcut to the Gate hehe
    SetPlayerPos(playerid, 777.52178955078, -1384.7537841797, 14.225526809692);
    SetPlayerCameraPos(playerid, 777.52178955078, -1384.7537841797, 14.225526809692);
    SetPlayerCameraLookAt(playerid, 777.52178955078, -1384.7537841797, 14.225526809692);
    return 1;
}


public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/newsgate", cmdtext, true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsPlayerInRangeOfPoint(playerid, 15.0,777.52178955078, -1384.7537841797, 14.225526809692)) // This is where player is in range of gate
            {
                ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Security Gate", "Hello How Are you Today, Please Punch In Your Passcode", "Open", "Cancel");
            }
            else
            {
                SendClientMessage(playerid, error, " Your Not Near The News Gate ");
            }
        }
        return 1;
    }
    return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1)
    {
        if(!response)
        {
            SendClientMessage(playerid, error, " Okay Access Denied Have a Nice Day!");
        }
        if(!strcmp(inputtext, NEWSGATE_PASSWORD, true))
        {
            SendClientMessage(playerid, error, "Invalid Passcode");
            ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Security Gate", "One More Chance, Please Punch In Your Passcode", "Open", "Cancel");
        }
        else
        {
            if(newsgate == 1) { SendClientMessage(playerid, error, "Security Gate is Open"); return 1; }
            MoveDynamicObject(newsgate1,769.52178955078, -1384.7537841797, 14.225526809692, 0.97); // to open the gate
            SetTimer("GateClose", 13000, 0); /// timer to close in 10 seconds
                        new Gatemessage[64];
            format(Gatemessage, 64, "Security Gate will close in 7 seconds");
            GameTextForAll(Gatemessage, 5000, 3);
            PlayerPlaySound(playerid, 1153, 1589.053344,-1638.123168,14.122960);
            newsgate = 1;
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)