Help me - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help me (
/showthread.php?tid=270167)
Help me -
zombieking - 19.07.2011
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
Re: Help me -
zombieking - 19.07.2011
Cmon , No one want to help me?
Re: Help me -
Wesley221 - 19.07.2011
No need to bump your thread in 4 minutes. Give the people some time..
Re: Help me -
zombieking - 19.07.2011
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?
Re: Help me -
MoroDan - 19.07.2011
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.
Re: Help me -
Wesley221 - 19.07.2011
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;
}
Re: Help me -
Roko_foko - 19.07.2011
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.
Re: Help me -
MoroDan - 19.07.2011
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 ?
Re: Help me -
zombieking - 19.07.2011
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
Re: Help me -
Cameltoe - 19.07.2011
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;
}