11.09.2013, 17:03
Hey everyone.
I'm creating a registration system using MySQL based on a tutorial in the Tutorials forum, but I'm facing a strange compile warning which has nothing to do with the registration system at all! I've tried figuring it out myself, but I can't see the problem.
Alright, this is the warning message I am getting:
This line number (285) is referring to the format() line below:
I don't think that I'm missing a parameter in the format function; I'm setting the variable, the length, the format and lastly, the replacements.
What is wrong with my code that I'm not seeing?
Thank you.
EDIT:
I just noticed that I've used GetPlayerName() incorrectly. I've fixed this issue by doing the following:
Then I used the pName instead of GetPlayerName(playerid) as a format() parameter.
I'm creating a registration system using MySQL based on a tutorial in the Tutorials forum, but I'm facing a strange compile warning which has nothing to do with the registration system at all! I've tried figuring it out myself, but I can't see the problem.
Alright, this is the warning message I am getting:
Quote:
Originally Posted by Pawno
C:\samp\gamemodes\dugi.pwn(285) : warning 202: number of arguments does not match definition
C:\samp\gamemodes\dugi.pwn(285) : warning 202: number of arguments does not match definition |
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new string[164];
if (dialogid == DIALOG_REGISTER)
{
if (strlen(inputtext) == 0)
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", string, "Register", "");
}
else
{
new clean_pass[60], query[80];
mysql_real_escape_string(inputtext, clean_pass);
format(query, sizeof(query), "INSERT INTO `server_players` (playername, player_pass, player_money) VALUES ('%s', '%s', '0')", GetPlayerName(playerid), clean_pass);
mysql_query(query);
if (mysql_affected_rows() != 0)
{
SendClientMessage(playerid, COLOR_WHITE, "You have been successfully registered to the server. Welcome!");
GivePlayerMoney(playerid, 5000);
SetPlayerScore(playerid, 100);
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "An unexpected error occurred. Please try again.");
}
}
}
return 1;
}
What is wrong with my code that I'm not seeing?
Thank you.
EDIT:
I just noticed that I've used GetPlayerName() incorrectly. I've fixed this issue by doing the following:
pawn Код:
new pName[24];
GetPlayerName(playerid, pName, 24);