Problem MYSQL Command.
#1

Hi, i got this command to uninvite a player from a faction but i receive an MYSQL Error.

Command:
Код HTML:
CMD:auninvite(playerid, params[])
{
	if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
	if (PlayerInfo[playerid][pAdmin] >= 4)
	{
		new id, string[512], reason[64], fp;
		if(sscanf(params, "uis[64]", id, fp, reason)) return SCM(playerid,COLOR_WHITE,"{B8DBFF}Synthax: /auninvite <Name/Playerid> <FactionPunish(0-20)> <Reason>");
		if(IsPlayerConnected(id))
		{
			if(id != INVALID_PLAYER_ID)
    		{
      			if(PlayerInfo[id][pMember] == 0 && PlayerInfo[id][pLeader] == 0) return SendClientMessage(playerid,COLOR_WHITE,"{FF0000}* {FFFFFF}That player isn't in a faction.");
	        	new x;
		        x = PlayerInfo[playerid][pMember];
				new dayz, str2[128];
				mysql_format(SQL, gQuery, sizeof(gQuery), "SELECT `FactionTime` = '%d' from `users` WHERE `ID` = '%d'", PlayerInfo[id][pSQLID]);
				new Cache: resa = mysql_query(SQL, gQuery);
				for ( new i, j = cache_get_row_count ( ); i != j; ++i )
				{
					cache_get_field_content(i, "FactionTime", gQuery); dayz = strval(gQuery);
				}
				cache_delete(resa);
				format(string, sizeof(string), "{FF0000}* You have been kicked from %s, by %s %s, reason: %s with %d Faction Punish.",DynamicFactions[PlayerInfo[id][pMember]][fName], GetAdminRank(playerid), GetName(playerid),reason, fp);
				SendSplitMessage(id, COLOR_WHITE, string);
				format(string, sizeof(string), "%s has been uninvited by %s %s from %s after %d days, reason: %s with %d faction punish.", GetName(id), GetAdminRank(playerid), GetName(playerid), DynamicFactions[PlayerInfo[id][pMember]][fName], dayz, reason, fp);
				SendFamilyMessage(x, COLOR_SYN2, string);
    			PlayerInfo[id][pMember] = 0;
      			PlayerInfo[id][pLeader] = 0;
      			PlayerInfo[id][pRank] = 0;
				PlayerInfo[id][pChar] = 3;
				PlayerInfo[id][pFACWarns] = 0;
				PlayerInfo[id][pFpunish] = fp;
    			Update(id, pFpunishx);
				PlayerInfo[id][pFactionTime] = 0;
				gTeam[id] = 3;
				PlayerInfo[id][pTeam] = 3;
				PlayerInfo[id][pModel] = 3;
				SetPlayerSkin(id, PlayerInfo[id][pModel]);
				OnDuty[id] = 0;
				tazer[id] = 0;
				SetPlayerArmourEx(id, 0);
				SetPlayerSkin(id, PlayerInfo[id][pModel]);
				SpawnPlayer(id);
				mysql_format(SQL, gQuery, sizeof(gQuery), "UPDATE users SET `Member`='0',`Leader`='0',`Rank`='0',`CChar`='3',`FWarn`='0',`Team`='3',`FactionTime`='0' WHERE `name`='%s'", GetName(playerid));
				mysql_tquery(SQL, gQuery, "", "");
				return 1;
			}
		}
		else
 		{
             SendClientMessage(playerid, COLOR_WHITE, "{FF0000}* {FFFFFF}Error, Player not connected.");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_WHITE, AdminOnly);
	}
	return 1;
}
Error is:
Код HTML:
[08:46:02] [ERROR] mysql_format - no value for specifier "%d" available
Reply
#2

your query is incorrect you don't need to tell it what the value of faction time is if that's the value your trying to receive, remove the '= %d' from your query
Reply
#3

You mean this?:
mysql_format(SQL, gQuery, sizeof(gQuery), "SELECT `FactionTime` = '%d' from `users` WHERE `ID` = '%d'", PlayerInfo[id][pSQLID]);
Reply
#4

Thank's it worked !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)