Question and 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: Question and Help (
/showthread.php?tid=636033)
Question and Help -
StR_MaRy - 18.06.2017
Hey guys i have a dynamic faction and after i add a new faction i want to add it on /factions command but is just a problem i have something like
HTML Code:
FactionInfo[6][fInfo]
so i can see on /factions only 5 factions
HTML Code:
CMD:factions(playerid)
{
if(gLogged[playerid] == 0) return SendClientMessage(playerid,COLOR_ERROR, "Tu nu esti logat si nu poti sa folosesti aceasta comanda!");
new var[1024];
new coordsstring[64] = "ID\tNume\tMembrii/Sloturi\tAplicatii\n";
for(new i = 1; i < sizeof(FactionInfo); i++)
{
format(gString, sizeof(gString), "%d.\t%s\t[%d/%d]\t%s\n", i, FactionInfo[i][fName], GetFactionMembers(i), FactionInfo[i][fSlots], GetFactionStatus(i));
strcat(var, gString);
}
strins(var, coordsstring, 0);
ShowPlayerDialog(playerid, DIALOG_FACTIONS, DIALOG_STYLE_TABLIST_HEADERS, "Factiuni", var, "Inchide", "");
return 1;
}
the thing is i want to see only factions that exist i mean like i have 1 faction not 5 that should give me just 1 in /factions command but with that cmd it give's me something like
HTML Code:
1. Grove Street [0/10] Open
2. [0/0] Closed
3. [0/0] Closed
4. [0/0] Closed
5. [0/0] Closed
see? the problem is that i have only 1 faction and the rest of 4 are giving me bad info i just want to see only the factions are in my DB from structure 'factions' any idea how ?
Re: Question and Help -
Abagail - 18.06.2017
It shows the rest because that's exactly what you tell it to. You need to use an if statement and check if the faction is in use or not. Example,
pawn Code:
for(new i = 1; i < sizeof(FactionInfo); i++)
{
if(FactionInfo[i][fStatus] == 0) continue;
The continue command tells the server to skip to the next iteration.
Re: Question and Help -
StR_MaRy - 18.06.2017
Quote:
Originally Posted by Abagail
It shows the rest because that's exactly what you tell it to. You need to use an if statement and check if the faction is in use or not. Example,
pawn Code:
for(new i = 1; i < sizeof(FactionInfo); i++) { if(FactionInfo[i][fStatus] == 0) continue;
The continue command tells the server to skip to the next iteration.
|
thx , it worked