SA-MP Forums Archive
Another query problem - 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: Another query problem (/showthread.php?tid=494904)



Another query problem - Mauricee - 15.02.2014

Код:
YCMD:setadminoff(playerid, params[],help)
{
	if(PlayerData[playerid][Admin] < 6) return SendClientMessage(playerid, COLOR_WHITE, AdminOnly);
	new level,vname[25],query[128];
	if(sscanf(params, "s[25]i", vname, level)) return SendUsage(playerid,"/setadminoff <Exact Name> <level>");	
	if(level > 6 || level < 0)  return SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: Invalid admin level.");
	
	mysql_format(SQL, query, 128, "SELECT `id` FROM `users` WHERE LOWER(username) = LOWER('%s') LIMIT 1",vname);
	mysql_tquery(SQL, query, "AdminOff", "s[25]ii", vname,level,playerid);
	
	return 1;
}

function AdminOff(vname[],level,playerid)
{
	new str[128], string[128];
	if(cache_num_rows() == 0) return SendClientMessage(playerid, COLOR_WHITE,"{FFFFCC}Error: [MYSQL]Player doesn't exist."); 

	format(string, sizeof(string), "You have promoted %s to a level %d admin. (offline)", vname,level);
	SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
	format(string, sizeof(string), "AdmCmd: %s has promoted %s to a level %d admin. (offline)", PlayerData[playerid][Name], vname,level);
	ABroadCast(COLOR_LIGHTBLUE, string, 1);
	
	mysql_format(SQL, str,128,"UPDATE `users` SET `Admin`='%d' WHERE `username`='%s' LIMIT 1",level,vname);
	mysql_tquery(SQL, str, "", "");
	
	return 1;
}
Quote:

mysql_tquery ERROR callback parameter count does not match format specifier length




Re: Another query problem - Konstantinos - 15.02.2014

Change:
pawn Код:
mysql_tquery(SQL, query, "AdminOff", "s[25]ii", vname,level,playerid);
to:
pawn Код:
mysql_tquery(SQL, query, "AdminOff", "sii", vname,level,playerid);



Re: Another query problem - Mauricee - 15.02.2014

Solved, thank you!