11.11.2014, 17:25
I have a problem with the next response:
every name i put it's says me that it is already taken but it isn't. what is wrong? i am using mysql r39-2 , the response is for a dialog who change your name but no name is valid because it's saying it's already taken.
pawn Код:
case 696:
{
if(response)
{
if(!isnull(inputtext))
{
new playerName[1][MAX_PLAYER_NAME],querySz[150];
format(querySz, sizeof(querySz), "SELECT playerName FROM playeraccounts WHERE playerName = '%s'", inputtext);
mysql_tquery(handle, querySz);
cache_get_data(rows, fields, handle);
if(rows > 0)
{
SendClientMessage(playerid, COLOR_GREY, "That name is already taken.");
return 1;
}
GetPlayerName(playerid, playerName[0], MAX_PLAYER_NAME);
mysql_format(handle, querySz, sizeof(querySz), "UPDATE playeraccounts SET playerName = '%e' WHERE playerID = '%d'", inputtext, playerVariables[playerid][pInternalID]);
mysql_tquery(handle, querySz); // No point in threading a simple response...
format(querySz, sizeof(querySz), "You have changed your name to %s.", inputtext);
SendClientMessage(playerid, COLOR_WHITE, querySz);
SetPlayerName(playerid, inputtext);
strcpy(playerVariables[playerid][pNormalName], inputtext, MAX_PLAYER_NAME);
playerVariables[playerid][pPremiumPoints] -= 20;
}
else
{
SCM(playerid, -1,"Invalid new nickname.");
}
}
}