Auto Login
#1

Код:
 error 035: argument type mismatch (argument 2)
warning 204: symbol is assigned a value that is never used: "ip"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Код:
 switch(dialogid)
    {
        case LoginDialog:
        {
            if(!response) Kick(playerid);

            new hashpass[129], query[100], string[100];

            WP_Hash(hashpass, sizeof(hashpass), inputtext);
            new ip[16];
           	GetPlayerIp(playerid, IP[playerid], 16);

            if (!strcmp(IP[playerid], 16, true))
            {
                 mysql_format(mysql, query, sizeof(query), "SELECT * FROM `accounts` WHERE `Name` = '%e' LIMIT 1", Name[playerid]);
	             mysql_tquery(mysql, query, "OnAccountLoad", "i", playerid);
            }
            else
            if(!strcmp(hashpass, PlayerInfo[playerid][Password]))
            {
                mysql_format(mysql, query, sizeof(query), "SELECT * FROM `accounts` WHERE `Name` = '%e' LIMIT 1", Name[playerid]);
                mysql_tquery(mysql, query, "OnAccountLoad", "i", playerid);
            }
            else
            {
           	    GetPlayerName(playerid, Name[playerid], 24);
                format(string, sizeof string, "Welcome %s!\nYour account has been found in our database. Please fill in your password:", Name[playerid]);
                ShowPlayerDialog(playerid, LoginDialog, DIALOG_STYLE_INPUT, "Welcome to Server", string, "Login", "Leave");
                SendClientMessage(playerid, -1, "{FF0000}Wrong Password, Please Try Again!");
            }
        }
Reply
#2

Код:
if (!strcmp(IP[playerid], 16, true))
Second parameter should be an array/string.
strcmp(const string1[], const string2[], bool:ignorecase=false, length=cellmax)

and also remove this code
Код:
new ip[16];
as that variable is never used.
Reply
#3

Quote:
Originally Posted by X337
Посмотреть сообщение
Код:
if (!strcmp(IP[playerid], 16, true))
Second parameter should be an array/string.
strcmp(const string1[], const string2[], bool:ignorecase=false, length=cellmax)

and also remove this code
Код:
new ip[16];
as that variable is never used.
it shows the dialog login but not auto login
Код:
            GetPlayerIp(playerid, IP[playerid], 16);
            GetPlayerName(playerid, Name[playerid], 24);
            if(!strcmp(IP[playerid], IP[playerid]))
            {
                 mysql_format(mysql, query, sizeof(query), "SELECT * FROM `accounts` WHERE `Name` = '%e' LIMIT 1", Name[playerid]);
	             mysql_tquery(mysql, query, "OnAccountLoad", "i", playerid);
            }
            else if(!strcmp(hashpass, PlayerInfo[playerid][Password]))
            {
                mysql_format(mysql, query, sizeof(query), "SELECT * FROM `accounts` WHERE `Name` = '%e' LIMIT 1", Name[playerid]);
                mysql_tquery(mysql, query, "OnAccountLoad", "i", playerid);
            }
Reply
#4

If you declared this:

Код:
new ip[16];
lowercase, why do you call for it:

Код:
GetPlayerIp(playerid, IP[playerid], 16);
uppercase?

Also, why did you put [playerid] on side of it? It should be:

Код:
GetPlayerIp(playerid,ip,16);
https://sampwiki.blast.hk/wiki/GetPlayerIp

Please, read some documentation and try to figure out your own problems, you have 1,547 posts yet you can't solve a simple warning by yourself? You need to put effort into it.
Reply
#5

Quote:
Originally Posted by Troydere
Посмотреть сообщение
If you declared this:

Код:
new ip[16];
lowercase, why do you call for it:

Код:
GetPlayerIp(playerid, IP[playerid], 16);
uppercase?

Also, why did you put [playerid] on side of it? It should be:

Код:
GetPlayerIp(playerid,ip,16);
https://sampwiki.blast.hk/wiki/GetPlayerIp

Please, read some documentation and try to figure out your own problems, you have 1,547 posts yet you can't solve a simple warning by yourself? You need to put effort into it.
I don't need that. it already needed
Код:
static Name[MAX_PLAYERS][24], IP[MAX_PLAYERS][16];
Look back at the code.




Still 1 error

if (!strcmp(IP[playerid], 16, true))

Код:
(1758) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#6

I edited my previous post, but as you've read it already i'll post it in here.

[EDIT] Also also:

Код:
if (!strcmp(IP[playerid], 16, true))
What are you trying to do here?

Strcmp (string compare) is used to compare two strings.

Please read this documentation : https://sampwiki.blast.hk/wiki/Strcmp and try to fix that line of code by yourself, if you have any more questions keep asking only after you have read that.
Reply
#7

Quote:
Originally Posted by Troydere
Посмотреть сообщение
I edited my previous post, but as you've read it already i'll post it in here.

[EDIT] Also also:

Код:
if (!strcmp(IP[playerid], 16, true))
What are you trying to do here?

Strcmp (string compare) is used to compare two strings.

Please read this documentation : https://sampwiki.blast.hk/wiki/Strcmp and try to fix that line of code by yourself, if you have any more questions keep asking only after you have read that.
as i said still the same error.
Reply
#8

Are you serious? Please read this: https://sampwiki.blast.hk/wiki/Strcmp and try to figure out how to fix this line of code:
Код:
if (!strcmp(IP[playerid], 16, true))
by yourself.

Don't just copy and paste and ignore everything i'm saying. The point is to learn.
Reply
#9

it still showing the dialog login


Код:
            if (!strcmp(IP[playerid], string, true))
            {
                 mysql_format(mysql, query, sizeof(query), "SELECT * FROM `accounts` WHERE `Name` = '%e' LIMIT 1", Name[playerid]);
	             mysql_tquery(mysql, query, "OnAccountLoad", "i", playerid);
            }
            else if(!strcmp(hashpass, PlayerInfo[playerid][Password]))
            {
                mysql_format(mysql, query, sizeof(query), "SELECT * FROM `accounts` WHERE `Name` = '%e' LIMIT 1", Name[playerid]);
                mysql_tquery(mysql, query, "OnAccountLoad", "i", playerid);
            }
Reply
#10

Ok well.. this will be a long thread.

Let me explain a bit, what you want to do with strcmp is to compare two strings, in this case, both the actual player ip address and the stored player ip address, if they don't match, you send them the login dialog request.

in your case
Код:
 if (!strcmp(IP[playerid], string, true))
STRING should be replaced for the player's ip address loaded from your database, as I don't handle mysql, I cant say too much, but it's pretty obvious that you have to unload that value from the database first, which as far as I can see you are not doing.

Kinda get it?
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)