Advertisement
Guest User

Untitled

a guest
Dec 13th, 2013
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. stock LoadUserConnection(playerid)
  2. {
  3. new string[128], string2[128], name[100];
  4. GetPlayerName(playerid, name, sizeof(name));
  5. strreplace(name, '_', ' ');
  6. format(string, sizeof(string), "/Users/%s.ini", name);
  7. format(string2, sizeof(string2), "/Users/%s#.ini", name);
  8. new File: file2 = fopen(string2, io_read);
  9. if (file2)
  10. {
  11. fread(file2, string2);
  12. friendly[playerid] = strval(string2);
  13. print(string2);
  14. }
  15. else
  16. {
  17. print("FINDING #: File Reading Error!");
  18. SendClientMessage(playerid, COLOR_RED, "File: Error Found!");
  19. }
  20. fclose(file2);
  21. new File: file = fopen(string, io_read);
  22. print("Open File");
  23. new c = friendly[playerid];
  24. print("Set c to friendly[playerid]");
  25. new SplitDiv[1][80];
  26. print("Create Split Div Variable");
  27. if(file)
  28. {
  29. print("File Found!");
  30. fread(file, string);
  31. new text[128];
  32. for(new i = 0; i < c; i++)
  33. {
  34. split(string, SplitDiv, '\r');
  35. print("In Loop");
  36. print(SplitDiv[0]);
  37. strmid(PlayerInfo[playerid][pFriends][i], SplitDiv[0], 0, strlen(SplitDiv[0]));
  38. strins(PlayerInfo[playerid][pFriends][i], SplitDiv[0], 0);
  39. format(text, sizeof(text), "PlayerInfo[playerid][pFriends][%d] = %s", i, PlayerInfo[playerid][pFriends][i]);
  40. print(text);
  41. strdel(string, -1, strlen(SplitDiv[0]));
  42. }
  43. print("Finished Loop");
  44. fclose(file);
  45. print("Closed File");
  46. }
  47. else
  48. {
  49. print("RUNNING ELSE since FILE NOT FOUND");
  50. print("File Writing Error!");
  51. SendClientMessage(playerid, COLOR_RED, "File: Error Found!");
  52. }
  53. print("Closing File");
  54. fclose(file);
  55. print("File Closed");
  56. return 1;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement