Command Help
#1

Hey boys i created a command /factions with online faction members but when i use it and i invite my self to a faction and i do /factions it shows me like all factions have 1 player but i am only online.


Codes

PHP код:
COMMAND:factions(playeridparams[])
{
new 
string[90],count=0;
for(new 
i=0;i<MAX_PLAYERS;i++)
{
    if(
PlayerInfo[i][playerteam] == COPScount++;
}
format(stringsizeof(string), "Los Santos Police Department:Members [%d/45]"count);
SendClientMessage(playerid, -1string);
for(new 
i=0;i<MAX_PLAYERS;i++)
{
    if(
PlayerInfo[i][playerteam] == FBIcount++;
}
format(stringsizeof(string), "FBI Online Members:[%d/45]",count);
SendClientMessage(playerid, -1string);
for(new 
i=0;i<MAX_PLAYERS;i++)
{
    if(
PlayerInfo[i][playerteam] == CORLEONEcount++;
}
format(stringsizeof(string), "Corleone Online Members:[%d/45]",count);
SendClientMessage(playerid, -1string); 
Reply
#2

What I think is that you just made one variable which counts the amount of players in the faction.
Your variable is named "count", and you want to show the amount of players per faction, right?
I suggest you make more variables that counts for you how many players there is in a certain faction.
Reply
#3

Can you give me a example ?
Reply
#4

PHP код:
COMMAND:factions(playeridparams[]) 

new 
string[90], copcount 0fbicount 0corleonecount 0
for(new 
i=0;i<MAX_PLAYERS;i++) 

    if(
PlayerInfo[i][playerteam] == COPScopcount++; 

format(stringsizeof(string), "Los Santos Police Department:Members [%d/45]"copcount); 
SendClientMessage(playerid, -1string); 
for(new 
i=0;i<MAX_PLAYERS;i++) 

    if(
PlayerInfo[i][playerteam] == FBIfbicount++; 

format(stringsizeof(string), "FBI Online Members:[%d/45]",fbicount); 
SendClientMessage(playerid, -1string); 
for(new 
i=0;i<MAX_PLAYERS;i++) 

    if(
PlayerInfo[i][playerteam] == CORLEONEcorleonecount++; 

format(stringsizeof(string), "Corleone Online Members:[%d/45]",corleonecount); 
SendClientMessage(playerid, -1string); 
I hope this solves your problem.
Reply
#5

Thank you now is working good REPPED
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)