SA-MP Forums Archive
little faction 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: little faction help (/showthread.php?tid=545826)



little faction help - Diti1 - 10.11.2014

hey please help me
i am looking to create a command example
/factions to show the faction list to civilians with example
SendClientMessage:.......[members 10/45] [online 3]
but i have it and i made it only fake message can some one help me to make it real please
some one give me an exaple and i am going create it please help me thanks


Re: little faction help - LaPiMoNsTeR - 10.11.2014

Create a variable for each faction. Get the faction of players when he connect to server and add +1 in the faction variable You create before.
pawn Код:
new FactionName;

public OnPlayerConnect(playerid)
{
    FactionName++;
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    FactionName--;
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/faction", true))
    {
        new str[70];
        fomat(str, sizeof(str), "FactionName : %d / 45", FactionName);
        SendClientMessage(playerid, -1, str);
        return 1;
    }
    return 0;
}
Sry for my bad English, i'm french.


Re: little faction help - Simeon87 - 10.11.2014

I personally would use MySQL Databases to determine whether a player is a member of a faction or not. Then when someone types uses the /factions command, just use a MySQL query to loop through all player files that are a member of the faction.

Alternatively, you could also create a table for the faction members, so that your server doesn't need to loop through each player file every time that command is run.


Re: little faction help - Diti1 - 11.11.2014

i tried that Lapimonster but it doesnt work it gives me so much errors


any other idea ?


Re : little faction help - LaPiMoNsTeR - 16.11.2014

give me error.


Re: little faction help - Diti1 - 16.11.2014

Nevermind this i problem sloved THanks