Help me
#1

Hello , well i wanna make a command:

I type /adminlogin and it will say USAGE: /adminlogin [password] , and if the wrong password is given it should display "Wrong Password" And if i give the good password (which is lol) it should say "You succesfully logged in as admin" How to do that?

P.S:Not rcon , but a normal command
Reply
#2

Cmon , No one want to help me?
Reply
#3

No need to bump your thread in 4 minutes. Give the people some time..
Reply
#4

Quote:
Originally Posted by Wesley221
Посмотреть сообщение
No need to bump your thread in 4 minutes. Give the people some time..
And if you are here , why you dont help me?
Reply
#5

Quote:
Originally Posted by zombieking
Посмотреть сообщение
Hello , well i wanna make a command:

I type /adminlogin and it will say USAGE: /adminlogin [password] , and if the wrong password is given it should display "Wrong Password" And if i give the good password (which is lol) it should say "You succesfully logged in as admin" How to do that?

P.S:Not rcon , but a normal command
Do you use any system which saves the player data ? Like password, level, moneys etc.
Reply
#6

pawn Код:
CMD:login(playerid, cmdtext[])
{
    new Password;
    if(!sscanf(cmdtext, "s[50]", Password))
    {
        if(Password == "Lol") // Password is lol
        {
            SendClientMessage(playerid, -1, "You succesfully logged in as admin");
        } else {
            // If password != Lol
        }
    }
    return 1;
}
Reply
#7

Quote:
Originally Posted by Wesley221
Посмотреть сообщение
pawn Код:
CMD:login(playerid, cmdtext[])
{
    new Password;
    if(!sscanf(cmdtext, "s[50]", Password))
    {
        if(Password == "Lol") // Password is lol
        {
            SendClientMessage(playerid, -1, "You succesfully logged in as admin");
        } else {
            // If password != Lol
        }
    }
    return 1;
}
I've got some questions about this.
pawn Код:
if(!sscanf(cmdtext, "s[50]", Password))
s[50], what does this do? I would just put 's' and variable Password would be array.
pawn Код:
new Password[20];
if(!sscanf(cmdtext, "s", Password))
How can in a single, non-array variable, be stored whole string?
And, is it possible to compare two strings with '==' ? I would do that with strcmp.
I guess the same answer will be for all my questions.
Reply
#8

Quote:
Originally Posted by Wesley221
Посмотреть сообщение
pawn Код:
CMD:login(playerid, cmdtext[])
{
    new Password;
    if(!sscanf(cmdtext, "s[50]", Password))
    {
        if(Password == "Lol") // Password is lol
        {
            SendClientMessage(playerid, -1, "You succesfully logged in as admin");
        } else {
            // If password != Lol
        }
    }
    return 1;
}
new Password;
if(Password == "Lol")

Are you sure ?
Reply
#9

Quote:
Originally Posted by Wesley221
Посмотреть сообщение
pawn Код:
CMD:login(playerid, cmdtext[])
{
    new Password;
    if(!sscanf(cmdtext, "s[50]", Password))
    {
        if(Password == "Lol") // Password is lol
        {
            SendClientMessage(playerid, -1, "You succesfully logged in as admin");
        } else {
            // If password != Lol
        }
    }
    return 1;
}
pawn Код:
C:\Documents and Settings\DANY\Desktop\Untitled4.pwn(93) : error 029: invalid expression, assumed zero
C:\Documents and Settings\DANY\Desktop\Untitled4.pwn(93) : error 017: undefined symbol "cmd_login"
C:\Documents and Settings\DANY\Desktop\Untitled4.pwn(93) : error 029: invalid expression, assumed zero
C:\Documents and Settings\DANY\Desktop\Untitled4.pwn(93) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
not working
Reply
#10

pawn Код:
command(login, playerid, params[])
{
     if(strmatch(params, "Test"))
     {
          SendClientMessage(playerid, -1, "You succesfully logged in as admin");
     }
     else
     {
          printf("[Server] ID : %d wrong admin password", playerid);
     }
     return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)