writing names to file
#1

Hello, im trying to make a command which shows all the players who posted thier answers for questions and now pending for the accept. However i'm not sure how to save all those players? for example if player gets out of the server and he is still pending for request i want the list to show his name and when he is accpeted to remove his name from the list. Here is some commands i was trying to make to make this system and it didn't work.

This should get the onlinename string and show it (i thought maybe it will work saving strings..)
this is the command:
pawn Код:
COMMAND:passed(playerid, params[])
{
    if(GetPVarInt(playerid, "Admin") >= 1 || GetPVarInt(playerid, "Helper") >= 1 || GetPVarInt(playerid, "RegTeam") >= 1)
    {
        SendClientMessage(playerid, COLOR_WHITE, "__________________________________________________");
        SendClientMessage(playerid, COLOR_WHITE, "      People who are waiting approval:");
        if(onlinename[0] == EOS) return SendClientMessage(playerid, COLOR_WHITE, "None");
        SendClientMessage(playerid, COLOR_WHITE, onlinename);
        SendClientMessage(playerid, COLOR_WHITE, "__________________________________________________");
    }
    else SendClientMessage(playerid, COLOR_LIGHTRED, "You do not have access to this command !");
    return 1;
}
this is the save & loading:
pawn Код:
stock SavePlayerList()
{
    new File: file2, coordsstring[256];
    format(coordsstring, sizeof(coordsstring), "%s", onlinename);
    file2 = fopen("passed.ini", io_append);
    fwrite(file2, coordsstring);
    fclose(file2);
}

stock LoadPlayerList()
{
    new arrCoords[34][64], strFromFile2[256];
    new File: file = fopen("passed.ini", io_read);
    if(file)
    {
        fread(file, strFromFile2);
        split(strFromFile2, arrCoords, '\n');
        strmid(onlinename, arrCoords[0], 0, strlen(arrCoords[0]), 24);
    }
    fclose(file);
    return 1;
}
this is the way im trying to add player name to the string
pawn Код:
format(online, sizeof(online), "%s\r\n", PlayerName(playerid));
        strcat(onlinename, online, sizeof(onlinename));
I would be happy if this was variables instead of string. however this is the closest i got to make this work..
Please help me get this command work.
Reply


Messages In This Thread
writing names to file - by maximthepain - 07.07.2015, 12:45
Re: writing names to file - by maximthepain - 07.07.2015, 15:59
Re: writing names to file - by Roko_foko - 07.07.2015, 17:26
Re: writing names to file - by maximthepain - 07.07.2015, 19:07
Re: writing names to file - by maximthepain - 08.07.2015, 10:18
Re: writing names to file - by Roko_foko - 08.07.2015, 11:42

Forum Jump:


Users browsing this thread: 1 Guest(s)