GetLeaderFaction
#1

How to create stock "GetLeaderFaction" and extracted from my MySQL database name of the player who is leader the faction?
Exemple:
Код HTML:
new string[64];
format(string, sizeof(string), "The Ballas - Leader: %s", GetLeaderFaction(5)); //5 = Faction ID
SendClientMessage(playerid, -1, string);
Reply
#2

Start up.

Learn:
https://sampwiki.blast.hk/wiki/MySQL
https://sampforum.blast.hk/showthread.php?tid=56564
Reply
#3

Sadly to return the string, you cant thread the query. So;
Код:
GetFactionLeader(id)
{
	mysql_format(g_SQL, Query, sizeof (Query), "SELECT `Nick` FROM `Factions` WHERE `id` = '%i'", id);

	new 
		name[MAX_PLAYER_NAME + 1],
		Cache:result = mysql_query(g_SQL, Query)
	;

    if (cache_num_rows()) {
	   	cache_get_field_content(0, "Nick", name);
	}
	else 
	{
		format(name, sizeof (name), "None");
	}

	cache_delete(result);
	return name;
}
Reply
#4

Ralfie, thank you very much!!! +REP.
Reply
#5

Quote:
Originally Posted by norton2
Посмотреть сообщение
Ralfie, thank you very much!!! +REP.
and we do not want to learn
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)