Command Help - 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: Command Help (
/showthread.php?tid=548914)
Command Help - Diti1 - 03.12.2014
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(playerid, params[])
{
new string[90],count=0;
for(new i=0;i<MAX_PLAYERS;i++)
{
if(PlayerInfo[i][playerteam] == COPS) count++;
}
format(string, sizeof(string), "Los Santos Police Department:Members [%d/45]", count);
SendClientMessage(playerid, -1, string);
for(new i=0;i<MAX_PLAYERS;i++)
{
if(PlayerInfo[i][playerteam] == FBI) count++;
}
format(string, sizeof(string), "FBI Online Members:[%d/45]",count);
SendClientMessage(playerid, -1, string);
for(new i=0;i<MAX_PLAYERS;i++)
{
if(PlayerInfo[i][playerteam] == CORLEONE) count++;
}
format(string, sizeof(string), "Corleone Online Members:[%d/45]",count);
SendClientMessage(playerid, -1, string);
Re: Command Help -
xCrazyMonkey - 03.12.2014
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.
Re: Command Help - Diti1 - 03.12.2014
Can you give me a example ?
Re: Command Help -
xCrazyMonkey - 03.12.2014
PHP код:
COMMAND:factions(playerid, params[])
{
new string[90], copcount = 0, fbicount = 0, corleonecount = 0;
for(new i=0;i<MAX_PLAYERS;i++)
{
if(PlayerInfo[i][playerteam] == COPS) copcount++;
}
format(string, sizeof(string), "Los Santos Police Department:Members [%d/45]", copcount);
SendClientMessage(playerid, -1, string);
for(new i=0;i<MAX_PLAYERS;i++)
{
if(PlayerInfo[i][playerteam] == FBI) fbicount++;
}
format(string, sizeof(string), "FBI Online Members:[%d/45]",fbicount);
SendClientMessage(playerid, -1, string);
for(new i=0;i<MAX_PLAYERS;i++)
{
if(PlayerInfo[i][playerteam] == CORLEONE) corleonecount++;
}
format(string, sizeof(string), "Corleone Online Members:[%d/45]",corleonecount);
SendClientMessage(playerid, -1, string);
I hope this solves your problem.
Re: Command Help - Diti1 - 03.12.2014
Thank you now is working good REPPED