Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stock LoadUserConnection(playerid)
- {
- new string[128], string2[128], name[100];
- GetPlayerName(playerid, name, sizeof(name));
- strreplace(name, '_', ' ');
- format(string, sizeof(string), "/Users/%s.ini", name);
- format(string2, sizeof(string2), "/Users/%s#.ini", name);
- new File: file2 = fopen(string2, io_read);
- if (file2)
- {
- fread(file2, string2);
- friendly[playerid] = strval(string2);
- print(string2);
- }
- else
- {
- print("FINDING #: File Reading Error!");
- SendClientMessage(playerid, COLOR_RED, "File: Error Found!");
- }
- fclose(file2);
- new File: file = fopen(string, io_read);
- print("Open File");
- new c = friendly[playerid];
- print("Set c to friendly[playerid]");
- new SplitDiv[1][80];
- print("Create Split Div Variable");
- if(file)
- {
- print("File Found!");
- fread(file, string);
- new text[128];
- for(new i = 0; i < c; i++)
- {
- split(string, SplitDiv, '\r');
- print("In Loop");
- print(SplitDiv[0]);
- strmid(PlayerInfo[playerid][pFriends][i], SplitDiv[0], 0, strlen(SplitDiv[0]));
- strins(PlayerInfo[playerid][pFriends][i], SplitDiv[0], 0);
- format(text, sizeof(text), "PlayerInfo[playerid][pFriends][%d] = %s", i, PlayerInfo[playerid][pFriends][i]);
- print(text);
- strdel(string, -1, strlen(SplitDiv[0]));
- }
- print("Finished Loop");
- fclose(file);
- print("Closed File");
- }
- else
- {
- print("RUNNING ELSE since FILE NOT FOUND");
- print("File Writing Error!");
- SendClientMessage(playerid, COLOR_RED, "File: Error Found!");
- }
- print("Closing File");
- fclose(file);
- print("File Closed");
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement