miscload.pwn 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. /* Misc Variables load
  2. Secondary Chatbox
  3. */
  4. #include <YSI\y_hooks>
  5. hook OnGameModeInit() {
  6. TD_ServerError = TextDrawCreate(321.000000, 428.000000, "SERVER: Unknown command");
  7. TextDrawAlignment(TD_ServerError, 2);
  8. TextDrawBackgroundColor(TD_ServerError, 255);
  9. TextDrawFont(TD_ServerError, 2);
  10. TextDrawLetterSize(TD_ServerError, 0.210000, 0.899999);
  11. TextDrawColor(TD_ServerError, -1);
  12. TextDrawSetOutline(TD_ServerError, 0);
  13. TextDrawSetProportional(TD_ServerError, 1);
  14. TextDrawSetShadow(TD_ServerError, 1);
  15. TextDrawUseBox(TD_ServerError, 1);
  16. TextDrawBoxColor(TD_ServerError, -14803426);
  17. TextDrawTextSize(TD_ServerError, -300.000000, 655.000000);
  18. TextDrawSetSelectable(TD_ServerError, 0);
  19. }
  20. hook OnGameModeExit() {
  21. for(new i; i < sizeof(TD_ChatBox); ++i) {
  22. PlayerTextDrawDestroy(0, TD_ChatBox[i]);
  23. }
  24. return 1;
  25. }
  26. hook OnPlayerConnect(playerid) {
  27. /*
  28. TD_ChatBox[0] = CreatePlayerTextDraw(playerid, 520.000000, 352.000000, "chatbox");
  29. PlayerTextDrawAlignment(playerid,TD_ChatBox[0], 2);
  30. PlayerTextDrawBackgroundColor(playerid,TD_ChatBox[0], 255);
  31. PlayerTextDrawFont(playerid,TD_ChatBox[0], 2);
  32. PlayerTextDrawLetterSize(playerid,TD_ChatBox[0], 0.490000, 9.199996);
  33. PlayerTextDrawColor(playerid,TD_ChatBox[0], 0);
  34. PlayerTextDrawSetOutline(playerid,TD_ChatBox[0], 0);
  35. PlayerTextDrawSetProportional(playerid,TD_ChatBox[0], 1);
  36. PlayerTextDrawSetShadow(playerid,TD_ChatBox[0], 0);
  37. PlayerTextDrawUseBox(playerid,TD_ChatBox[0], 1);
  38. PlayerTextDrawBoxColor(playerid,TD_ChatBox[0], 50);
  39. PlayerTextDrawTextSize(playerid,TD_ChatBox[0], 341.000000, 280.000000);
  40. PlayerTextDrawSetPreviewModel(playerid, TD_ChatBox[0], 19300);
  41. PlayerTextDrawSetPreviewRot(playerid, TD_ChatBox[0], -16.000000, 0.000000, -55.000000, 50000.000000);
  42. PlayerTextDrawSetSelectable(playerid,TD_ChatBox[0], 0);
  43. TD_ChatBox[1] = CreatePlayerTextDraw(playerid,394.000000, 353.000000, "");
  44. PlayerTextDrawBackgroundColor(playerid,TD_ChatBox[1], 50);
  45. PlayerTextDrawFont(playerid,TD_ChatBox[1], 1);
  46. PlayerTextDrawLetterSize(playerid,TD_ChatBox[1], 0.130000, 0.799999);
  47. PlayerTextDrawColor(playerid,TD_ChatBox[1], -1);
  48. PlayerTextDrawSetOutline(playerid,TD_ChatBox[1], 1);
  49. PlayerTextDrawSetProportional(playerid,TD_ChatBox[1], 1);
  50. PlayerTextDrawSetSelectable(playerid,TD_ChatBox[1], 0);
  51. TD_ChatBox[2] = CreatePlayerTextDraw(playerid,394.000000, 361.000000, "");
  52. PlayerTextDrawBackgroundColor(playerid,TD_ChatBox[2], 50);
  53. PlayerTextDrawFont(playerid,TD_ChatBox[2], 1);
  54. PlayerTextDrawLetterSize(playerid,TD_ChatBox[2], 0.130000, 0.799999);
  55. PlayerTextDrawColor(playerid,TD_ChatBox[2], -1);
  56. PlayerTextDrawSetOutline(playerid,TD_ChatBox[2], 1);
  57. PlayerTextDrawSetProportional(playerid,TD_ChatBox[2], 1);
  58. PlayerTextDrawSetSelectable(playerid,TD_ChatBox[2], 0);
  59. TD_ChatBox[3] = CreatePlayerTextDraw(playerid,394.000000, 369.000000, "");
  60. PlayerTextDrawBackgroundColor(playerid,TD_ChatBox[3], 50);
  61. PlayerTextDrawFont(playerid,TD_ChatBox[3], 1);
  62. PlayerTextDrawLetterSize(playerid,TD_ChatBox[3], 0.130000, 0.799999);
  63. PlayerTextDrawColor(playerid,TD_ChatBox[3], -1);
  64. PlayerTextDrawSetOutline(playerid,TD_ChatBox[3], 1);
  65. PlayerTextDrawSetProportional(playerid,TD_ChatBox[3], 1);
  66. PlayerTextDrawSetSelectable(playerid,TD_ChatBox[3], 0);
  67. TD_ChatBox[4] = CreatePlayerTextDraw(playerid,394.000000, 377.000000, "");
  68. PlayerTextDrawBackgroundColor(playerid,TD_ChatBox[4], 50);
  69. PlayerTextDrawFont(playerid,TD_ChatBox[4], 1);
  70. PlayerTextDrawLetterSize(playerid,TD_ChatBox[4], 0.130000, 0.799999);
  71. PlayerTextDrawColor(playerid,TD_ChatBox[4], -1);
  72. PlayerTextDrawSetOutline(playerid,TD_ChatBox[4], 1);
  73. PlayerTextDrawSetProportional(playerid,TD_ChatBox[4], 1);
  74. PlayerTextDrawSetSelectable(playerid,TD_ChatBox[4], 0);
  75. TD_ChatBox[5] = CreatePlayerTextDraw(playerid,394.000000, 385.000000, "");
  76. PlayerTextDrawBackgroundColor(playerid,TD_ChatBox[5], 50);
  77. PlayerTextDrawFont(playerid,TD_ChatBox[5], 1);
  78. PlayerTextDrawLetterSize(playerid,TD_ChatBox[5], 0.130000, 0.799999);
  79. PlayerTextDrawColor(playerid,TD_ChatBox[5], -1);
  80. PlayerTextDrawSetOutline(playerid,TD_ChatBox[5], 1);
  81. PlayerTextDrawSetProportional(playerid,TD_ChatBox[5], 1);
  82. PlayerTextDrawSetSelectable(playerid,TD_ChatBox[5], 0);
  83. TD_ChatBox[6] = CreatePlayerTextDraw(playerid,394.000000, 393.000000, "");
  84. PlayerTextDrawBackgroundColor(playerid,TD_ChatBox[6], 50);
  85. PlayerTextDrawFont(playerid,TD_ChatBox[6], 1);
  86. PlayerTextDrawLetterSize(playerid,TD_ChatBox[6], 0.130000, 0.799999);
  87. PlayerTextDrawColor(playerid,TD_ChatBox[6], -1);
  88. PlayerTextDrawSetOutline(playerid,TD_ChatBox[6], 1);
  89. PlayerTextDrawSetProportional(playerid,TD_ChatBox[6], 1);
  90. PlayerTextDrawSetSelectable(playerid,TD_ChatBox[6], 0);
  91. TD_ChatBox[7] = CreatePlayerTextDraw(playerid,394.000000, 401.000000, "");
  92. PlayerTextDrawBackgroundColor(playerid,TD_ChatBox[7], 50);
  93. PlayerTextDrawFont(playerid,TD_ChatBox[7], 1);
  94. PlayerTextDrawLetterSize(playerid,TD_ChatBox[7], 0.130000, 0.799999);
  95. PlayerTextDrawColor(playerid,TD_ChatBox[7], -1);
  96. PlayerTextDrawSetOutline(playerid,TD_ChatBox[7], 1);
  97. PlayerTextDrawSetProportional(playerid,TD_ChatBox[7], 1);
  98. PlayerTextDrawSetSelectable(playerid,TD_ChatBox[7], 0);
  99. TD_ChatBox[8] = CreatePlayerTextDraw(playerid,394.000000, 409.000000, "");
  100. PlayerTextDrawBackgroundColor(playerid,TD_ChatBox[8], 50);
  101. PlayerTextDrawFont(playerid,TD_ChatBox[8], 1);
  102. PlayerTextDrawLetterSize(playerid,TD_ChatBox[8], 0.130000, 0.799999);
  103. PlayerTextDrawColor(playerid,TD_ChatBox[8], -1);
  104. PlayerTextDrawSetOutline(playerid,TD_ChatBox[8], 1);
  105. PlayerTextDrawSetProportional(playerid,TD_ChatBox[8], 1);
  106. PlayerTextDrawSetSelectable(playerid,TD_ChatBox[8], 0);
  107. TD_ChatBox[9] = CreatePlayerTextDraw(playerid,394.000000, 417.000000, "");
  108. PlayerTextDrawBackgroundColor(playerid,TD_ChatBox[9], 50);
  109. PlayerTextDrawFont(playerid,TD_ChatBox[9], 1);
  110. PlayerTextDrawLetterSize(playerid,TD_ChatBox[9], 0.130000, 0.799999);
  111. PlayerTextDrawColor(playerid,TD_ChatBox[9], -1);
  112. PlayerTextDrawSetOutline(playerid,TD_ChatBox[9], 1);
  113. PlayerTextDrawSetProportional(playerid,TD_ChatBox[9], 1);
  114. PlayerTextDrawSetSelectable(playerid,TD_ChatBox[9], 0);
  115. TD_ChatBox[10] = CreatePlayerTextDraw(playerid,394.000000, 425.000000, "");
  116. PlayerTextDrawBackgroundColor(playerid,TD_ChatBox[10], 50);
  117. PlayerTextDrawFont(playerid,TD_ChatBox[10], 1);
  118. PlayerTextDrawLetterSize(playerid,TD_ChatBox[10], 0.130000, 0.799999);
  119. PlayerTextDrawColor(playerid,TD_ChatBox[10], -1);
  120. PlayerTextDrawSetOutline(playerid,TD_ChatBox[10], 1);
  121. PlayerTextDrawSetProportional(playerid,TD_ChatBox[10], 1);
  122. PlayerTextDrawSetSelectable(playerid,TD_ChatBox[10], 0);
  123. */
  124. return 1;
  125. }
  126. stock Misc_Save() {
  127. new
  128. szFileStr[50],
  129. File: iFileHandle = fopen("serverConfig.ini", io_write);
  130. ini_SetInteger(iFileHandle, szFileStr, "RaceLaps", RaceTotalLaps);
  131. ini_SetInteger(iFileHandle, szFileStr, "RaceJoins", TotalJoinsRace);
  132. ini_SetInteger(iFileHandle, szFileStr, "Jackpot", Jackpot);
  133. ini_SetInteger(iFileHandle, szFileStr, "Tax", Tax);
  134. ini_SetInteger(iFileHandle, szFileStr, "TaxVal", TaxValue);
  135. ini_SetInteger(iFileHandle, szFileStr, "VIPM", VIPM);
  136. ini_SetInteger(iFileHandle, szFileStr, "LoginCount", TotalLogin);
  137. ini_SetInteger(iFileHandle, szFileStr, "ConnCount", TotalConnect);
  138. ini_SetInteger(iFileHandle, szFileStr, "ABanCount", TotalAutoBan);
  139. ini_SetInteger(iFileHandle, szFileStr, "RegCount", TotalRegister);
  140. ini_SetInteger(iFileHandle, szFileStr, "MaxPCount", MaxPlayersConnected);
  141. ini_SetInteger(iFileHandle, szFileStr, "MaxPDay", MPDay);
  142. ini_SetInteger(iFileHandle, szFileStr, "MaxPMonth", MPMonth);
  143. ini_SetInteger(iFileHandle, szFileStr, "MaxPYear", MPYear);
  144. ini_SetInteger(iFileHandle, szFileStr, "Uptime", TotalUptime);
  145. ini_SetInteger(iFileHandle, szFileStr, "BoxWins", Titel[TitelWins]);
  146. ini_SetInteger(iFileHandle, szFileStr, "BoxLosses", Titel[TitelLoses]);
  147. ini_SetInteger(iFileHandle, szFileStr, "SpecTimer", SpecTimer);
  148. ini_SetInteger(iFileHandle, szFileStr, "TRTax", TRTax);
  149. ini_SetInteger(iFileHandle, szFileStr, "TRTaxVal", TRTaxValue);
  150. ini_SetInteger(iFileHandle, szFileStr, "SpeedingTickets", SpeedingTickets);
  151. ini_SetInteger(iFileHandle, szFileStr, "FIFType", FIFType);
  152. ini_SetInteger(iFileHandle, szFileStr, "FIFEnabled", FIFEnabled);
  153. ini_SetInteger(iFileHandle, szFileStr, "FIFGP3", FIFGP3);
  154. ini_SetInteger(iFileHandle, szFileStr, "FIFTimeWarrior", FIFTimeWarrior);
  155. ini_SetFloat(iFileHandle, szFileStr, "FIFGambleX", FIFGamble[0]);
  156. ini_SetFloat(iFileHandle, szFileStr, "FIFGambleY", FIFGamble[1]);
  157. ini_SetFloat(iFileHandle, szFileStr, "FIFGambleZ", FIFGamble[2]);
  158. ini_SetInteger(iFileHandle, szFileStr, "FIFGThurs", FIFGThurs);
  159. if(iRewardPlay) {
  160. ini_SetInteger(iFileHandle, szFileStr, "RewardPlay", true);
  161. }
  162. if(iRewardBox) {
  163. new
  164. Float: fObjectPos[3];
  165. GetDynamicObjectPos(iRewardObj, fObjectPos[0], fObjectPos[1], fObjectPos[2]);
  166. ini_SetFloat(iFileHandle, szFileStr, "RewardPosX", fObjectPos[0]);
  167. ini_SetFloat(iFileHandle, szFileStr, "RewardPosY", fObjectPos[1]);
  168. ini_SetFloat(iFileHandle, szFileStr, "RewardPosZ", fObjectPos[2]);
  169. }
  170. ini_SetInteger(iFileHandle, szFileStr, "TicketsSold", TicketsSold);
  171. fclose(iFileHandle);
  172. }
  173. stock Misc_Load() {
  174. new
  175. szResult[32],
  176. szFileStr[160],
  177. Float: fObjectPos[3],
  178. File: iFileHandle = fopen("serverConfig.ini", io_read);
  179. while(fread(iFileHandle, szFileStr, sizeof(szFileStr))) {
  180. if(ini_GetValue(szFileStr, "RaceLaps", szResult, sizeof(szResult))) RaceTotalLaps = strval(szResult);
  181. else if(ini_GetValue(szFileStr, "RaceJoins", szResult, sizeof(szResult))) TotalJoinsRace = strval(szResult);
  182. else if(ini_GetValue(szFileStr, "Jackpot", szResult, sizeof(szResult))) Jackpot = strval(szResult);
  183. else if(ini_GetValue(szFileStr, "Tax", szResult, sizeof(szResult))) Tax = strval(szResult);
  184. else if(ini_GetValue(szFileStr, "TaxVal", szResult, sizeof(szResult))) TaxValue = strval(szResult);
  185. else if(ini_GetValue(szFileStr, "VIPM", szResult, sizeof(szResult))) VIPM = strval(szResult);
  186. else if(ini_GetValue(szFileStr, "LoginCount", szResult, sizeof(szResult))) TotalLogin = strval(szResult);
  187. else if(ini_GetValue(szFileStr, "ConnCount", szResult, sizeof(szResult))) TotalConnect = strval(szResult);
  188. else if(ini_GetValue(szFileStr, "ABanCount", szResult, sizeof(szResult))) TotalAutoBan = strval(szResult);
  189. else if(ini_GetValue(szFileStr, "RegCount", szResult, sizeof(szResult))) TotalRegister = strval(szResult);
  190. else if(ini_GetValue(szFileStr, "MaxPCount", szResult, sizeof(szResult))) MaxPlayersConnected = strval(szResult);
  191. else if(ini_GetValue(szFileStr, "MaxPDay", szResult, sizeof(szResult))) MPDay = strval(szResult);
  192. else if(ini_GetValue(szFileStr, "MaxPMonth", szResult, sizeof(szResult))) MPMonth = strval(szResult);
  193. else if(ini_GetValue(szFileStr, "MaxPYear", szResult, sizeof(szResult))) MPYear = strval(szResult);
  194. else if(ini_GetValue(szFileStr, "Uptime", szResult, sizeof(szResult))) TotalUptime = strval(szResult);
  195. else if(ini_GetValue(szFileStr, "BoxWins", szResult, sizeof(szResult))) Titel[TitelWins] = strval(szResult);
  196. else if(ini_GetValue(szFileStr, "BoxLosses", szResult, sizeof(szResult))) Titel[TitelLoses] = strval(szResult);
  197. else if(ini_GetValue(szFileStr, "SpecTimer", szResult, sizeof(szResult))) SpecTimer = strval(szResult);
  198. else if(ini_GetValue(szFileStr, "RewardPlay", szResult, sizeof(szResult))) iRewardPlay = strval(szResult);
  199. else if(ini_GetValue(szFileStr, "RewardPosX", szResult, sizeof(szResult))) fObjectPos[0] = floatstr(szResult);
  200. else if(ini_GetValue(szFileStr, "RewardPosY", szResult, sizeof(szResult))) fObjectPos[1] = floatstr(szResult);
  201. else if(ini_GetValue(szFileStr, "RewardPosZ", szResult, sizeof(szResult))) fObjectPos[2] = floatstr(szResult);
  202. else if(ini_GetValue(szFileStr, "TicketsSold", szResult, sizeof(szResult))) TicketsSold = strval(szResult);
  203. else if(ini_GetValue(szFileStr, "TRTax", szResult, sizeof(szResult))) TRTax = strval(szResult);
  204. else if(ini_GetValue(szFileStr, "TRTaxVal", szResult, sizeof(szResult))) TRTaxValue = strval(szResult);
  205. else if(ini_GetValue(szFileStr, "SpeedingTickets", szResult, sizeof(szResult))) SpeedingTickets = strval(szResult);
  206. else if(ini_GetValue(szFileStr, "FIFType", szResult, sizeof(szResult))) FIFType = strval(szResult);
  207. else if(ini_GetValue(szFileStr, "FIFEnabled", szResult, sizeof(szResult))) FIFEnabled = strval(szResult);
  208. else if(ini_GetValue(szFileStr, "FIFGP3", szResult, sizeof(szResult))) FIFGP3 = strval(szResult);
  209. else if(ini_GetValue(szFileStr, "FIFTimeWarrior", szResult, sizeof(szResult))) FIFTimeWarrior = strval(szResult);
  210. else if(ini_GetValue(szFileStr, "FIFGambleX", szResult, sizeof(szResult))) FIFGamble[0] = floatstr(szResult);
  211. else if(ini_GetValue(szFileStr, "FIFGambleY", szResult, sizeof(szResult))) FIFGamble[1] = floatstr(szResult);
  212. else if(ini_GetValue(szFileStr, "FIFGambleZ", szResult, sizeof(szResult))) FIFGamble[2] = floatstr(szResult);
  213. else if(ini_GetValue(szFileStr, "FIFGThurs", szResult, sizeof(szResult))) FIFGThurs = strval(szResult);
  214. }
  215. if(iRewardBox) {
  216. iRewardObj = CreateDynamicObject(19055, fObjectPos[0], fObjectPos[1], fObjectPos[2], 0.0, 0.0, 0.0, .streamdistance = 100.0);
  217. tRewardText = CreateDynamic3DTextLabel("Gold Reward Gift Box\n{FFFFFF}/getrewardgift{F3FF02} to claim your gift!", COLOR_YELLOW, fObjectPos[0], fObjectPos[1], fObjectPos[2], 10.0, .testlos = 1, .streamdistance = 50.0);
  218. }
  219. if(FIFEnabled == 1)
  220. {
  221. FIFPickup = CreateDynamicPickup(1239, 23, FIFGamble[0], FIFGamble[1], FIFGamble[2], 0);
  222. FIFText = CreateDynamic3DTextLabel("Chance Gambler\n/gamblechances to risk all of your chances or double them", COLOR_RED, FIFGamble[0], FIFGamble[1], FIFGamble[2]+0.5,10.0);
  223. }
  224. fclose(iFileHandle);
  225. printf("[MiscLoad] Misc Loaded");
  226. }