Faction member list...
#1

Hey...

I've got factions, but i want the leader for them to be able to type: /members

Then a list will show up like:

"name" "rank"

Example:

Peter_Johnson, Boss
Timmy_Garand, Mafiaso


and so on...

But i don't know how to do it.

Should it be like a .ini file with all names?
Reply
#2

yeah you can change some code from lethaladmin. maybe it could be manuel.

/rank <id> boss

Reply
#3

Quote:
Originally Posted by ByFukara
yeah you can change some code from lethaladmin. maybe it could be manuel.

/rank <id> boss

Ehhh....... WHAT? =/
Reply
#4

Anyone?
Reply
#5

You can make factions but you can't make a simple variable check in a loop ?
Reply
#6

Quote:
Originally Posted by Donny
You can make factions but you can't make a simple variable check in a loop ?
No...
Reply
#7

I'm not sure how to do that but I can give you how to see current online members:

pawn Код:
if (strcmp(cmd, "/familylist", true) == 0 || strcmp(cmd, "/flist", true) == 0 || strcmp(cmd, "/factionlist", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
        {
            SendClientMessage(playerid, COLOR_GRAD1, "PD officers online:");
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(PlayerInfo[i][pMember] == 1 || PlayerInfo[i][pLeader] == 1)
                    {
                        GetPlayerName(i, sendername, sizeof(sendername));
                        if(PlayerInfo[i][pRank] == 6)
                        {
                            format(string, 256, "** %s - Chief **", sendername);
                            SendClientMessage(playerid, COLOR_GRAD2, string);
                        }
                        else if(PlayerInfo[i][pRank] == 5)
                        {
                            format(string, 256, "** %s - Deputy Chief **", sendername);
                            SendClientMessage(playerid, COLOR_GRAD2, string);
                        }
                        else if(PlayerInfo[i][pRank] == 4)
                        {
                            format(string, 256, "** %s - Captain **", sendername);
                            SendClientMessage(playerid, COLOR_GRAD2, string);
                        }
                        else if(PlayerInfo[i][pRank] == 3)
                        {
                            format(string, 256, "** %s - Lieutenant **", sendername);
                            SendClientMessage(playerid, COLOR_GRAD2, string);
                        }
                        else if(PlayerInfo[i][pRank] == 2)
                        {
                            format(string, 256, "** %s - Sergeant **", sendername);
                            SendClientMessage(playerid, COLOR_GRAD2, string);
                        }
                        else if(PlayerInfo[i][pRank] == 1)
                        {
                            format(string, 256, "** %s - Corporal **", sendername);
                            SendClientMessage(playerid, COLOR_GRAD2, string);
                        }
                    }
                }
            }
        }
    }
}
I didn't test it, do it for me
Reply
#8

Well you have to figure out a few things.

1) which variable tracks which faction I am a member of
2) how do loops work
3) how do I get a players name
4) how do I format strings
5) how do I send messages

The last four can all be solved by reading the Wiki and the Pawn_Lang.pdf, the first one will have to be solved by searching in the script for what happens when I join a faction like a variable will be set to a new value etc.
Reply
#9

Quote:
Originally Posted by IVuljak
Посмотреть сообщение
I'm not sure how to do that but I can give you how to see current online members:

pawn Код:
if (strcmp(cmd, "/familylist", true) == 0 || strcmp(cmd, "/flist", true) == 0 || strcmp(cmd, "/factionlist", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
        {
            SendClientMessage(playerid, COLOR_GRAD1, "PD officers online:");
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(PlayerInfo[i][pMember] == 1 || PlayerInfo[i][pLeader] == 1)
                    {
                        GetPlayerName(i, sendername, sizeof(sendername));
                        if(PlayerInfo[i][pRank] == 6)
                        {
                            format(string, 256, "** %s - Chief **", sendername);
                            SendClientMessage(playerid, COLOR_GRAD2, string);
                        }
                        else if(PlayerInfo[i][pRank] == 5)
                        {
                            format(string, 256, "** %s - Deputy Chief **", sendername);
                            SendClientMessage(playerid, COLOR_GRAD2, string);
                        }
                        else if(PlayerInfo[i][pRank] == 4)
                        {
                            format(string, 256, "** %s - Captain **", sendername);
                            SendClientMessage(playerid, COLOR_GRAD2, string);
                        }
                        else if(PlayerInfo[i][pRank] == 3)
                        {
                            format(string, 256, "** %s - Lieutenant **", sendername);
                            SendClientMessage(playerid, COLOR_GRAD2, string);
                        }
                        else if(PlayerInfo[i][pRank] == 2)
                        {
                            format(string, 256, "** %s - Sergeant **", sendername);
                            SendClientMessage(playerid, COLOR_GRAD2, string);
                        }
                        else if(PlayerInfo[i][pRank] == 1)
                        {
                            format(string, 256, "** %s - Corporal **", sendername);
                            SendClientMessage(playerid, COLOR_GRAD2, string);
                        }
                    }
                }
            }
        }
    }
}
I didn't test it, do it for me
Shouldn't there be

pawn Код:
return 1;
through the wazoo in this code?? at the end of each
pawn Код:
else if
??

And I THINK it's

pawn Код:
SendClientMessageEx
rather than just

pawn Код:
SendClientMessage
I'll test this version though and see if it works.
Reply


Forum Jump:


Users browsing this thread: