SA-MP Forums Archive
MySQL Cmd - 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: MySQL Cmd (/showthread.php?tid=535538)



MySQL Cmd - TonyNames - 04.09.2014

Hi there.

Whenever i create a faction it saves into the MySQL but everytime i do /makeleader it wont enter the faction like the faction dosent exist all i say is

Quote:

Admin %s has just given you leader rank in faction .

Here is the whole command

Код:
CMD:makeleader(playerid, params[])
{
	if(!CheckAdmin(playerid, HIGH_ADMIN_LEVEL)) return NotAuthMSG(playerid);
	new id, faction;
	if(sscanf(params,"ud",id,faction)) return SyntaxMSG(playerid, "/makeleader [playerid] [factionid(/factions)]");
	if(!PlayerIsOn(id)) return NotConnectedMSG(playerid);
	format(msg, sizeof(msg), "AdmCmd: %s has just given %s leader rank in faction %s.", GetName(playerid), GetName(id), GetShortFactionName(faction));
	AMSG(COLOR_LIGHTRED, msg);
	format(msg, sizeof(msg), "Admin %s has just given you leader rank in faction %s.", GetName(playerid), GetShortFactionName(faction));
	SCM(id, COLOR_LIGHTRED, msg);
	PlayerInfo[id][pRank] = Factions[faction][fLeaderRank];
	PlayerInfo[id][pFaction] = faction; 
	PlayerInfo[id][pBadgeNumber] = randomEx(23465, 99999);
	return 1;
}
Do i need a query or something?

P.S. how do i make it to a pawn code on the forums? instead of just [code]


Re: MySQL Cmd - TonyNames - 04.09.2014

shall i make a query like this?Ё
Код:
	format(query, sizeof(query), "UPDATE `factions` SET `leaderrank` = %d WHERE `id` = %d", rank, Factions[factionid][fID]);
	mysql_function_query(dbHandle, query, false, "", "");
	return 1;



Re: MySQL Cmd - TonyNames - 04.09.2014

i'm a bit confused about this one
Код:
format(query, sizeof(query), "UPDATE `factions` SET `leaderrank` = %d WHERE `id` = %d", rank, Factions[factionid][fID]);
	mysql_function_query(dbHandle, query, false, "", "");
	return 1;



Re: MySQL Cmd - TunisianoGamer - 04.09.2014

I think there is nothing wrong with that query . You should test it


Re: MySQL Cmd - TonyNames - 05.09.2014

But it gives me undefined symbol ''rank''


Re: MySQL Cmd - TunisianoGamer - 06.09.2014

Quote:

New rank = Factions[faction][fLeaderRank];

format(query, sizeof(query), "UPDATE `factions` SET `leaderrank` = %d WHERE `id` = %d", rank, Factions[factionid][fID]);
mysql_function_query(dbHandle, query, false, "", "");

return 1;