SA-MP Forums Archive
Problems with name change on MySQL !!! - 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)
+--- Thread: Problems with name change on MySQL !!! (/showthread.php?tid=405017)



Problems with name change on MySQL !!! - niconhan - 05.01.2013

Hey guy! I have problems with MySQL on my server. When i use command /nrn for player . Dialog will show for player but i can't /approvename [playerid] . Name of player can't change ... Help me
http://pastebin.com/szFVjmDc
Command /approvename
Код:
CMD:approvename(playerid, params[])
{
	new query[128], giveplayerid;
	if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /approvename [player]");

	if(IsPlayerConnected(giveplayerid))
	{
		if (PlayerInfo[playerid][pAdmin] >= 3)
		{
			if(GetPVarInt(giveplayerid, "RequestingNameChange") == 0)
			{
				SendClientMessageEx(playerid, COLOR_GRAD2, "That person isn't requesting a namechange!");
				return 1;
			}
			new newname[MAX_PLAYER_NAME], tmpName[24];
			GetPVarString(giveplayerid, "NewNameRequest", newname, MAX_PLAYER_NAME);
			mysql_real_escape_string(newname, tmpName);
			SetPVarString(giveplayerid, "NewNameRequest", tmpName);

			format(query, sizeof(query), "SELECT `Username` FROM `accounts` WHERE `Username`='%s'", tmpName);
			mysql_function_query(MainPipeline, query, true, "OnApproveName", "ii", playerid, giveplayerid);
		}
		else
		{
			SendClientMessageEx(playerid, COLOR_GRAD2, "You aren't authorized to use this command.");
		}
	}
	else
	{
		SendClientMessageEx(playerid, COLOR_GRAD2, "No Such Player");
	}
	return 1;
}