31.07.2016, 20:11
The code you provided /factions does nothing.
However this code here. Gives me all the faction names on my database. Similarly I just want to add online and total faction members here. The reason why you don't see anything with total members is because I haven't scripted it. I have no idea how to do that. If you don't mind could you make it compatiable with what I have right now.
I just want to show all the factions with current members on out of total faction members.
Below code simply displays you a dialog with all the faction name. Now I just want to add total online members and total faction members.
The way I was thinking to get total members of that one specific faction was simply go to table `accounts` then loop through`factionid` column. Everytime a factionid is repeated simply add one everytime which should give me the total addition of factionid mentioned. Then simply tie that back to my faction name. That way I can tie faction name and total faction members.
Also my `Factions` table looks something like this
"ID" refers to faction ID.
And my `accounts` table looks something like this
"factionid" refers to Faction ID.
The table `Factions` are all the factions created in the server. The faction ID is setup using A_I.
As soon as I do /createfaction the user who created faction I update their `accounts` and put their `factionid` as same as the `Factions` ID.
However this code here. Gives me all the faction names on my database. Similarly I just want to add online and total faction members here. The reason why you don't see anything with total members is because I haven't scripted it. I have no idea how to do that. If you don't mind could you make it compatiable with what I have right now.
I just want to show all the factions with current members on out of total faction members.
Below code simply displays you a dialog with all the faction name. Now I just want to add total online members and total faction members.
PHP код:
CMD:factions(playerid,params[])
{
mysql_tquery(mysql, "SELECT * FROM `Factions` LIMIT "#MAX_FACTIONS"", "LoadFactionsIG", "i",playerid);
return 1;
}
forward LoadFactionsIG(playerid);
public LoadFactionsIG(playerid)
{
if(playerid == INVALID_PLAYER_ID) return 1;
new rows,fields,str[160];
cache_get_data(rows,fields,mysql);
if(!rows) return 1;
new fracName[32];
for (new i; i < rows; i++)
{
cache_get_field_content_int(i, "factionid");
cache_get_field_content(i, "Name",fracName,mysql);
format(str, sizeof(str), "%s%s \n",str,fracName);
}
ShowPlayerDialog(playerid, 10, DIALOG_STYLE_MSGBOX, "Factions", str, "OK","");
return 1;
}
Also my `Factions` table looks something like this
"ID" refers to faction ID.
And my `accounts` table looks something like this
"factionid" refers to Faction ID.
The table `Factions` are all the factions created in the server. The faction ID is setup using A_I.
As soon as I do /createfaction the user who created faction I update their `accounts` and put their `factionid` as same as the `Factions` ID.