Not registering - Callback Parameter
#1

I can't see the problem.

After you type a password in upon registration it logs you saying the account has registered successfully but the data dosen't save after checking the logs the callback parameter could not match.

Код:
[01:53:08] [DEBUG] mysql_format - connection: 1, len: 800, format: "INSERT INTO `players` (`name`,`Level`,`pass`,`kills`,`deaths`,`rounds`,`xp`,`cash`,`IP`) VALUES ('%e','0','%e', 0, 0, 0, 0, 0, '..."
[01:53:08] [DEBUG] mysql_tquery - connection: 1, query: "INSERT INTO `players` (`name`,`Level`,`pass`,`kills`,`deaths`,`r", callback: "OnAccountRegister", format: "d"
[01:53:08] [ERROR] mysql_tquery - callback parameter count does not match format specifier length
Код:
      
new query[800];
WP_Hash(PlayerInfo[playerid][Pass], 129, inputtext);
mysql_format(mysql, query, sizeof(query), "INSERT INTO `players` (`name`,`Level`,`pass`,`kills`,`deaths`,`rounds`,`xp`,`cash`,`IP`) VALUES ('%e','0','%e', 0, 0, 0, 0, 0, '%e')", GetName(playerid),PlayerInfo[playerid][Pass],GetIp(playerid));
mysql_tquery(mysql, query, "OnAccountRegister", "d");
PlayerInfo[playerid][Logged] = 1;
SendClientMessage(playerid, -1, "{FFFF00}[ACCOUNT]: {FFFFFF}Account succesfuly registered.");
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
Reply
#2

I think the main issue is that you give no arguments, yet give specifiers.
Код:
mysql_tquery(mysql, query, "OnAccountRegister", "d");
You're missing "playerid" at the end. Additionally, instead of placing code beneath this, you should place it into OnAccountRegister. This would become:
Код:
public OnAccountRegister(playerid)
{ 
      if(cache_insert_id() == -1)
            return 1; // row wasn't created, error handling goes here

      PlayerInfo[playerid][Logged] = 1;
      SendClientMessage(playerid, -1, "{FFFF00}[ACCOUNT]: {FFFFFF}Account succesfuly registered.");
      PlayerPlaySound(playerid,1057,0.0,0.0,0.0);

      // whatever else
      return true;
}
This logically makes more sense and also allows you to properly handle errors, such as the row not being created. You could also further optimize this by making Logged a boolean, instead of an integer (assuming it's only using 0 and 1 as values).
Reply
#3

Quote:
Originally Posted by Abagail
Посмотреть сообщение
I think the main issue is that you give no arguments, yet give specifiers.
Код:
mysql_tquery(mysql, query, "OnAccountRegister", "d");
You're missing "playerid" at the end. Additionally, instead of placing code beneath this, you should place it into OnAccountRegister. This would become:
Код:
public OnAccountRegister(playerid)
{ 
      if(cache_insert_id() == -1)
            return 1; // row wasn't created, error handling goes here

      PlayerInfo[playerid][Logged] = 1;
      SendClientMessage(playerid, -1, "{FFFF00}[ACCOUNT]: {FFFFFF}Account succesfuly registered.");
      PlayerPlaySound(playerid,1057,0.0,0.0,0.0);

      // whatever else
      return true;
}
This logically makes more sense and also allows you to properly handle errors, such as the row not being created. You could also further optimize this by making Logged a boolean, instead of an integer (assuming it's only using 0 and 1 as values).
I added this in, it compiled i double checked everything again and it's just not registering still.

Код:
[14:48:31] [DEBUG] Calling callback "OnAccountCheck"..
[14:48:31] [DEBUG] cache_get_data - connection: 1
[14:48:31] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[14:48:34] [DEBUG] mysql_format - connection: 1, len: 800, format: "INSERT INTO `players` (`name`,`Level`,`pass`,`kills`,`deaths`,`rounds`,`xp`,`cash`,`IP`) VALUES ('%e','0','%e', 0, 0, 0, 0, 0, '..."
[14:48:34] [DEBUG] mysql_tquery - connection: 1, query: "INSERT INTO `players` (`name`,`Level`,`pass`,`kills`,`deaths`,`r", callback: "OnAccountRegister", format: "d"
[14:48:34] [ERROR] mysql_tquery - callback parameter count does not match format specifier length
[14:48:40] [DEBUG] mysql_format - connection: 1, len: 256, format: "UPDATE `players` SET `kills`='%d', `deaths`='%d', `cash`='%d', `Level`='%d', `rounds`='%d', `xp`='%d' WHERE `name` = '%e'"
[14:48:40] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE `players` SET `kills`='0', `deaths`='0', `cash`='0', `Lev", callback: "(null)", format: "(null)"
Obviously OnAccountCheck is the first thing called, checking if a player is registered or not then it attempts to call OnAccountRegister and then " Callback OnPlayerAccountRegister isn't functioning.
Reply
#4

Bump.
Reply
#5

Last bump.
Reply
#6

Was fixed. - Thanks iLearner.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)