MoveObject with a password
#1

this may be the easiest thing but I am a noob soo... I got a moveobject system created for gates and shit but anyone can open it. I am looking for a way to set the password so if it was like derp, you go to the gate, do /gate open derp and it will open. If it is the wrong command SendClientMessage Wrong Code. If it is easier, a dialogue would be just as good.
Reply
#2

If you use sscanf, you could make something like this:
pawn Код:
CMD:gate(playerid, params[])
{
    new
        subcmd[ 6 ],
        password;

    if( sscanf( params, "ss", subcmd, password ))
        return SendClientMessage( playerid, 0xFF0000FF, "/gate [open/close] [password]" );

    if( !strcmp( subcmd, "open", true ))
    {
         if( !strcmp( password, "MYPASSWORD" ))
         {
             //open gate
         }
    }
    else
    {
        //close gate
    }
    return true;
}
Reply
#3

Quote:
Originally Posted by LarzI
Посмотреть сообщение
If you use sscanf, you could make something like this:
pawn Код:
CMD:gate(playerid, params[])
{
    new
        subcmd[ 6 ],
        password;

    if( sscanf( params, "ss", subcmd, password ))
        return SendClientMessage( playerid, 0xFF0000FF, "/gate [open/close] [password]" );

    if( !strcmp( subcmd, "open", true ))
    {
         if( !strcmp( password, "MYPASSWORD" ))
         {
             //open gate
         }
    }
    else
    {
        //close gate
    }
    return true;
}
Password should be a string + sscanf (if you're using the plugin) requires string sizes .
Reply
#4

Yeah sorry 'bout that - I had just woken up and was really tired.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)