Guest User

Untitled

a guest
Dec 14th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.15 KB | None | 0 0
  1. #include <a_samp>
  2. #include <Double-O-Files>
  3. #include <dutils>
  4. #define Dialog_Main 117
  5. #define Dialog_Edit 217
  6.  
  7. enum DLx
  8. {
  9. Txt[30]
  10. };
  11. new DLv[][DLx] =
  12. {
  13. {"Name"},
  14. {"Skype"},
  15. {"City"},
  16. {"Age"},
  17. {"Facebook"},
  18. {"Forum"},
  19. {"Cellphone"}
  20. };
  21.  
  22. public OnPlayerConnect(playerid)
  23. {
  24. if(!DOF2_FileExists(pFile(playerid)))
  25. {
  26. DOF2_CreateFile(pFile(playerid));
  27. for(new i; i<sizeof(DLv); i++)
  28. {
  29. DOF2_SetString(pFile(playerid), DLv[i][Txt], "Null.");
  30. }
  31. DOF2_SaveFile();
  32. }
  33. for(new i; i<sizeof(DLv); i++)
  34. {
  35. SetPVarString(playerid, DLv[i][Txt], DOF2_GetString(pFile(playerid), DLv[i][Txt]));
  36. }
  37. return 1;
  38. }
  39. public OnPlayerCommandText(playerid, cmdtext[])
  40. {
  41. new cmd[256];
  42. new tmp[256];
  43. new idx;
  44. cmd = strtok(cmdtext, idx);
  45. if(!strcmp(cmd, "/Details", true))
  46. {
  47. tmp = strtok(cmdtext, idx);
  48. new id;
  49. id = strval(tmp);
  50. if(!strlen(tmp) || id == playerid)
  51. {
  52. id = playerid;
  53. }
  54. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "Invalid Player ID");
  55. new DStr[1024];
  56. new title[70];
  57. /* if(GetPVarInt(playerid, "HaveCar") != -1)
  58. {
  59. //new str[100];
  60. //GetPVarString(playerid, "CarModel", str, 100);
  61. format(DStr, sizeof(DStr), "{00FFFF}Vehicle: %d", GetPVarInt(playerid, "HaveCar"));
  62. if(GetPVarInt(playerid, "sCar") == 1)
  63. {
  64. format(DStr, sizeof(DStr), "{00FFFF}Vehicle: %d [[ {FF00FF}Special Car {00FFFFF}]]", GetPVarInt(playerid, "HaveCar"));
  65. }
  66. }
  67. if(GetPVarInt(playerid, "HaveCar") == 0)
  68. {
  69. format(DStr, sizeof(DStr), "");
  70. }*/
  71. for(new i; i < sizeof(DLv); i++)
  72. {
  73.  
  74. new sxp[100];
  75. GetPVarString(id, DLv[i][Txt], sxp, 100);
  76. format(DStr, sizeof(DStr), "%s\n{FFFFFF} [[ %d ]] {00FF00}%s: {FFFFFF}%s", DStr, i, DLv[i][Txt], sxp);
  77. }
  78. format(title, sizeof(title), "{00FF00}Details Of: {FFFFFF}%s", GetName(id));
  79. if(!strlen(tmp) || id == playerid)
  80. {
  81. ShowPlayerDialog(playerid, Dialog_Main, DIALOG_STYLE_INPUT, title, DStr, "Edit", "Exit");
  82. SetPVarInt(playerid, "PTE", playerid);
  83. }
  84. else
  85. {
  86. ShowPlayerDialog(playerid, Dialog_Main, DIALOG_STYLE_MSGBOX, title, DStr, "OK", "");
  87. SetPVarInt(playerid, "PTE", id);
  88. }
  89. return 1;
  90. }
  91. return 0;
  92. }
  93. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  94. {
  95. if(dialogid == Dialog_Main && response)
  96. {
  97. SetPVarInt(playerid, "DTE", strval(inputtext));
  98. new Str[100];
  99. format(Str, sizeof(Str), "{FFFFFF} [[ %d ]] {00FF00}%s:", strval(inputtext), DLv[strval(inputtext)][Txt]);
  100. ShowPlayerDialog(playerid, Dialog_Edit, DIALOG_STYLE_INPUT, "{FF0000}Details {FFFFFF}Edit Mode", Str, "OK", "Cancel");
  101. }
  102. if(dialogid == Dialog_Edit && response && GetPVarInt(playerid, "PTE") == playerid)
  103. {
  104. SetPVarString(playerid, DLv[GetPVarInt(playerid, "DTE")][Txt], inputtext);
  105. DOF2_SetString(pFile(playerid), DLv[GetPVarInt(playerid, "DTE")][Txt], inputtext);
  106. DOF2_SaveFile();
  107. OnPlayerCommandText(playerid, "/Details");
  108. }
  109. return 0;
  110. }
  111. stock GetName(playerid)
  112. {
  113. new str[24];
  114. GetPlayerName(playerid, str, 24);
  115. return str;
  116. }
  117. stock pFile(playerid)
  118. {
  119. new str[100];
  120. format(str, sizeof(str), "ProDucK/%s.ini", GetName(playerid));
  121. return str;
  122. }
Add Comment
Please, Sign In to add comment