SA-MP Forums Archive
Organization Memberlist doesn't work - 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: Organization Memberlist doesn't work (/showthread.php?tid=496143)



Organization Memberlist doesn't work - Tayab - 20.02.2014

I've been trying to create memberlist system which show all the members in specific organization.

SetOrgMember stock

pawn Код:
stock SetOrgMember(playerid,orgid)
{
    if(!strcmp(OrgInfo[orgid][oMember1],"N/A",true,3))
    {
        format(OrgInfo[orgid][oMember1],24,"%s",pName(playerid));
    }
    else if(!strcmp(OrgInfo[orgid][oMember2],"N/A",true,3))
    {
        format(OrgInfo[orgid][oMember2],24,"%s",pName(playerid));
    }
    else if(!strcmp(OrgInfo[orgid][oMember3],"N/A",true,3))
    {
        format(OrgInfo[orgid][oMember3],24,"%s",pName(playerid));
    }
    else if(!strcmp(OrgInfo[orgid][oMember4],"N/A",true,3))
    {
        format(OrgInfo[orgid][oMember4],24,"%s",pName(playerid));
    }
    else if(!strcmp(OrgInfo[orgid][oMember5],"N/A",true,3))
    {
        format(OrgInfo[orgid][oMember5],24,"%s",pName(playerid));
    }
    else if(!strcmp(OrgInfo[orgid][oMember6],"N/A",true,3))
    {
        format(OrgInfo[orgid][oMember6],24,"%s",pName(playerid));
    }
    else if(!strcmp(OrgInfo[orgid][oMember7],"N/A",true,3))
    {
        format(OrgInfo[orgid][oMember7],24,"%s",pName(playerid));
    }
    else if(!strcmp(OrgInfo[orgid][oMember8],"N/A",true,3))
    {
        format(OrgInfo[orgid][oMember8],24,"%s",pName(playerid));
    }
    else if(!strcmp(OrgInfo[orgid][oMember9],"N/A",true,3))
    {
        format(OrgInfo[orgid][oMember9],24,"%s",pName(playerid));
    }
    else if(!strcmp(OrgInfo[orgid][oMember10],"N/A",true,3))
    {
        format(OrgInfo[orgid][oMember10],24,"%s",pName(playerid));
    }
    return 1;
}
I use this in /acceptreq

pawn Код:
CMD:acceptreq(playerid,params[])
{
    new pID;
    if(!IsPlayerLeader(playerid)) return SendClientMessage(playerid,COLOR_GREY,"You're not leader of any organization.");
    if(sscanf(params,"u",pID)) return SendClientMessage(playerid,COLOR_WHITE,"USAGE: /acceptreq [playerid]");
    if(!IsPlayerConnected(pID)) return SendClientMessage(playerid,COLOR_GREY,"Player is not connnected.");
    if(Requesting[playerid] == GetOrgOfLeader(playerid))
    {
        format(string,sizeof(string),"You've been accepted into %s by the leader.",OrgInfo[GetOrgOfLeader(playerid)][oName]);
        SendClientMessage(pID,COLOR_ORANGE,string);
        format(string,sizeof(string),"You have accepted %s into your organization.",pName(pID));
        SendClientMessage(playerid,COLOR_YELLOW,string);
        pInfo[pID][PlayerOrg] = GetOrgOfLeader(playerid);
        SetOrgMember(pID,GetOrgOfLeader(playerid));
        Requesting[playerid] = 0;
    }
    else return SendClientMessage(playerid,COLOR_GREY,"Player is not requesting to join your organization.");
    return 1;
}
Please help me!


Re: Organization Memberlist doesn't work - Vince - 20.02.2014

This is really a quite terrible way to do it. You should either assign the organization id to the player's variable set, or keep a list in a file or SQL table. With this you're setting hard limits.


Re: Organization Memberlist doesn't work - Tayab - 20.02.2014

I've a variable which saves the organization's ID, pInfo[playerid][PlayerOrg]. Isn't this same thing as saving in SQL table. Every org has member1 - member10 field which saves the data in.