Need help in io_read
#1

hello all today i made a function for saving my server organization members but it cant read in dialog List here
is my function code

this is for saving members
pawn Код:
CMD:setmember(playerid, params[])
{
if (!IsLeader(playerid)) return SendClientMessage(playerid,COLOR_RED,"You are not the leader of an organization");
new ID;
if (sscanf(params, "u", ID)) return SendClientMessage(playerid,COLOR_WHITE,"Usage: /setmember [playerid]");
if (!IsPlayerConnected(ID) || ID == playerid) return 1;
new org = PlayerOrg[playerid];
if (PlayerOrg[ID]) return SendClientMessage(playerid, COLOR_RED,"That player already belongs to an organization");
if (Requesting[ID] != org) return SendClientMessage(playerid, COLOR_RED,"That player is not requesting to join your organization!");
new string[120];
format(string,sizeof(string),"%s has set you as a member of %s", PlayerName(playerid), GetOrgName(org));
SendClientMessage(ID, COLOR_YELLOW, string);
format(string,sizeof(string),"You have set %s a member of %s", PlayerName(ID), GetOrgName(org));
SendClientMessage(playerid, COLOR_YELLOW, string);
PlayerOrg[ID] = org;
GiveOrgFeatures(ID);
Requesting[ID] = 0;
if (PlayerOrg[playerid] == 1)
{
        new pname[24], File:ftw=fopen("GSFMembers.txt", io_append);
        if(ftw)
        {
        GetPlayerName(playerid, pname, 24);
        format(string, 300, "%s\r\n", pname); // formatting the string with the escape codes
        fwrite(ftw, string);
        fclose(ftw);
        }

}
return 1;
}
this is for read members

pawn Код:
if (PlayerOrg[playerid] == 1)
{
 new string[300];
 new File:ftw = fopen("GSFMembers.txt", io_read); // Open the file
 while(fread(ftw, string)) //reads the file line-by-line
 {
        format(string,300,"%s\r\n", string);
        ShowPlayerDialog(playerid, 757, DIALOG_STYLE_LIST, "Organization Members",string,"Close","");
 }
  fclose(ftw);
  return 1;
}
with this code it only showing 1 not all members i add 4 members but only showing 1 if i put
pawn Код:
SendClientMessage(playerid, COLOR_YELLOW, string);
then showing me all tell me how to fix this
and +rep for helper
Reply


Messages In This Thread
Need help in io_read - by IceBilizard - 15.12.2012, 05:27
Re: Need help in io_read - by RajatPawar - 15.12.2012, 05:31
Re: Need help in io_read - by Babul - 15.12.2012, 08:12

Forum Jump:


Users browsing this thread: 1 Guest(s)