Advertisement
Guest User

Untitled

a guest
Nov 14th, 2016
741
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 381.87 KB | None | 0 0
  1. //--------------------------------[ FUNCTIONS ]---------------------------
  2.  
  3. PinLogin(playerid)
  4. {
  5. new string[128];
  6. format(string, sizeof(string), "SELECT `Pin` FROM `accounts` WHERE `id` = %d", GetPlayerSQLId(playerid));
  7. mysql_function_query(MainPipeline, string, true, "OnPinCheck", "i", playerid);
  8. }
  9.  
  10. Group_DisbandGroup(iGroupID) {
  11.  
  12. new
  13. i = 0,
  14. szQuery[128];
  15.  
  16. arrGroupData[iGroupID][g_iAllegiance] = 0;
  17. arrGroupData[iGroupID][g_iBugAccess] = INVALID_RANK;
  18. arrGroupData[iGroupID][g_iRadioAccess] = INVALID_RANK;
  19. arrGroupData[iGroupID][g_iDeptRadioAccess] = INVALID_RANK;
  20. arrGroupData[iGroupID][g_iIntRadioAccess] = INVALID_RANK;
  21. arrGroupData[iGroupID][g_iGovAccess] = INVALID_RANK;
  22. arrGroupData[iGroupID][g_iFreeNameChange] = INVALID_RANK;
  23. arrGroupData[iGroupID][g_iSpikeStrips] = INVALID_RANK;
  24. arrGroupData[iGroupID][g_iBarricades] = INVALID_RANK;
  25. arrGroupData[iGroupID][g_iCones] = INVALID_RANK;
  26. arrGroupData[iGroupID][g_iFlares] = INVALID_RANK;
  27. arrGroupData[iGroupID][g_iBarrels] = INVALID_RANK;
  28. arrGroupData[iGroupID][g_iBudget] = 0;
  29. arrGroupData[iGroupID][g_iBudgetPayment] = 0;
  30. arrGroupData[iGroupID][g_fCratePos][0] = 0;
  31. arrGroupData[iGroupID][g_fCratePos][1] = 0;
  32. arrGroupData[iGroupID][g_fCratePos][2] = 0;
  33. arrGroupData[iGroupID][g_szGroupName][0] = 0;
  34. arrGroupData[iGroupID][g_szGroupMOTD][0] = 0;
  35.  
  36. arrGroupData[iGroupID][g_hDutyColour] = 0xFFFFFF;
  37. arrGroupData[iGroupID][g_hRadioColour] = 0xFFFFFF;
  38.  
  39. DestroyDynamic3DTextLabel(arrGroupData[iGroupID][g_tCrate3DLabel]);
  40.  
  41. while(i < MAX_GROUP_DIVS) {
  42. arrGroupDivisions[iGroupID][i++][0] = 0;
  43. }
  44. i = 0;
  45.  
  46. while(i < MAX_GROUP_RANKS) {
  47. arrGroupRanks[iGroupID][i][0] = 0;
  48. arrGroupData[iGroupID][g_iPaycheck][i++] = 0;
  49. }
  50. i = 0;
  51.  
  52. while(i < MAX_GROUP_WEAPONS) {
  53. arrGroupData[iGroupID][g_iLockerGuns][i] = 0;
  54. arrGroupData[iGroupID][g_iLockerCost][i++] = 0;
  55. }
  56.  
  57. i = 0;
  58. while(i < MAX_GROUP_LOCKERS) {
  59. DestroyDynamic3DTextLabel(arrGroupLockers[iGroupID][i][g_tLocker3DLabel]);
  60. arrGroupLockers[iGroupID][i][g_fLockerPos][0] = 0.0;
  61. arrGroupLockers[iGroupID][i][g_fLockerPos][1] = 0.0;
  62. arrGroupLockers[iGroupID][i][g_fLockerPos][2] = 0.0;
  63. arrGroupData[iGroupID][g_iLockerGuns][i] = 0;
  64. arrGroupData[iGroupID][g_iLockerCost][i++] = 0;
  65. }
  66. SaveGroup(iGroupID);
  67.  
  68. foreach(new x: Player)
  69. {
  70. if(PlayerInfo[x][pMember] == iGroupID || PlayerInfo[x][pLeader] == iGroupID) {
  71. SendClientMessageEx(x, COLOR_WHITE, "Your group has been disbanded by an administrator. All members have been automatically removed.");
  72. PlayerInfo[x][pLeader] = INVALID_GROUP_ID;
  73. PlayerInfo[x][pMember] = INVALID_GROUP_ID;
  74. PlayerInfo[x][pRank] = INVALID_RANK;
  75. PlayerInfo[x][pDivision] = INVALID_DIVISION;
  76. }
  77. if (PlayerInfo[x][pBugged] == iGroupID) PlayerInfo[x][pBugged] = INVALID_GROUP_ID;
  78. }
  79.  
  80.  
  81. format(szQuery, sizeof szQuery, "DELETE FROM `groupbans` WHERE `GroupBan` = %i", iGroupID);
  82. mysql_function_query(MainPipeline, szQuery, false, "OnQueryFinish", "ii", SENDDATA_THREAD, iGroupID+1);
  83.  
  84. format(szQuery, sizeof szQuery, "UPDATE `accounts` SET `Member` = "#INVALID_GROUP_ID", `Leader` = "#INVALID_GROUP_ID", `Division` = "#INVALID_DIVISION", `Rank` = "#INVALID_RANK" WHERE `Member` = %i OR `Leader` = %i", iGroupID, iGroupID);
  85. return mysql_function_query(MainPipeline, szQuery, false, "OnQueryFinish", "ii", SENDDATA_THREAD, iGroupID);
  86. }
  87.  
  88. SaveGroup(iGroupID) {
  89.  
  90. /*
  91. Internally, every group array/subarray starts from zero (divisions, group ids etc)
  92. When displaying to the clients or saving to the db, we add 1 to them!
  93. The only exception is ranks which already start from zero.
  94. */
  95.  
  96. if(!(0 <= iGroupID < MAX_GROUPS)) // Array bounds check. Use it.
  97. return 0;
  98.  
  99. new
  100. szQuery[2048],
  101. i = 0;
  102.  
  103. format(szQuery, sizeof szQuery, "UPDATE `groups` SET \
  104. `Type` = %i, `Name` = '%s', `MOTD` = '%s', `Allegiance` = %i, `Bug` = %i, \
  105. `Radio` = %i, `DeptRadio` = %i, `IntRadio` = %i, `GovAnnouncement` = %i, `FreeNameChange` = %i, `DutyColour` = %i, `RadioColour` = %i, ",
  106. arrGroupData[iGroupID][g_iGroupType], g_mysql_ReturnEscaped(arrGroupData[iGroupID][g_szGroupName], MainPipeline), arrGroupData[iGroupID][g_szGroupMOTD], arrGroupData[iGroupID][g_iAllegiance], arrGroupData[iGroupID][g_iBugAccess],
  107. arrGroupData[iGroupID][g_iRadioAccess], arrGroupData[iGroupID][g_iDeptRadioAccess], arrGroupData[iGroupID][g_iIntRadioAccess], arrGroupData[iGroupID][g_iGovAccess], arrGroupData[iGroupID][g_iFreeNameChange], arrGroupData[iGroupID][g_hDutyColour], arrGroupData[iGroupID][g_hRadioColour]
  108. );
  109. format(szQuery, sizeof szQuery, "%s\
  110. `Stock` = %i, `CrateX` = '%.2f', `CrateY` = '%.2f', `CrateZ` = '%.2f', \
  111. `SpikeStrips` = %i, `Barricades` = %i, `Cones` = %i, `Flares` = %i, `Barrels` = %i, \
  112. `Budget` = %i, `BudgetPayment` = %i, LockerCostType = %i, `CratesOrder` = '%d', `CrateIsland` = '%d', \
  113. `GarageX` = '%.2f', `GarageY` = '%.2f', `GarageZ` = '%.2f'",
  114. szQuery,
  115. arrGroupData[iGroupID][g_iLockerStock], arrGroupData[iGroupID][g_fCratePos][0], arrGroupData[iGroupID][g_fCratePos][1], arrGroupData[iGroupID][g_fCratePos][2],
  116. arrGroupData[iGroupID][g_iSpikeStrips], arrGroupData[iGroupID][g_iBarricades], arrGroupData[iGroupID][g_iCones], arrGroupData[iGroupID][g_iFlares], arrGroupData[iGroupID][g_iBarrels],
  117. arrGroupData[iGroupID][g_iBudget], arrGroupData[iGroupID][g_iBudgetPayment], arrGroupData[iGroupID][g_iLockerCostType], arrGroupData[iGroupID][g_iCratesOrder], arrGroupData[iGroupID][g_iCrateIsland],
  118. arrGroupData[iGroupID][g_fGaragePos][0], arrGroupData[iGroupID][g_fGaragePos][1], arrGroupData[iGroupID][g_fGaragePos][2]);
  119.  
  120. for(i = 0; i != MAX_GROUP_RANKS; ++i) format(szQuery, sizeof szQuery, "%s, `Rank%i` = '%s'", szQuery, i, arrGroupRanks[iGroupID][i]);
  121. for(i = 0; i != MAX_GROUP_RANKS; ++i) format(szQuery, sizeof szQuery, "%s, `Rank%iPay` = %i", szQuery, i, arrGroupData[iGroupID][g_iPaycheck][i]);
  122. for(i = 0; i != MAX_GROUP_DIVS; ++i) format(szQuery, sizeof szQuery, "%s, `Div%i` = '%s'", szQuery, i+1, arrGroupDivisions[iGroupID][i]);
  123. for(i = 0; i != MAX_GROUP_WEAPONS; ++i) format(szQuery, sizeof szQuery, "%s, `Gun%i` = %i, `Cost%i` = %i", szQuery, i+1, arrGroupData[iGroupID][g_iLockerGuns][i], i+1, arrGroupData[iGroupID][g_iLockerCost][i]);
  124. format(szQuery, sizeof szQuery, "%s WHERE `id` = %i", szQuery, iGroupID+1);
  125. mysql_function_query(MainPipeline, szQuery, false, "OnQueryFinish", "ii", SENDDATA_THREAD, INVALID_PLAYER_ID);
  126.  
  127. for (i = 0; i < MAX_GROUP_LOCKERS; i++) {
  128. format(szQuery, sizeof(szQuery), "UPDATE `lockers` SET `LockerX` = '%.2f', `LockerY` = '%.2f', `LockerZ` = '%.2f', `LockerVW` = %d, `LockerShare` = %d WHERE `Id` = %d", arrGroupLockers[iGroupID][i][g_fLockerPos][0], arrGroupLockers[iGroupID][i][g_fLockerPos][1], arrGroupLockers[iGroupID][i][g_fLockerPos][2], arrGroupLockers[iGroupID][i][g_iLockerVW], arrGroupLockers[iGroupID][i][g_iLockerShare], arrGroupLockers[iGroupID][i][g_iLockerSQLId]);
  129. mysql_function_query(MainPipeline, szQuery, false, "OnQueryFinish", "ii", SENDDATA_THREAD, INVALID_PLAYER_ID);
  130. }
  131. return 1;
  132. }
  133.  
  134. DynVeh_Save(iDvSlotID) {
  135. if((iDvSlotID > MAX_DYNAMIC_VEHICLES)) // Array bounds check. Use it.
  136. return 0;
  137.  
  138. new
  139. szQuery[2248],
  140. i = 0;
  141.  
  142. format(szQuery, sizeof szQuery,
  143. "UPDATE `groupvehs` SET `SpawnedID`= '%d',`gID`= '%d',`gDivID`= '%d', `fID`='%d', `rID`='%d', `vModel`= '%d', \
  144. `vPlate` = '%s',`vMaxHealth`= '%.2f',`vType`= '%d',`vLoadMax`= '%d',`vCol1`= '%d',`vCol2`= '%d', \
  145. `vX`= '%.2f',`vY`= '%.2f',`vZ`= '%.2f',`vRotZ`= '%.2f', `vUpkeep` = '%d', `vVW` = '%d', `vDisabled` = '%d', \
  146. `vInt` = '%d', `vFuel` = '%.5f'"
  147. , DynVehicleInfo[iDvSlotID][gv_iSpawnedID], DynVehicleInfo[iDvSlotID][gv_igID], DynVehicleInfo[iDvSlotID][gv_igDivID], DynVehicleInfo[iDvSlotID][gv_ifID], DynVehicleInfo[iDvSlotID][gv_irID], DynVehicleInfo[iDvSlotID][gv_iModel],
  148. g_mysql_ReturnEscaped(DynVehicleInfo[iDvSlotID][gv_iPlate], MainPipeline), DynVehicleInfo[iDvSlotID][gv_fMaxHealth], DynVehicleInfo[iDvSlotID][gv_iType], DynVehicleInfo[iDvSlotID][gv_iLoadMax], DynVehicleInfo[iDvSlotID][gv_iCol1], DynVehicleInfo[iDvSlotID][gv_iCol2],
  149. DynVehicleInfo[iDvSlotID][gv_fX], DynVehicleInfo[iDvSlotID][gv_fY], DynVehicleInfo[iDvSlotID][gv_fZ], DynVehicleInfo[iDvSlotID][gv_fRotZ], DynVehicleInfo[iDvSlotID][gv_iUpkeep], DynVehicleInfo[iDvSlotID][gv_iVW], DynVehicleInfo[iDvSlotID][gv_iDisabled],
  150. DynVehicleInfo[iDvSlotID][gv_iInt], DynVehicleInfo[iDvSlotID][gv_fFuel]);
  151.  
  152. for(i = 0; i != MAX_DV_OBJECTS; ++i) {
  153. format(szQuery, sizeof szQuery, "%s, `vAttachedObjectModel%i` = '%d'", szQuery, i+1, DynVehicleInfo[iDvSlotID][gv_iAttachedObjectModel][i]);
  154. format(szQuery, sizeof szQuery, "%s, `vObjectX%i` = '%.2f'", szQuery, i+1, DynVehicleInfo[iDvSlotID][gv_fObjectX][i]);
  155. format(szQuery, sizeof szQuery, "%s, `vObjectY%i` = '%.2f'", szQuery, i+1, DynVehicleInfo[iDvSlotID][gv_fObjectY][i]);
  156. format(szQuery, sizeof szQuery, "%s, `vObjectZ%i` = '%.2f'", szQuery, i+1, DynVehicleInfo[iDvSlotID][gv_fObjectZ][i]);
  157. format(szQuery, sizeof szQuery, "%s, `vObjectRX%i` = '%.2f'", szQuery, i+1, DynVehicleInfo[iDvSlotID][gv_fObjectRX][i]);
  158. format(szQuery, sizeof szQuery, "%s, `vObjectRY%i` = '%.2f'", szQuery, i+1, DynVehicleInfo[iDvSlotID][gv_fObjectRY][i]);
  159. format(szQuery, sizeof szQuery, "%s, `vObjectRZ%i` = '%.2f'", szQuery, i+1, DynVehicleInfo[iDvSlotID][gv_fObjectRZ][i]);
  160. }
  161.  
  162. for(i = 0; i != MAX_DV_MODS; ++i) format(szQuery, sizeof szQuery, "%s, `vMod%d` = %i", szQuery, i, DynVehicleInfo[iDvSlotID][gv_iMod][i]);
  163.  
  164. format(szQuery, sizeof szQuery, "%s WHERE `id` = %i", szQuery, iDvSlotID);
  165. return mysql_function_query(MainPipeline, szQuery, false, "OnQueryFinish", "ii", SENDDATA_THREAD, INVALID_PLAYER_ID);
  166. }
  167.  
  168. //--------------------------------[ INITIATE/EXIT ]---------------------------
  169.  
  170. // g_mysql_Init()
  171. // Description: Called with Gamemode Init.
  172. stock g_mysql_Init()
  173. {
  174. new SQL_HOST[64], SQL_DB[64], SQL_USER[32], SQL_PASS[128], SQL_DEBUG, SQL_DEBUGLOG;
  175. new SQL_SHOST[64], SQL_SDB[64], SQL_SUSER[32], SQL_SPASS[128];
  176. new fileString[128], File: fileHandle = fopen("mysql.cfg", io_read);
  177.  
  178. while(fread(fileHandle, fileString, sizeof(fileString))) {
  179. if(ini_GetValue(fileString, "HOST", SQL_HOST, sizeof(SQL_HOST))) continue;
  180. if(ini_GetValue(fileString, "DB", SQL_DB, sizeof(SQL_DB))) continue;
  181. if(ini_GetValue(fileString, "USER", SQL_USER, sizeof(SQL_USER))) continue;
  182. if(ini_GetValue(fileString, "PASS", SQL_PASS, sizeof(SQL_PASS))) continue;
  183. if(ini_GetInt(fileString, "SHOPAUTOMATED", ShopToggle)) continue;
  184. if(ini_GetValue(fileString, "SHOST", SQL_SHOST, sizeof(SQL_SHOST))) continue;
  185. if(ini_GetValue(fileString, "SDB", SQL_SDB, sizeof(SQL_SDB))) continue;
  186. if(ini_GetValue(fileString, "SUSER", SQL_SUSER, sizeof(SQL_SUSER))) continue;
  187. if(ini_GetValue(fileString, "SPASS", SQL_SPASS, sizeof(SQL_SPASS))) continue;
  188. if(ini_GetInt(fileString, "SERVER", servernumber)) continue;
  189. if(ini_GetInt(fileString, "DEBUG", SQL_DEBUG)) continue;
  190. if(ini_GetInt(fileString, "DEBUGLOG", SQL_DEBUGLOG)) continue;
  191. }
  192. fclose(fileHandle);
  193.  
  194. mysql_log(SQL_DEBUG, SQL_DEBUGLOG);
  195. MainPipeline = mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS);
  196.  
  197. printf("[MySQL] (Main Pipelines) Connecting to %s...", SQL_HOST);
  198. if(mysql_errno(MainPipeline) != 0)
  199. {
  200. printf("[MySQL] (MainPipeline) Fatal Error! Could not connect to MySQL: Host %s - DB: %s - User: %s", SQL_HOST, SQL_DB, SQL_USER);
  201. print("[MySQL] Note: Make sure that you have provided the correct connection credentials.");
  202. printf("[MySQL] Error number: %d", mysql_errno(MainPipeline));
  203. SendRconCommand("exit");
  204. }
  205. else print("[MySQL] (MainPipeline) Connection successful toward MySQL Database Server!");
  206.  
  207. if(ShopToggle == 1)
  208. {
  209. ShopPipeline = mysql_connect(SQL_SHOST, SQL_SUSER, SQL_SDB, SQL_SPASS);
  210.  
  211. printf("[MySQL] (Shop Pipelines) Connecting to %s...", SQL_SHOST);
  212. if(mysql_errno(ShopPipeline) != 0)
  213. {
  214. printf("[MySQL] (ShopPipeline) Fatal Error! Could not connect to MySQL: Host %s - DB: %s - User: %s", SQL_SHOST, SQL_SDB, SQL_SUSER);
  215. print("[MySQL] Note: Make sure that you have provided the correct connection credentials.");
  216. printf("[MySQL] Error number: %d", mysql_errno(ShopPipeline));
  217. //SendRconCommand("exit");
  218. }
  219. else print("[MySQL] (ShopPipeline) Connection successful toward MySQL Database Server!");
  220. }
  221.  
  222. InitiateGamemode(); // Start the server
  223.  
  224. return 1;
  225. }
  226.  
  227. // g_mysql_Exit()
  228. // Description: Called with Gamemode Exit.
  229. stock g_mysql_Exit()
  230. {
  231. mysql_close(MainPipeline);
  232. if(ShopToggle == 1) mysql_close(ShopPipeline);
  233. return 1;
  234. }
  235.  
  236. //--------------------------------[ CALLBACKS ]--------------------------------
  237.  
  238. forward OnQueryFinish(resultid, extraid, handleid);
  239. public OnQueryFinish(resultid, extraid, handleid)
  240. {
  241. new rows, fields;
  242. if(resultid != SENDDATA_THREAD) {
  243. if(extraid != INVALID_PLAYER_ID) {
  244. if(g_arrQueryHandle{extraid} != -1 && g_arrQueryHandle{extraid} != handleid) return 0;
  245. }
  246. cache_get_data(rows, fields, MainPipeline);
  247. }
  248. switch(resultid)
  249. {
  250. case LOADSALEDATA_THREAD:
  251. {
  252. if(rows > 0)
  253. {
  254. for(new i;i < rows;i++)
  255. {
  256. new szResult[32], szField[15];
  257. for(new z = 0; z < MAX_ITEMS; z++)
  258. {
  259. format(szField, sizeof(szField), "TotalSold%d", z);
  260. cache_get_field_content(i, szField, szResult, MainPipeline);
  261. AmountSold[z] = strval(szResult);
  262. //ShopItems[z][sSold] = strval(szResult);
  263.  
  264.  
  265. format(szField, sizeof(szField), "AmountMade%d", z);
  266. cache_get_field_content(i, szField, szResult, MainPipeline);
  267. AmountMade[z] = strval(szResult);
  268. //ShopItems[z][sMade] = strval(szResult);
  269. printf("TotalSold%d: %d | AmountMade%d: %d", z, AmountSold[z], z, AmountMade[z]);
  270. }
  271. break;
  272. }
  273. }
  274. else
  275. {
  276. mysql_function_query(MainPipeline, "INSERT INTO `sales` (`Month`) VALUES (NOW())", false, "OnQueryFinish", "i", SENDDATA_THREAD);
  277. mysql_function_query(MainPipeline, "SELECT * FROM `sales` WHERE `Month` > NOW() - INTERVAL 1 MONTH", true, "OnQueryFinish", "iii", LOADSALEDATA_THREAD, INVALID_PLAYER_ID, -1);
  278. print("[LOADSALEDATA] Inserted new row into `sales`");
  279. }
  280. }
  281. case LOADSHOPDATA_THREAD:
  282. {
  283. for(new i;i < rows;i++)
  284. {
  285. new szResult[32], szField[14];
  286. for(new z = 0; z < MAX_ITEMS; z++)
  287. {
  288. format(szField, sizeof(szField), "Price%d", z);
  289. cache_get_field_content(i, szField, szResult, MainPipeline);
  290. ShopItems[z][sItemPrice] = strval(szResult);
  291. Price[z] = strval(szResult);
  292. if(ShopItems[z][sItemPrice] == 0) ShopItems[z][sItemPrice] = 99999999;
  293. printf("Price%d: %d", z, ShopItems[z][sItemPrice]);
  294. }
  295. //printf("[LOADSHOPDATA] Price0: %d, Price1: %d, Price2: %d, Price3: %d, Price4: %d, Price5: %d, Price6: %d, Price7: %d, Pricr8: %d, Price9: %d, Price10: %d", Price[0], Price[1], Price[2], Price[3], Price[4], Price[5], Price[6], Price[7], Price[8], Price[9], Price[10]);
  296. break;
  297. }
  298. }
  299. case LOADMOTDDATA_THREAD:
  300. {
  301. for(new i;i < rows;i++)
  302. {
  303. new szResult[32];
  304. cache_get_field_content(i, "gMOTD", GlobalMOTD, MainPipeline, 128);
  305. cache_get_field_content(i, "aMOTD", AdminMOTD, MainPipeline, 128);
  306. cache_get_field_content(i, "vMOTD", VIPMOTD, MainPipeline, 128);
  307. cache_get_field_content(i, "cMOTD", CAMOTD, MainPipeline, 128);
  308. cache_get_field_content(i, "pMOTD", pMOTD, MainPipeline, 128);
  309. cache_get_field_content(i, "ShopTechPay", szResult, MainPipeline); ShopTechPay = floatstr(szResult);
  310. cache_get_field_content(i, "GiftCode", GiftCode, MainPipeline, 32);
  311. cache_get_field_content(i, "GiftCodeBypass", szResult, MainPipeline); GiftCodeBypass = strval(szResult);
  312. cache_get_field_content(i, "SecurityCode", SecurityCode, MainPipeline, 32);
  313. cache_get_field_content(i, "ShopClosed", szResult, MainPipeline); ShopClosed = strval(szResult);
  314. cache_get_field_content(i, "RimMod", szResult, MainPipeline); RimMod = strval(szResult);
  315. cache_get_field_content(i, "CarVoucher", szResult, MainPipeline); CarVoucher = strval(szResult);
  316. cache_get_field_content(i, "PVIPVoucher", szResult, MainPipeline); PVIPVoucher = strval(szResult);
  317. cache_get_field_content(i, "GarageVW", szResult, MainPipeline); GarageVW = strval(szResult);
  318. cache_get_field_content(i, "PumpkinStock", szResult, MainPipeline); PumpkinStock = strval(szResult);
  319. cache_get_field_content(i, "HalloweenShop", szResult, MainPipeline); HalloweenShop = strval(szResult);
  320. break;
  321. }
  322. }
  323. case LOADUSERDATA_THREAD:
  324. {
  325. if(IsPlayerConnected(extraid))
  326. {
  327. new szField[MAX_PLAYER_NAME], szResult[64];
  328.  
  329. for(new row;row < rows;row++)
  330. {
  331. cache_get_field_content(row, "Username", szField, MainPipeline, MAX_PLAYER_NAME);
  332.  
  333. if(strcmp(szField, GetPlayerNameExt(extraid), true) != 0)
  334. {
  335. return 1;
  336. }
  337. cache_get_field_content(row, "id", szResult, MainPipeline); PlayerInfo[extraid][pId] = strval(szResult);
  338. cache_get_field_content(row, "Online", szResult, MainPipeline); PlayerInfo[extraid][pOnline] = strval(szResult);
  339. cache_get_field_content(row, "Email", PlayerInfo[extraid][pEmail], MainPipeline, 128);
  340. cache_get_field_content(row, "IP", PlayerInfo[extraid][pIP], MainPipeline, 16);
  341. cache_get_field_content(row, "SecureIP", PlayerInfo[extraid][pSecureIP], MainPipeline, 16);
  342. cache_get_field_content(row, "ConnectedTime", szResult, MainPipeline); PlayerInfo[extraid][pConnectHours] = strval(szResult);
  343. cache_get_field_content(row, "BirthDate", PlayerInfo[extraid][pBirthDate], MainPipeline, 11);
  344. cache_get_field_content(row, "Sex", szResult, MainPipeline); PlayerInfo[extraid][pSex] = strval(szResult);
  345. cache_get_field_content(row, "Band", szResult, MainPipeline); PlayerInfo[extraid][pBanned] = strval(szResult);
  346. cache_get_field_content(row, "PermBand", szResult, MainPipeline); PlayerInfo[extraid][pPermaBanned] = strval(szResult);
  347. cache_get_field_content(row, "Registered", szResult, MainPipeline); PlayerInfo[extraid][pReg] = strval(szResult);
  348. cache_get_field_content(row, "Warnings", szResult, MainPipeline); PlayerInfo[extraid][pWarns] = strval(szResult);
  349. cache_get_field_content(row, "Disabled", szResult, MainPipeline); PlayerInfo[extraid][pDisabled] = strval(szResult);
  350. cache_get_field_content(row, "Level", szResult, MainPipeline); PlayerInfo[extraid][pLevel] = strval(szResult);
  351. cache_get_field_content(row, "AdminLevel", szResult, MainPipeline); PlayerInfo[extraid][pAdmin] = strval(szResult);
  352. cache_get_field_content(row, "SeniorModerator", szResult, MainPipeline); PlayerInfo[extraid][pSMod] = strval(szResult);
  353. cache_get_field_content(row, "DonateRank", szResult, MainPipeline); PlayerInfo[extraid][pDonateRank] = strval(szResult);
  354. cache_get_field_content(row, "Respect", szResult, MainPipeline); PlayerInfo[extraid][pExp] = strval(szResult);
  355. cache_get_field_content(row, "XP", szResult, MainPipeline); PlayerInfo[extraid][pXP] = strval(szResult);
  356. cache_get_field_content(row, "Money", szResult, MainPipeline); PlayerInfo[extraid][pCash] = strval(szResult);
  357. cache_get_field_content(row, "Bank", szResult, MainPipeline); PlayerInfo[extraid][pAccount] = strval(szResult);
  358. cache_get_field_content(row, "pHealth", szResult, MainPipeline); PlayerInfo[extraid][pHealth] = floatstr(szResult);
  359. cache_get_field_content(row, "pArmor", szResult, MainPipeline); PlayerInfo[extraid][pArmor] = floatstr(szResult);
  360. cache_get_field_content(row, "pSHealth", szResult, MainPipeline); PlayerInfo[extraid][pSHealth] = floatstr(szResult);
  361. cache_get_field_content(row, "Int", szResult, MainPipeline); PlayerInfo[extraid][pInt] = strval(szResult);
  362. cache_get_field_content(row, "VirtualWorld", szResult, MainPipeline); PlayerInfo[extraid][pVW] = strval(szResult);
  363. cache_get_field_content(row, "Model", szResult, MainPipeline); PlayerInfo[extraid][pModel] = strval(szResult);
  364. cache_get_field_content(row, "SPos_x", szResult, MainPipeline); PlayerInfo[extraid][pPos_x] = floatstr(szResult);
  365. cache_get_field_content(row, "SPos_y", szResult, MainPipeline); PlayerInfo[extraid][pPos_y] = floatstr(szResult);
  366. cache_get_field_content(row, "SPos_z", szResult, MainPipeline); PlayerInfo[extraid][pPos_z] = floatstr(szResult);
  367. cache_get_field_content(row, "SPos_r", szResult, MainPipeline); PlayerInfo[extraid][pPos_r] = floatstr(szResult);
  368. cache_get_field_content(row, "BanAppealer", szResult, MainPipeline); PlayerInfo[extraid][pBanAppealer] = strval(szResult);
  369. cache_get_field_content(row, "PR", szResult, MainPipeline); PlayerInfo[extraid][pPR] = strval(szResult);
  370. cache_get_field_content(row, "HR", szResult, MainPipeline); PlayerInfo[extraid][pHR] = strval(szResult);
  371. cache_get_field_content(row, "AP", szResult, MainPipeline); PlayerInfo[extraid][pAP] = strval(szResult);
  372. cache_get_field_content(row, "Security", szResult, MainPipeline); PlayerInfo[extraid][pSecurity] = strval(szResult);
  373. cache_get_field_content(row, "ShopTech", szResult, MainPipeline); PlayerInfo[extraid][pShopTech] = strval(szResult);
  374. cache_get_field_content(row, "FactionModerator", szResult, MainPipeline); PlayerInfo[extraid][pFactionModerator] = strval(szResult);
  375. cache_get_field_content(row, "GangModerator", szResult, MainPipeline); PlayerInfo[extraid][pGangModerator] = strval(szResult);
  376. cache_get_field_content(row, "Undercover", szResult, MainPipeline); PlayerInfo[extraid][pUndercover] = strval(szResult);
  377. cache_get_field_content(row, "TogReports", szResult, MainPipeline); PlayerInfo[extraid][pTogReports] = strval(szResult);
  378. cache_get_field_content(row, "Radio", szResult, MainPipeline); PlayerInfo[extraid][pRadio] = strval(szResult);
  379. cache_get_field_content(row, "RadioFreq", szResult, MainPipeline); PlayerInfo[extraid][pRadioFreq] = strval(szResult);
  380. cache_get_field_content(row, "UpgradePoints", szResult, MainPipeline); PlayerInfo[extraid][gPupgrade] = strval(szResult);
  381. cache_get_field_content(row, "Origin", szResult, MainPipeline); PlayerInfo[extraid][pOrigin] = strval(szResult);
  382. cache_get_field_content(row, "Muted", szResult, MainPipeline); PlayerInfo[extraid][pMuted] = strval(szResult);
  383. cache_get_field_content(row, "Crimes", szResult, MainPipeline); PlayerInfo[extraid][pCrimes] = strval(szResult);
  384. cache_get_field_content(row, "Accent", szResult, MainPipeline); PlayerInfo[extraid][pAccent] = strval(szResult);
  385. cache_get_field_content(row, "CHits", szResult, MainPipeline); PlayerInfo[extraid][pCHits] = strval(szResult);
  386. cache_get_field_content(row, "FHits", szResult, MainPipeline); PlayerInfo[extraid][pFHits] = strval(szResult);
  387. cache_get_field_content(row, "Arrested", szResult, MainPipeline); PlayerInfo[extraid][pArrested] = strval(szResult);
  388. cache_get_field_content(row, "Phonebook", szResult, MainPipeline); PlayerInfo[extraid][pPhoneBook] = strval(szResult);
  389. cache_get_field_content(row, "LottoNr", szResult, MainPipeline); PlayerInfo[extraid][pLottoNr] = strval(szResult);
  390. cache_get_field_content(row, "Fishes", szResult, MainPipeline); PlayerInfo[extraid][pFishes] = strval(szResult);
  391. cache_get_field_content(row, "BiggestFish", szResult, MainPipeline); PlayerInfo[extraid][pBiggestFish] = strval(szResult);
  392. cache_get_field_content(row, "Job", szResult, MainPipeline); PlayerInfo[extraid][pJob] = strval(szResult);
  393. cache_get_field_content(row, "Job2", szResult, MainPipeline); PlayerInfo[extraid][pJob2] = strval(szResult);
  394. cache_get_field_content(row, "Paycheck", szResult, MainPipeline); PlayerInfo[extraid][pPayCheck] = strval(szResult);
  395. cache_get_field_content(row, "HeadValue", szResult, MainPipeline); PlayerInfo[extraid][pHeadValue] = strval(szResult);
  396. cache_get_field_content(row, "JailTime", szResult, MainPipeline); PlayerInfo[extraid][pJailTime] = strval(szResult);
  397. cache_get_field_content(row, "WRestricted", szResult, MainPipeline); PlayerInfo[extraid][pWRestricted] = strval(szResult);
  398. cache_get_field_content(row, "Materials", szResult, MainPipeline); PlayerInfo[extraid][pMats] = strval(szResult);
  399. cache_get_field_content(row, "Crates", szResult, MainPipeline); PlayerInfo[extraid][pCrates] = strval(szResult);
  400. cache_get_field_content(row, "Pot", szResult, MainPipeline); PlayerInfo[extraid][pPot] = strval(szResult);
  401. cache_get_field_content(row, "Crack", szResult, MainPipeline); PlayerInfo[extraid][pCrack] = strval(szResult);
  402. cache_get_field_content(row, "Nation", szResult, MainPipeline); PlayerInfo[extraid][pNation] = strval(szResult);
  403. cache_get_field_content(row, "Leader", szResult, MainPipeline); PlayerInfo[extraid][pLeader] = strval(szResult);
  404. cache_get_field_content(row, "Member", szResult, MainPipeline); PlayerInfo[extraid][pMember] = strval(szResult);
  405. cache_get_field_content(row, "Division", szResult, MainPipeline); PlayerInfo[extraid][pDivision] = strval(szResult);
  406. cache_get_field_content(row, "FMember", szResult, MainPipeline); PlayerInfo[extraid][pFMember] = strval(szResult);
  407. cache_get_field_content(row, "Rank", szResult, MainPipeline); PlayerInfo[extraid][pRank] = strval(szResult);
  408. cache_get_field_content(row, "DetSkill", szResult, MainPipeline); PlayerInfo[extraid][pDetSkill] = strval(szResult);
  409. cache_get_field_content(row, "SexSkill", szResult, MainPipeline); PlayerInfo[extraid][pSexSkill] = strval(szResult);
  410. cache_get_field_content(row, "BoxSkill", szResult, MainPipeline); PlayerInfo[extraid][pBoxSkill] = strval(szResult);
  411. cache_get_field_content(row, "LawSkill", szResult, MainPipeline); PlayerInfo[extraid][pLawSkill] = strval(szResult);
  412. cache_get_field_content(row, "MechSkill", szResult, MainPipeline); PlayerInfo[extraid][pMechSkill] = strval(szResult);
  413. cache_get_field_content(row, "TruckSkill", szResult, MainPipeline); PlayerInfo[extraid][pTruckSkill] = strval(szResult);
  414. cache_get_field_content(row, "DrugsSkill", szResult, MainPipeline); PlayerInfo[extraid][pDrugsSkill] = strval(szResult);
  415. cache_get_field_content(row, "ArmsSkill", szResult, MainPipeline); PlayerInfo[extraid][pArmsSkill] = strval(szResult);
  416. cache_get_field_content(row, "SmugglerSkill", szResult, MainPipeline); PlayerInfo[extraid][pSmugSkill] = strval(szResult);
  417. cache_get_field_content(row, "FishSkill", szResult, MainPipeline); PlayerInfo[extraid][pFishSkill] = strval(szResult);
  418. cache_get_field_content(row, "FightingStyle", szResult, MainPipeline); PlayerInfo[extraid][pFightStyle] = strval(szResult);
  419. cache_get_field_content(row, "PhoneNr", szResult, MainPipeline); PlayerInfo[extraid][pPnumber] = strval(szResult);
  420. cache_get_field_content(row, "Apartment", szResult, MainPipeline); PlayerInfo[extraid][pPhousekey] = strval(szResult);
  421. cache_get_field_content(row, "Apartment2", szResult, MainPipeline); PlayerInfo[extraid][pPhousekey2] = strval(szResult);
  422. cache_get_field_content(row, "Renting", szResult, MainPipeline); PlayerInfo[extraid][pRenting] = strval(szResult);
  423. cache_get_field_content(row, "CarLic", szResult, MainPipeline); PlayerInfo[extraid][pCarLic] = strval(szResult);
  424. cache_get_field_content(row, "FlyLic", szResult, MainPipeline); PlayerInfo[extraid][pFlyLic] = strval(szResult);
  425. cache_get_field_content(row, "BoatLic", szResult, MainPipeline); PlayerInfo[extraid][pBoatLic] = strval(szResult);
  426. cache_get_field_content(row, "FishLic", szResult, MainPipeline); PlayerInfo[extraid][pFishLic] = strval(szResult);
  427. cache_get_field_content(row, "CheckCash", szResult, MainPipeline); PlayerInfo[extraid][pCheckCash] = strval(szResult);
  428. cache_get_field_content(row, "Checks", szResult, MainPipeline); PlayerInfo[extraid][pChecks] = strval(szResult);
  429. cache_get_field_content(row, "GunLic", szResult, MainPipeline); PlayerInfo[extraid][pGunLic] = strval(szResult);
  430.  
  431. for(new i = 0; i < 12; i++)
  432. {
  433. format(szField, sizeof(szField), "Gun%d", i);
  434. cache_get_field_content(row, szField, szResult, MainPipeline);
  435. PlayerInfo[extraid][pGuns][i] = strval(szResult);
  436. }
  437.  
  438. cache_get_field_content(row, "DrugsTime", szResult, MainPipeline); PlayerInfo[extraid][pDrugsTime] = strval(szResult);
  439. cache_get_field_content(row, "LawyerTime", szResult, MainPipeline); PlayerInfo[extraid][pLawyerTime] = strval(szResult);
  440. cache_get_field_content(row, "LawyerFreeTime", szResult, MainPipeline); PlayerInfo[extraid][pLawyerFreeTime] = strval(szResult);
  441. cache_get_field_content(row, "MechTime", szResult, MainPipeline); PlayerInfo[extraid][pMechTime] = strval(szResult);
  442. cache_get_field_content(row, "SexTime", szResult, MainPipeline); PlayerInfo[extraid][pSexTime] = strval(szResult);
  443. cache_get_field_content(row, "PayDay", szResult, MainPipeline); PlayerInfo[extraid][pConnectSeconds] = strval(szResult);
  444. cache_get_field_content(row, "PayDayHad", szResult, MainPipeline); PlayerInfo[extraid][pPayDayHad] = strval(szResult);
  445. cache_get_field_content(row, "CDPlayer", szResult, MainPipeline); PlayerInfo[extraid][pCDPlayer] = strval(szResult);
  446. cache_get_field_content(row, "Dice", szResult, MainPipeline); PlayerInfo[extraid][pDice] = strval(szResult);
  447. cache_get_field_content(row, "Spraycan", szResult, MainPipeline); PlayerInfo[extraid][pSpraycan] = strval(szResult);
  448. cache_get_field_content(row, "Rope", szResult, MainPipeline); PlayerInfo[extraid][pRope] = strval(szResult);
  449. cache_get_field_content(row, "Cigars", szResult, MainPipeline); PlayerInfo[extraid][pCigar] = strval(szResult);
  450. cache_get_field_content(row, "Sprunk", szResult, MainPipeline); PlayerInfo[extraid][pSprunk] = strval(szResult);
  451. cache_get_field_content(row, "Bombs", szResult, MainPipeline); PlayerInfo[extraid][pBombs] = strval(szResult);
  452. cache_get_field_content(row, "Wins", szResult, MainPipeline); PlayerInfo[extraid][pWins] = strval(szResult);
  453. cache_get_field_content(row, "Loses", szResult, MainPipeline); PlayerInfo[extraid][pLoses] = strval(szResult);
  454. cache_get_field_content(row, "Tutorial", szResult, MainPipeline); PlayerInfo[extraid][pTut] = strval(szResult);
  455. cache_get_field_content(row, "OnDuty", szResult, MainPipeline); PlayerInfo[extraid][pDuty] = strval(szResult);
  456. cache_get_field_content(row, "Hospital", szResult, MainPipeline); PlayerInfo[extraid][pHospital] = strval(szResult);
  457. cache_get_field_content(row, "MarriedID", szResult, MainPipeline); PlayerInfo[extraid][pMarriedID] = strval(szResult);
  458. cache_get_field_content(row, "ContractBy", PlayerInfo[extraid][pContractBy], MainPipeline, MAX_PLAYER_NAME);
  459. cache_get_field_content(row, "ContractDetail", PlayerInfo[extraid][pContractDetail], MainPipeline, 64);
  460. cache_get_field_content(row, "WantedLevel", szResult, MainPipeline); PlayerInfo[extraid][pWantedLevel] = strval(szResult);
  461. cache_get_field_content(row, "Insurance", szResult, MainPipeline); PlayerInfo[extraid][pInsurance] = strval(szResult);
  462. cache_get_field_content(row, "911Muted", szResult, MainPipeline); PlayerInfo[extraid][p911Muted] = strval(szResult);
  463. cache_get_field_content(row, "NewMuted", szResult, MainPipeline); PlayerInfo[extraid][pNMute] = strval(szResult);
  464. cache_get_field_content(row, "NewMutedTotal", szResult, MainPipeline); PlayerInfo[extraid][pNMuteTotal] = strval(szResult);
  465. cache_get_field_content(row, "AdMuted", szResult, MainPipeline); PlayerInfo[extraid][pADMute] = strval(szResult);
  466. cache_get_field_content(row, "AdMutedTotal", szResult, MainPipeline); PlayerInfo[extraid][pADMuteTotal] = strval(szResult);
  467. cache_get_field_content(row, "HelpMute", szResult, MainPipeline); PlayerInfo[extraid][pHelpMute] = strval(szResult);
  468. cache_get_field_content(row, "Helper", szResult, MainPipeline); PlayerInfo[extraid][pHelper] = strval(szResult);
  469. cache_get_field_content(row, "ReportMuted", szResult, MainPipeline); PlayerInfo[extraid][pRMuted] = strval(szResult);
  470. cache_get_field_content(row, "ReportMutedTotal", szResult, MainPipeline); PlayerInfo[extraid][pRMutedTotal] = strval(szResult);
  471. cache_get_field_content(row, "ReportMutedTime", szResult, MainPipeline); PlayerInfo[extraid][pRMutedTime] = strval(szResult);
  472. cache_get_field_content(row, "DMRMuted", szResult, MainPipeline); PlayerInfo[extraid][pDMRMuted] = strval(szResult);
  473. cache_get_field_content(row, "VIPMuted", szResult, MainPipeline); PlayerInfo[extraid][pVMuted] = strval(szResult);
  474. cache_get_field_content(row, "VIPMutedTime", szResult, MainPipeline); PlayerInfo[extraid][pVMutedTime] = strval(szResult);
  475. cache_get_field_content(row, "GiftTime", szResult, MainPipeline); PlayerInfo[extraid][pGiftTime] = strval(szResult);
  476. cache_get_field_content(row, "AdvisorDutyHours", szResult, MainPipeline); PlayerInfo[extraid][pDutyHours] = strval(szResult);
  477. cache_get_field_content(row, "AcceptedHelp", szResult, MainPipeline); PlayerInfo[extraid][pAcceptedHelp] = strval(szResult);
  478. cache_get_field_content(row, "AcceptReport", szResult, MainPipeline); PlayerInfo[extraid][pAcceptReport] = strval(szResult);
  479. cache_get_field_content(row, "ShopTechOrders", szResult, MainPipeline); PlayerInfo[extraid][pShopTechOrders] = strval(szResult);
  480. cache_get_field_content(row, "TrashReport", szResult, MainPipeline); PlayerInfo[extraid][pTrashReport] = strval(szResult);
  481. cache_get_field_content(row, "GangWarn", szResult, MainPipeline); PlayerInfo[extraid][pGangWarn] = strval(szResult);
  482. cache_get_field_content(row, "CSFBanned", szResult, MainPipeline); PlayerInfo[extraid][pCSFBanned] = strval(szResult);
  483. cache_get_field_content(row, "VIPInviteDay", szResult, MainPipeline); PlayerInfo[extraid][pVIPInviteDay] = strval(szResult);
  484. cache_get_field_content(row, "TempVIP", szResult, MainPipeline); PlayerInfo[extraid][pTempVIP] = strval(szResult);
  485. cache_get_field_content(row, "BuddyInvite", szResult, MainPipeline); PlayerInfo[extraid][pBuddyInvited] = strval(szResult);
  486. cache_get_field_content(row, "Tokens", szResult, MainPipeline); PlayerInfo[extraid][pTokens] = strval(szResult);
  487. cache_get_field_content(row, "PTokens", szResult, MainPipeline); PlayerInfo[extraid][pPaintTokens] = strval(szResult);
  488. cache_get_field_content(row, "TriageTime", szResult, MainPipeline); PlayerInfo[extraid][pTriageTime] = strval(szResult);
  489. cache_get_field_content(row, "PrisonedBy", PlayerInfo[extraid][pPrisonedBy], MainPipeline, MAX_PLAYER_NAME);
  490. cache_get_field_content(row, "PrisonReason", PlayerInfo[extraid][pPrisonReason], MainPipeline, 128);
  491. cache_get_field_content(row, "TaxiLicense", szResult, MainPipeline); PlayerInfo[extraid][pTaxiLicense] = strval(szResult);
  492. cache_get_field_content(row, "TicketTime", szResult, MainPipeline); PlayerInfo[extraid][pTicketTime] = strval(szResult);
  493. cache_get_field_content(row, "Screwdriver", szResult, MainPipeline); PlayerInfo[extraid][pScrewdriver] = strval(szResult);
  494. cache_get_field_content(row, "Smslog", szResult, MainPipeline); PlayerInfo[extraid][pSmslog] = strval(szResult);
  495. cache_get_field_content(row, "Wristwatch", szResult, MainPipeline); PlayerInfo[extraid][pWristwatch] = strval(szResult);
  496. cache_get_field_content(row, "Surveillance", szResult, MainPipeline); PlayerInfo[extraid][pSurveillance] = strval(szResult);
  497. cache_get_field_content(row, "Tire", szResult, MainPipeline); PlayerInfo[extraid][pTire] = strval(szResult);
  498. cache_get_field_content(row, "Firstaid", szResult, MainPipeline); PlayerInfo[extraid][pFirstaid] = strval(szResult);
  499. cache_get_field_content(row, "Rccam", szResult, MainPipeline); PlayerInfo[extraid][pRccam] = strval(szResult);
  500. cache_get_field_content(row, "Receiver", szResult, MainPipeline); PlayerInfo[extraid][pReceiver] = strval(szResult);
  501. cache_get_field_content(row, "GPS", szResult, MainPipeline); PlayerInfo[extraid][pGPS] = strval(szResult);
  502. cache_get_field_content(row, "Sweep", szResult, MainPipeline); PlayerInfo[extraid][pSweep] = strval(szResult);
  503. cache_get_field_content(row, "SweepLeft", szResult, MainPipeline); PlayerInfo[extraid][pSweepLeft] = strval(szResult);
  504. cache_get_field_content(row, "Bugged", szResult, MainPipeline); PlayerInfo[extraid][pBugged] = strval(szResult);
  505. cache_get_field_content(row, "pWExists", szResult, MainPipeline); PlayerInfo[extraid][pWeedObject] = strval(szResult);
  506. cache_get_field_content(row, "pWSeeds", szResult, MainPipeline); PlayerInfo[extraid][pWSeeds] = strval(szResult);
  507. cache_get_field_content(row, "Warrants", PlayerInfo[extraid][pWarrant], MainPipeline, 128);
  508. cache_get_field_content(row, "JudgeJailTime", szResult, MainPipeline); PlayerInfo[extraid][pJudgeJailTime] = strval(szResult);
  509. cache_get_field_content(row, "JudgeJailType", szResult, MainPipeline); PlayerInfo[extraid][pJudgeJailType] = strval(szResult);
  510. cache_get_field_content(row, "ProbationTime", szResult, MainPipeline); PlayerInfo[extraid][pProbationTime] = strval(szResult);
  511. cache_get_field_content(row, "DMKills", szResult, MainPipeline); PlayerInfo[extraid][pDMKills] = strval(szResult);
  512. cache_get_field_content(row, "Order", szResult, MainPipeline); PlayerInfo[extraid][pOrder] = strval(szResult);
  513. cache_get_field_content(row, "OrderConfirmed", szResult, MainPipeline); PlayerInfo[extraid][pOrderConfirmed] = strval(szResult);
  514. cache_get_field_content(row, "CallsAccepted", szResult, MainPipeline); PlayerInfo[extraid][pCallsAccepted] = strval(szResult);
  515. cache_get_field_content(row, "PatientsDelivered", szResult, MainPipeline); PlayerInfo[extraid][pPatientsDelivered] = strval(szResult);
  516. cache_get_field_content(row, "LiveBanned", szResult, MainPipeline); PlayerInfo[extraid][pLiveBanned] = strval(szResult);
  517. cache_get_field_content(row, "FreezeBank", szResult, MainPipeline); PlayerInfo[extraid][pFreezeBank] = strval(szResult);
  518. cache_get_field_content(row, "FreezeHouse", szResult, MainPipeline); PlayerInfo[extraid][pFreezeHouse] = strval(szResult);
  519. cache_get_field_content(row, "FreezeCar", szResult, MainPipeline); PlayerInfo[extraid][pFreezeCar] = strval(szResult);
  520. cache_get_field_content(row, "Firework", szResult, MainPipeline); PlayerInfo[extraid][pFirework] = strval(szResult);
  521. cache_get_field_content(row, "Boombox", szResult, MainPipeline); PlayerInfo[extraid][pBoombox] = strval(szResult);
  522. cache_get_field_content(row, "Hydration", szResult, MainPipeline); PlayerInfo[extraid][pHydration] = strval(szResult);
  523. cache_get_field_content(row, "Speedo", szResult, MainPipeline); PlayerInfo[extraid][pSpeedo] = strval(szResult);
  524. cache_get_field_content(row, "DoubleEXP", szResult, MainPipeline); PlayerInfo[extraid][pDoubleEXP] = strval(szResult);
  525. cache_get_field_content(row, "EXPToken", szResult, MainPipeline); PlayerInfo[extraid][pEXPToken] = strval(szResult);
  526. cache_get_field_content(row, "RacePlayerLaps", szResult, MainPipeline); PlayerInfo[extraid][pRacePlayerLaps] = strval(szResult);
  527. cache_get_field_content(row, "Ringtone", szResult, MainPipeline); PlayerInfo[extraid][pRingtone] = strval(szResult);
  528. cache_get_field_content(row, "VIPM", szResult, MainPipeline); PlayerInfo[extraid][pVIPM] = strval(szResult);
  529. cache_get_field_content(row, "VIPMO", szResult, MainPipeline); PlayerInfo[extraid][pVIPMO] = strval(szResult);
  530. cache_get_field_content(row, "VIPExpire", szResult, MainPipeline); PlayerInfo[extraid][pVIPExpire] = strval(szResult);
  531. cache_get_field_content(row, "GVip", szResult, MainPipeline); PlayerInfo[extraid][pGVip] = strval(szResult);
  532. cache_get_field_content(row, "Watchdog", szResult, MainPipeline); PlayerInfo[extraid][pWatchdog] = strval(szResult);
  533. cache_get_field_content(row, "VIPSold", szResult, MainPipeline); PlayerInfo[extraid][pVIPSold] = strval(szResult);
  534. cache_get_field_content(row, "GoldBoxTokens", szResult, MainPipeline); PlayerInfo[extraid][pGoldBoxTokens] = strval(szResult);
  535. cache_get_field_content(row, "DrawChance", szResult, MainPipeline); PlayerInfo[extraid][pRewardDrawChance] = strval(szResult);
  536. cache_get_field_content(row, "RewardHours", szResult, MainPipeline); PlayerInfo[extraid][pRewardHours] = floatstr(szResult);
  537. cache_get_field_content(row, "CarsRestricted", szResult, MainPipeline); PlayerInfo[extraid][pRVehRestricted] = strval(szResult);
  538. cache_get_field_content(row, "LastCarWarning", szResult, MainPipeline); PlayerInfo[extraid][pLastRVehWarn] = strval(szResult);
  539. cache_get_field_content(row, "CarWarns", szResult, MainPipeline); PlayerInfo[extraid][pRVehWarns] = strval(szResult);
  540. cache_get_field_content(row, "Flagged", szResult, MainPipeline); PlayerInfo[extraid][pFlagged] = strval(szResult);
  541. cache_get_field_content(row, "Paper", szResult, MainPipeline); PlayerInfo[extraid][pPaper] = strval(szResult);
  542. cache_get_field_content(row, "MailEnabled", szResult, MainPipeline); PlayerInfo[extraid][pMailEnabled] = strval(szResult);
  543. cache_get_field_content(row, "Mailbox", szResult, MainPipeline); PlayerInfo[extraid][pMailbox] = strval(szResult);
  544. cache_get_field_content(row, "Business", szResult, MainPipeline); PlayerInfo[extraid][pBusiness] = strval(szResult);
  545. cache_get_field_content(row, "BusinessRank", szResult, MainPipeline); PlayerInfo[extraid][pBusinessRank] = strval(szResult);
  546. cache_get_field_content(row, "TreasureSkill", szResult, MainPipeline); PlayerInfo[extraid][pTreasureSkill] = strval(szResult);
  547. cache_get_field_content(row, "MetalDetector", szResult, MainPipeline); PlayerInfo[extraid][pMetalDetector] = strval(szResult);
  548. cache_get_field_content(row, "HelpedBefore", szResult, MainPipeline); PlayerInfo[extraid][pHelpedBefore] = strval(szResult);
  549. cache_get_field_content(row, "Trickortreat", szResult, MainPipeline); PlayerInfo[extraid][pTrickortreat] = strval(szResult);
  550. cache_get_field_content(row, "LastCharmReceived", szResult, MainPipeline); PlayerInfo[extraid][pLastCharmReceived] = strval(szResult);
  551. cache_get_field_content(row, "RHMutes", szResult, MainPipeline); PlayerInfo[extraid][pRHMutes] = strval(szResult);
  552. cache_get_field_content(row, "RHMuteTime", szResult, MainPipeline); PlayerInfo[extraid][pRHMuteTime] = strval(szResult);
  553. cache_get_field_content(row, "GiftCode", szResult, MainPipeline); PlayerInfo[extraid][pGiftCode] = strval(szResult);
  554. cache_get_field_content(row, "Table", szResult, MainPipeline); PlayerInfo[extraid][pTable] = strval(szResult);
  555. cache_get_field_content(row, "OpiumSeeds", szResult, MainPipeline); PlayerInfo[extraid][pOpiumSeeds] = strval(szResult);
  556. cache_get_field_content(row, "RawOpium", szResult, MainPipeline); PlayerInfo[extraid][pRawOpium] = strval(szResult);
  557. cache_get_field_content(row, "Heroin", szResult, MainPipeline); PlayerInfo[extraid][pHeroin] = strval(szResult);
  558. cache_get_field_content(row, "Syringe", szResult, MainPipeline); PlayerInfo[extraid][pSyringes] = strval(szResult);
  559. cache_get_field_content(row, "Skins", szResult, MainPipeline); PlayerInfo[extraid][pSkins] = strval(szResult);
  560. cache_get_field_content(row, "Hunger", szResult, MainPipeline); PlayerInfo[extraid][pHunger] = strval(szResult);
  561. cache_get_field_content(row, "HungerTimer", szResult, MainPipeline); PlayerInfo[extraid][pHungerTimer] = strval(szResult);
  562. cache_get_field_content(row, "HungerDeathTimer", szResult, MainPipeline); PlayerInfo[extraid][pHungerDeathTimer] = strval(szResult);
  563. cache_get_field_content(row, "Fitness", szResult, MainPipeline); PlayerInfo[extraid][pFitness] = strval(szResult);
  564. cache_get_field_content(row, "ForcePasswordChange", szResult, MainPipeline); PlayerInfo[extraid][pForcePasswordChange] = strval(szResult);
  565. cache_get_field_content(row, "Credits", szResult, MainPipeline); PlayerInfo[extraid][pCredits] = strval(szResult);
  566. cache_get_field_content(row, "HealthCare", szResult, MainPipeline); PlayerInfo[extraid][pHealthCare] = strval(szResult);
  567. cache_get_field_content(row, "TotalCredits", szResult, MainPipeline); PlayerInfo[extraid][pTotalCredits] = strval(szResult);
  568. cache_get_field_content(row, "ReceivedCredits", szResult, MainPipeline); PlayerInfo[extraid][pReceivedCredits] = strval(szResult);
  569. cache_get_field_content(row, "RimMod", szResult, MainPipeline); PlayerInfo[extraid][pRimMod] = strval(szResult);
  570. cache_get_field_content(row, "Tazer", szResult, MainPipeline); PlayerInfo[extraid][pHasTazer] = strval(szResult);
  571. cache_get_field_content(row, "Cuff", szResult, MainPipeline); PlayerInfo[extraid][pHasCuff] = strval(szResult);
  572. cache_get_field_content(row, "CarVoucher", szResult, MainPipeline); PlayerInfo[extraid][pCarVoucher] = strval(szResult);
  573. cache_get_field_content(row, "ReferredBy", PlayerInfo[extraid][pReferredBy], MainPipeline, MAX_PLAYER_NAME);
  574. cache_get_field_content(row, "PendingRefReward", szResult, MainPipeline); PlayerInfo[extraid][pPendingRefReward] = strval(szResult);
  575. cache_get_field_content(row, "Refers", szResult, MainPipeline); PlayerInfo[extraid][pRefers] = strval(szResult);
  576. cache_get_field_content(row, "Famed", szResult, MainPipeline); PlayerInfo[extraid][pFamed] = strval(szResult);
  577. cache_get_field_content(row, "FamedMuted", szResult, MainPipeline); PlayerInfo[extraid][pFMuted] = strval(szResult);
  578. cache_get_field_content(row, "DefendTime", szResult, MainPipeline); PlayerInfo[extraid][pDefendTime] = strval(szResult);
  579. cache_get_field_content(row, "VehicleSlot", szResult, MainPipeline); PlayerInfo[extraid][pVehicleSlot] = strval(szResult);
  580. cache_get_field_content(row, "PVIPVoucher", szResult, MainPipeline); PlayerInfo[extraid][pPVIPVoucher] = strval(szResult);
  581. cache_get_field_content(row, "ToySlot", szResult, MainPipeline); PlayerInfo[extraid][pToySlot] = strval(szResult);
  582. cache_get_field_content(row, "RFLTeam", szResult, MainPipeline); PlayerInfo[extraid][pRFLTeam] = strval(szResult);
  583. cache_get_field_content(row, "RFLTeamL", szResult, MainPipeline); PlayerInfo[extraid][pRFLTeamL] = strval(szResult);
  584. cache_get_field_content(row, "VehVoucher", szResult, MainPipeline); PlayerInfo[extraid][pVehVoucher] = strval(szResult);
  585. cache_get_field_content(row, "SVIPVoucher", szResult, MainPipeline); PlayerInfo[extraid][pSVIPVoucher] = strval(szResult);
  586. cache_get_field_content(row, "GVIPVoucher", szResult, MainPipeline); PlayerInfo[extraid][pGVIPVoucher] = strval(szResult);
  587. cache_get_field_content(row, "GiftVoucher", szResult, MainPipeline); PlayerInfo[extraid][pGiftVoucher] = strval(szResult);
  588. cache_get_field_content(row, "FallIntoFun", szResult, MainPipeline); PlayerInfo[extraid][pFallIntoFun] = strval(szResult);
  589. cache_get_field_content(row, "HungerVoucher", szResult, MainPipeline); PlayerInfo[extraid][pHungerVoucher] = strval(szResult);
  590. cache_get_field_content(row, "BoughtCure", szResult, MainPipeline); PlayerInfo[extraid][pBoughtCure] = strval(szResult);
  591. cache_get_field_content(row, "Vials", szResult, MainPipeline); PlayerInfo[extraid][pVials] = strval(szResult);
  592. cache_get_field_content(row, "AdvertVoucher", szResult, MainPipeline); PlayerInfo[extraid][pAdvertVoucher] = strval(szResult);
  593. cache_get_field_content(row, "ShopCounter", szResult, MainPipeline); PlayerInfo[extraid][pShopCounter] = strval(szResult);
  594. cache_get_field_content(row, "ShopNotice", szResult, MainPipeline); PlayerInfo[extraid][pShopNotice] = strval(szResult);
  595. cache_get_field_content(row, "SVIPExVoucher", szResult, MainPipeline); PlayerInfo[extraid][pSVIPExVoucher] = strval(szResult);
  596. cache_get_field_content(row, "GVIPExVoucher", szResult, MainPipeline); PlayerInfo[extraid][pGVIPExVoucher] = strval(szResult);
  597. cache_get_field_content(row, "VIPSellable", szResult, MainPipeline); PlayerInfo[extraid][pVIPSellable] = strval(szResult);
  598. cache_get_field_content(row, "ReceivedPrize", szResult, MainPipeline); PlayerInfo[extraid][pReceivedPrize] = strval(szResult);
  599.  
  600. GetPartnerName(extraid);
  601. IsEmailPending(extraid, PlayerInfo[extraid][pId], PlayerInfo[extraid][pEmail]);
  602.  
  603. if(PlayerInfo[extraid][pCredits] > 0)
  604. {
  605. new szLog[128];
  606. format(szLog, sizeof(szLog), "[LOGIN] [User: %s(%i)] [IP: %s] [Credits: %s]", GetPlayerNameEx(extraid), PlayerInfo[extraid][pId], GetPlayerIpEx(extraid), number_format(PlayerInfo[extraid][pCredits]));
  607. Log("logs/logincredits.log", szLog), print(szLog);
  608. }
  609.  
  610. g_mysql_LoadPVehicles(extraid);
  611. g_mysql_LoadPlayerToys(extraid);
  612.  
  613. SetPVarInt(extraid, "pSQLID", PlayerInfo[extraid][pId]);
  614.  
  615. //g_mysql_LoadPVehiclePositions(extraid);
  616. OnPlayerLoad(extraid);
  617. break;
  618. }
  619. }
  620. return 1;
  621. }
  622. case SENDDATA_THREAD:
  623. {
  624. if(GetPVarType(extraid, "RestartKick")) {
  625. gPlayerLogged{extraid} = 0;
  626. GameTextForPlayer(extraid, "Scheduled Maintenance...", 5000, 5);
  627. SendClientMessage(extraid, COLOR_LIGHTBLUE, "* The server will be going down for Scheduled Maintenance. A brief period of downtime will follow.");
  628. SendClientMessage(extraid, COLOR_GRAD2, "We will be going down to do some maintenance on the server/script, we will be back online shortly.");
  629. SetTimerEx("KickEx", 1000, 0, "i", extraid);
  630.  
  631. foreach(extraid: Player) if(gPlayerLogged{extraid}) {
  632. SetPVarInt(extraid, "RestartKick", 1);
  633. return OnPlayerStatsUpdate(extraid);
  634. }
  635. ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Account saving finished!", 1);
  636. //g_mysql_DumpAccounts();
  637.  
  638. SetTimer("FinishMaintenance", 1500, false);
  639. }
  640. if(GetPVarType(extraid, "AccountSaving") && (GetPVarInt(extraid, "AccountSaved") == 0)) {
  641. SetPVarInt(extraid, "AccountSaved", 1);
  642. foreach(extraid: Player)
  643. {
  644. if(gPlayerLogged{extraid} && (GetPVarInt(extraid, "AccountSaved") == 0))
  645. {
  646. SetPVarInt(extraid, "AccountSaving", 1);
  647. return OnPlayerStatsUpdate(extraid);
  648. }
  649. }
  650. ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Account saving finished!", 1);
  651. print("Account Saving Complete");
  652. foreach(new i: Player)
  653. {
  654. DeletePVar(i, "AccountSaved");
  655. DeletePVar(i, "AccountSaving");
  656. }
  657. //g_mysql_DumpAccounts();
  658. }
  659. return 1;
  660. }
  661. case AUTH_THREAD:
  662. {
  663. new name[24];
  664. for(new i;i < rows;i++)
  665. {
  666. cache_get_field_content(i, "Username", name, MainPipeline, MAX_PLAYER_NAME);
  667. if(strcmp(name, GetPlayerNameExt(extraid), true) == 0)
  668. {
  669. HideNoticeGUIFrame(extraid);
  670. SafeLogin(extraid, 1);
  671. return 1;
  672. }
  673. else
  674. {
  675. SafeLogin(extraid, 2);
  676. return 1;
  677. }
  678. }
  679. HideNoticeGUIFrame(extraid);
  680. SafeLogin(extraid, 2);
  681. return 1;
  682. }
  683. case LOGIN_THREAD:
  684. {
  685. for(new i;i < rows;i++)
  686. {
  687. new
  688. szPass[129],
  689. szResult[129],
  690. szBuffer[129];
  691.  
  692. cache_get_field_content(i, "Username", szResult, MainPipeline, MAX_PLAYER_NAME);
  693. if(strcmp(szResult, GetPlayerNameExt(extraid), true) != 0)
  694. {
  695. //g_mysql_AccountAuthCheck(extraid);
  696. return 1;
  697. }
  698. cache_get_field_content(i, "Key", szResult, MainPipeline, 129);
  699. GetPVarString(extraid, "PassAuth", szBuffer, sizeof(szBuffer));
  700. WP_Hash(szPass, sizeof(szPass), szBuffer);
  701.  
  702. if((isnull(szPass)) || (isnull(szResult)) || (strcmp(szPass, szResult) != 0)) {
  703. // Invalid Password - Try Again!
  704. ShowMainMenuDialog(extraid, 3);
  705. HideNoticeGUIFrame(extraid);
  706. if(++gPlayerLogTries[extraid] == 2) {
  707. SendClientMessage(extraid, COLOR_RED, "SERVER: Wrong password, you have been kicked out automatically.");
  708. SetTimerEx("KickEx", 1000, 0, "i", extraid);
  709. }
  710. return 1;
  711. }
  712. DeletePVar(extraid, "PassAuth");
  713. break;
  714. }
  715. HideNoticeGUIFrame(extraid);
  716. g_mysql_LoadAccount(extraid);
  717. return 1;
  718. }
  719. case REGISTER_THREAD:
  720. {
  721. if(IsPlayerConnected(extraid))
  722. {
  723. g_mysql_AccountLoginCheck(extraid);
  724. TotalRegister++;
  725. }
  726. }
  727. case LOADPTOYS_THREAD:
  728. {
  729. if(IsPlayerConnected(extraid))
  730. {
  731. new i = 0;
  732. while( i < rows)
  733. {
  734. if(i >= MAX_PLAYERTOYS)
  735. break;
  736.  
  737. new szResult[32];
  738.  
  739. cache_get_field_content(i, "id", szResult, MainPipeline);
  740. PlayerToyInfo[extraid][i][ptID] = strval(szResult);
  741.  
  742. cache_get_field_content(i, "modelid", szResult, MainPipeline);
  743. PlayerToyInfo[extraid][i][ptModelID] = strval(szResult);
  744.  
  745. if(PlayerToyInfo[extraid][i][ptModelID] != 0)
  746. {
  747. cache_get_field_content(i, "bone", szResult, MainPipeline);
  748. PlayerToyInfo[extraid][i][ptBone] = strval(szResult);
  749.  
  750. if(PlayerToyInfo[extraid][i][ptBone] > 18 || PlayerToyInfo[extraid][i][ptBone] < 1) PlayerToyInfo[extraid][i][ptBone] = 1;
  751.  
  752. cache_get_field_content(i, "tradable", szResult, MainPipeline);
  753. PlayerToyInfo[extraid][i][ptTradable] = strval(szResult);
  754.  
  755. cache_get_field_content(i, "posx", szResult, MainPipeline);
  756. PlayerToyInfo[extraid][i][ptPosX] = floatstr(szResult);
  757.  
  758. cache_get_field_content(i, "posy", szResult, MainPipeline);
  759. PlayerToyInfo[extraid][i][ptPosY] = floatstr(szResult);
  760.  
  761. cache_get_field_content(i, "posz", szResult, MainPipeline);
  762. PlayerToyInfo[extraid][i][ptPosZ] = floatstr(szResult);
  763.  
  764. cache_get_field_content(i, "rotx", szResult, MainPipeline);
  765. PlayerToyInfo[extraid][i][ptRotX] = floatstr(szResult);
  766.  
  767. cache_get_field_content(i, "roty", szResult, MainPipeline);
  768. PlayerToyInfo[extraid][i][ptRotY] = floatstr(szResult);
  769.  
  770. cache_get_field_content(i, "rotz", szResult, MainPipeline);
  771. PlayerToyInfo[extraid][i][ptRotZ] = floatstr(szResult);
  772.  
  773. cache_get_field_content(i, "scalex", szResult, MainPipeline);
  774. PlayerToyInfo[extraid][i][ptScaleX] = floatstr(szResult);
  775.  
  776. cache_get_field_content(i, "scaley", szResult, MainPipeline);
  777. PlayerToyInfo[extraid][i][ptScaleY] = floatstr(szResult);
  778.  
  779. cache_get_field_content(i, "scalez", szResult, MainPipeline);
  780. PlayerToyInfo[extraid][i][ptScaleZ] = floatstr(szResult);
  781.  
  782. cache_get_field_content(i, "special", szResult, MainPipeline);
  783. PlayerToyInfo[extraid][i][ptSpecial] = strval(szResult);
  784.  
  785. new szLog[128];
  786. format(szLog, sizeof(szLog), "[TOYSLOAD] [User: %s(%i)] [Toy Model ID: %d] [Toy ID]", GetPlayerNameEx(extraid), PlayerInfo[extraid][pId], PlayerToyInfo[extraid][i][ptModelID], PlayerToyInfo[extraid][i][ptID]);
  787. Log("logs/toydebug.log", szLog);
  788. }
  789. else
  790. {
  791. new szQuery[128];
  792. format(szQuery, sizeof(szQuery), "DELETE FROM `toys` WHERE `id` = '%d'", PlayerToyInfo[extraid][i][ptID]);
  793. mysql_function_query(MainPipeline, szQuery, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  794. printf("Deleting Toy ID %d for Player %s (%i)", PlayerToyInfo[extraid][i][ptID], GetPlayerNameEx(extraid), GetPlayerSQLId(extraid));
  795. }
  796. i++;
  797. }
  798. }
  799. }
  800. case LOADPVEHICLE_THREAD:
  801. {
  802. if(IsPlayerConnected(extraid))
  803. {
  804. new i = 0;
  805. while(i < rows)
  806. {
  807. if(i >= MAX_PLAYERVEHICLES)
  808. break;
  809.  
  810. new szResult[32];
  811.  
  812. cache_get_field_content(i, "pvModelId", szResult, MainPipeline);
  813. PlayerVehicleInfo[extraid][i][pvModelId] = strval(szResult);
  814.  
  815. cache_get_field_content(i, "id", szResult, MainPipeline);
  816. PlayerVehicleInfo[extraid][i][pvSlotId] = strval(szResult);
  817.  
  818. if(PlayerVehicleInfo[extraid][i][pvModelId] != 0)
  819. {
  820. cache_get_field_content(i, "pvPosX", szResult, MainPipeline);
  821. PlayerVehicleInfo[extraid][i][pvPosX] = floatstr(szResult);
  822.  
  823. cache_get_field_content(i, "pvPosY", szResult, MainPipeline);
  824. PlayerVehicleInfo[extraid][i][pvPosY] = floatstr(szResult);
  825.  
  826. cache_get_field_content(i, "pvPosZ", szResult, MainPipeline);
  827. PlayerVehicleInfo[extraid][i][pvPosZ] = floatstr(szResult);
  828.  
  829. cache_get_field_content(i, "pvPosAngle", szResult, MainPipeline);
  830. PlayerVehicleInfo[extraid][i][pvPosAngle] = floatstr(szResult);
  831.  
  832. cache_get_field_content(i, "pvLock", szResult, MainPipeline);
  833. PlayerVehicleInfo[extraid][i][pvLock] = strval(szResult);
  834.  
  835. cache_get_field_content(i, "pvLocked", szResult, MainPipeline);
  836. PlayerVehicleInfo[extraid][i][pvLocked] = strval(szResult);
  837.  
  838. cache_get_field_content(i, "pvPaintJob", szResult, MainPipeline);
  839. PlayerVehicleInfo[extraid][i][pvPaintJob] = strval(szResult);
  840.  
  841. cache_get_field_content(i, "pvColor1", szResult, MainPipeline);
  842. PlayerVehicleInfo[extraid][i][pvColor1] = strval(szResult);
  843.  
  844. cache_get_field_content(i, "pvColor2", szResult, MainPipeline);
  845. PlayerVehicleInfo[extraid][i][pvColor2] = strval(szResult);
  846.  
  847. cache_get_field_content(i, "pvPrice", szResult, MainPipeline);
  848. PlayerVehicleInfo[extraid][i][pvPrice] = strval(szResult);
  849.  
  850. cache_get_field_content(i, "pvTicket", szResult, MainPipeline);
  851. PlayerVehicleInfo[extraid][i][pvTicket] = strval(szResult);
  852.  
  853. cache_get_field_content(i, "pvRestricted", szResult, MainPipeline);
  854. PlayerVehicleInfo[extraid][i][pvRestricted] = strval(szResult);
  855.  
  856. cache_get_field_content(i, "pvWeapon0", szResult, MainPipeline);
  857. PlayerVehicleInfo[extraid][i][pvWeapons][0] = strval(szResult);
  858.  
  859. cache_get_field_content(i, "pvWeapon1", szResult, MainPipeline);
  860. PlayerVehicleInfo[extraid][i][pvWeapons][1] = strval(szResult);
  861.  
  862. cache_get_field_content(i, "pvWeapon2", szResult, MainPipeline);
  863. PlayerVehicleInfo[extraid][i][pvWeapons][2] = strval(szResult);
  864.  
  865. cache_get_field_content(i, "pvWepUpgrade", szResult, MainPipeline);
  866. PlayerVehicleInfo[extraid][i][pvWepUpgrade] = strval(szResult);
  867.  
  868. cache_get_field_content(i, "pvFuel", szResult, MainPipeline);
  869. PlayerVehicleInfo[extraid][i][pvFuel] = floatstr(szResult);
  870.  
  871. cache_get_field_content(i, "pvImpound", szResult, MainPipeline);
  872. PlayerVehicleInfo[extraid][i][pvImpounded] = strval(szResult);
  873.  
  874. cache_get_field_content(i, "pvPlate", szResult, MainPipeline, 32);
  875. format(PlayerVehicleInfo[extraid][i][pvPlate], 32, "%s", szResult, MainPipeline);
  876.  
  877. cache_get_field_content(i, "pvVW", szResult, MainPipeline);
  878. PlayerVehicleInfo[extraid][i][pvVW] = strval(szResult);
  879.  
  880. cache_get_field_content(i, "pvInt", szResult, MainPipeline);
  881. PlayerVehicleInfo[extraid][i][pvInt] = strval(szResult);
  882.  
  883. for(new m = 0; m < MAX_MODS; m++)
  884. {
  885. new szField[15];
  886. format(szField, sizeof(szField), "pvMod%d", m);
  887. cache_get_field_content(i, szField, szResult, MainPipeline);
  888. PlayerVehicleInfo[extraid][i][pvMods][m] = strval(szResult);
  889. }
  890.  
  891. cache_get_field_content(i, "pvCrashFlag", szResult, MainPipeline);
  892. PlayerVehicleInfo[extraid][i][pvCrashFlag] = strval(szResult);
  893.  
  894. cache_get_field_content(i, "pvCrashVW", szResult, MainPipeline);
  895. PlayerVehicleInfo[extraid][i][pvCrashVW] = strval(szResult);
  896.  
  897. cache_get_field_content(i, "pvCrashX", szResult, MainPipeline);
  898. PlayerVehicleInfo[extraid][i][pvCrashX] = floatstr(szResult);
  899.  
  900. cache_get_field_content(i, "pvCrashY", szResult, MainPipeline);
  901. PlayerVehicleInfo[extraid][i][pvCrashY] = floatstr(szResult);
  902.  
  903. cache_get_field_content(i, "pvCrashZ", szResult, MainPipeline);
  904. PlayerVehicleInfo[extraid][i][pvCrashZ] = floatstr(szResult);
  905.  
  906. cache_get_field_content(i, "pvCrashAngle", szResult, MainPipeline);
  907. PlayerVehicleInfo[extraid][i][pvCrashAngle] = floatstr(szResult);
  908.  
  909. new szLog[128];
  910. format(szLog, sizeof(szLog), "[VEHICLELOAD] [User: %s(%i)] [Model: %d] [Vehicle ID: %d]", GetPlayerNameEx(extraid), PlayerInfo[extraid][pId], PlayerVehicleInfo[extraid][i][pvModelId], PlayerVehicleInfo[extraid][i][pvSlotId]);
  911. Log("logs/vehicledebug.log", szLog);
  912. }
  913. else
  914. {
  915. new query[128];
  916. format(query, sizeof(query), "DELETE FROM `vehicles` WHERE `id` = '%d'", PlayerVehicleInfo[extraid][i][pvSlotId]);
  917. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "ii", SENDDATA_THREAD, extraid);
  918. }
  919. i++;
  920. }
  921. }
  922. }
  923. case LOADPVEHPOS_THREAD:
  924. {
  925. if(IsPlayerConnected(extraid))
  926. {
  927. new bool:bVehRestore;
  928. for(new i;i < rows;i++)
  929. {
  930. bVehRestore = true;
  931. for(new v; v < MAX_PLAYERVEHICLES; v++)
  932. {
  933. new szResult[32], szPrefix[32], tmpVehModelId, Float:tmpVehArray[4];
  934.  
  935. format(szPrefix, sizeof(szPrefix), "pv%dModelId", v);
  936. cache_get_field_content(i, szPrefix, szResult, MainPipeline); tmpVehModelId = strval(szResult);
  937. format(szPrefix, sizeof(szPrefix), "pv%dPosX", v);
  938. cache_get_field_content(i, szPrefix, szResult, MainPipeline); tmpVehArray[0] = floatstr(szResult);
  939. format(szPrefix, sizeof(szPrefix), "pv%dPosY", v);
  940. cache_get_field_content(i, szPrefix, szResult, MainPipeline); tmpVehArray[1] = floatstr(szResult);
  941. format(szPrefix, sizeof(szPrefix), "pv%dPosZ", v);
  942. cache_get_field_content(i, szPrefix, szResult, MainPipeline); tmpVehArray[2] = floatstr(szResult);
  943. format(szPrefix, sizeof(szPrefix), "pv%dPosAngle", v);
  944. cache_get_field_content(i, szPrefix, szResult, MainPipeline); tmpVehArray[3] = floatstr(szResult);
  945.  
  946. if(tmpVehModelId >= 400)
  947. {
  948. printf("Stored %d Vehicle Slot", v);
  949.  
  950. format(szPrefix, sizeof(szPrefix), "tmpVeh%dModelId", v);
  951. SetPVarInt(extraid, szPrefix, tmpVehModelId);
  952.  
  953. format(szPrefix, sizeof(szPrefix), "tmpVeh%dPosX", v);
  954. SetPVarFloat(extraid, szPrefix, tmpVehArray[0]);
  955.  
  956. format(szPrefix, sizeof(szPrefix), "tmpVeh%dPosY", v);
  957. SetPVarFloat(extraid, szPrefix, tmpVehArray[1]);
  958.  
  959. format(szPrefix, sizeof(szPrefix), "tmpVeh%dPosZ", v);
  960. SetPVarFloat(extraid, szPrefix, tmpVehArray[2]);
  961.  
  962. format(szPrefix, sizeof(szPrefix), "tmpVeh%dAngle", v);
  963. SetPVarFloat(extraid, szPrefix, tmpVehArray[3]);
  964. }
  965. }
  966. break;
  967. }
  968.  
  969. if(bVehRestore == true) {
  970. // person Vehicle Position Restore Granted, Now Purge them from the Table.
  971. new query[128];
  972. format(query, sizeof(query), "DELETE FROM `pvehpositions` WHERE `id`='%d'", PlayerInfo[extraid][pId]);
  973. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "ii", SENDDATA_THREAD, extraid);
  974. }
  975.  
  976. OnPlayerLoad(extraid);
  977. }
  978. }
  979. case IPBAN_THREAD:
  980. {
  981. if(rows > 0)
  982. {
  983. SendClientMessage(extraid, COLOR_RED, "Your IP is banned! You may appeal on the forums.");
  984. SetTimerEx("KickEx", 1000, 0, "i", extraid);
  985. }
  986. else
  987. {
  988. g_mysql_AccountAuthCheck(extraid);
  989. }
  990. }
  991. case LOADCRATE_THREAD:
  992. {
  993. for(new i; i < rows; i++)
  994. {
  995. new crateid, szResult[32], string[128];
  996. cache_get_field_content(i, "id", szResult, MainPipeline); crateid = strval(szResult);
  997. if(crateid < MAX_CRATES)
  998. {
  999. cache_get_field_content(i, "Active", szResult, MainPipeline); CrateInfo[crateid][crActive] = strval(szResult);
  1000. cache_get_field_content(i, "CrateX", szResult, MainPipeline); CrateInfo[crateid][crX] = floatstr(szResult);
  1001. cache_get_field_content(i, "CrateY", szResult, MainPipeline); CrateInfo[crateid][crY] = floatstr(szResult);
  1002. cache_get_field_content(i, "CrateZ", szResult, MainPipeline); CrateInfo[crateid][crZ] = floatstr(szResult);
  1003. cache_get_field_content(i, "Int", szResult, MainPipeline); CrateInfo[crateid][crInt] = strval(szResult);
  1004. cache_get_field_content(i, "VW", szResult, MainPipeline); CrateInfo[crateid][crVW] = strval(szResult);
  1005. cache_get_field_content(i, "PlacedBy", szResult, MainPipeline); format(CrateInfo[crateid][crPlacedBy], MAX_PLAYER_NAME, szResult);
  1006. cache_get_field_content(i, "GunQuantity", szResult, MainPipeline); CrateInfo[crateid][GunQuantity] = strval(szResult);
  1007. cache_get_field_content(i, "InVehicle", szResult, MainPipeline); CrateInfo[crateid][InVehicle] = strval(szResult);
  1008. if(CrateInfo[crateid][InVehicle] != INVALID_VEHICLE_ID)
  1009. {
  1010. CrateInfo[crateid][crActive] = 0;
  1011. CrateInfo[crateid][InVehicle] = INVALID_VEHICLE_ID;
  1012. }
  1013. if(CrateInfo[crateid][crActive])
  1014. {
  1015. CrateInfo[crateid][InVehicle] = INVALID_VEHICLE_ID;
  1016. CrateInfo[crateid][crObject] = CreateDynamicObject(964,CrateInfo[crateid][crX],CrateInfo[crateid][crY],CrateInfo[crateid][crZ],0.00000000,0.00000000,0.00000000,CrateInfo[i][crVW], CrateInfo[i][crInt]);
  1017. format(string, sizeof(string), "Serial Number: #%d\n High Grade Materials: %d/50\n (( Dropped by: %s ))", i, CrateInfo[crateid][GunQuantity], CrateInfo[crateid][crPlacedBy]);
  1018. CrateInfo[crateid][crLabel] = CreateDynamic3DTextLabel(string, COLOR_ORANGE, CrateInfo[crateid][crX],CrateInfo[crateid][crY],CrateInfo[crateid][crZ]+1, 10.0, _, _, 1, CrateInfo[crateid][crVW], CrateInfo[crateid][crInt], _, 20.0);
  1019.  
  1020. }
  1021. }
  1022. }
  1023. print("[LoadCrates] Loading Crates Finished");
  1024. }
  1025. case MAIN_REFERRAL_THREAD:
  1026. {
  1027. new newrows, newfields, szString[128], szQuery[128];
  1028. cache_get_data(newrows, newfields, MainPipeline);
  1029.  
  1030. if(newrows == 0)
  1031. {
  1032. format(szString, sizeof(szString), "Nobody");
  1033. strmid(PlayerInfo[extraid][pReferredBy], szString, 0, strlen(szString), MAX_PLAYER_NAME);
  1034. ShowPlayerDialog(extraid, REGISTERREF, DIALOG_STYLE_INPUT, "{FF0000}Error - Invalid Player", "There is no player registered to our server with such name.\nPlease enter the full name of the player who referred you.\nExample: FirstName_LastName", "Enter", "Cancel");
  1035. }
  1036. else {
  1037. format(szQuery, sizeof(szQuery), "SELECT `IP` FROM `accounts` WHERE `Username` = '%s'", PlayerInfo[extraid][pReferredBy]);
  1038. mysql_function_query(MainPipeline, szQuery, true, "ReferralSecurity", "i", extraid);
  1039. }
  1040. }
  1041. case REWARD_REFERRAL_THREAD:
  1042. {
  1043. new newrows, newfields;
  1044. cache_get_data(newrows, newfields, MainPipeline);
  1045.  
  1046. if(newrows != 0)
  1047. {
  1048. SendClientMessageEx(extraid, COLOR_YELLOW, "The player who referred you does not have a account on our server anymore, therefore he has not received any credits");
  1049. }
  1050. }
  1051. case OFFLINE_FAMED_THREAD:
  1052. {
  1053. new newrows, newfields, szQuery[128], string[128], szName[MAX_PLAYER_NAME];
  1054. cache_get_data(newrows, newfields, MainPipeline);
  1055.  
  1056. if(newrows == 0)
  1057. {
  1058. SendClientMessageEx(extraid, COLOR_RED, "Error - This account does not exist.");
  1059. }
  1060. else {
  1061. new
  1062. ilevel = GetPVarInt(extraid, "Offline_Famed");
  1063.  
  1064. GetPVarString(extraid, "Offline_Name", szName, MAX_PLAYER_NAME);
  1065.  
  1066. format(szQuery, sizeof(szQuery), "UPDATE `accounts` SET `Famed` = %d WHERE `Username` = '%s'", ilevel, szName);
  1067. mysql_function_query(MainPipeline, szQuery, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  1068.  
  1069. format(string, sizeof(string), "AdmCmd: %s has offline set %s to a level %d famed", GetPlayerNameEx(extraid), szName, ilevel);
  1070. SendFamedMessage(COLOR_LIGHTRED, string);
  1071. ABroadCast(COLOR_LIGHTRED, string, 2);
  1072. Log("logs/setfamed.log", string);
  1073. DeletePVar(extraid, "Offline_Famed");
  1074. DeletePVar(extraid, "Offline_Name");
  1075. }
  1076. }
  1077. case BUG_LIST_THREAD:
  1078. {
  1079. if(rows == 0) return 1;
  1080. new szResult[MAX_PLAYER_NAME];
  1081. for(new i; i < rows; i++)
  1082. {
  1083. cache_get_field_content(i, "Username", szResult, MainPipeline); SendClientMessageEx(extraid, COLOR_GRAD2, szResult);
  1084. }
  1085. }
  1086. case ADMINWHITELIST_THREAD:
  1087. {
  1088. new string[128];
  1089. for(new i;i < rows;i++)
  1090. {
  1091. new secureip[16], szResult[32], alevel;
  1092. cache_get_field_content(i, "AdminLevel", szResult, MainPipeline); alevel = strval(szResult);
  1093. cache_get_field_content(i, "SecureIP", secureip, MainPipeline, 16);
  1094.  
  1095. if(alevel > 1 && !fexist("NoWhitelist.h")) // Beta server check ( beta server does not require whitelisting)
  1096. {
  1097. if(isnull(secureip) || strcmp(GetPlayerIpEx(extraid), secureip, false, strlen(secureip)) != 0)
  1098. {
  1099. if(strcmp(GetPlayerIpEx(extraid), "127.0.0.1", false, 16) != 0)
  1100. {
  1101. SendClientMessage(extraid, COLOR_WHITE, "SERVER: Your IP does not match the whitelisted IP of that account. Contact a Senior+ Admin to whitelist your current IP.");
  1102. format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s has been logging in with a non-whitelisted IP.", GetPlayerNameEx(extraid));
  1103. ABroadCast(COLOR_YELLOW, string, 2);
  1104. // SetTimerEx("KickEx", 2000, 0, "i", extraid);
  1105. return true;
  1106. }
  1107. }
  1108. }
  1109. }
  1110. return true;
  1111. }
  1112. case LOADGIFTBOX_THREAD:
  1113. {
  1114. for(new i; i < rows; i++)
  1115. {
  1116. new szResult[32], arraystring[128];
  1117. for(new array = 0; array < 4; array++)
  1118. {
  1119. format(arraystring, sizeof(arraystring), "dgMoney%d", array);
  1120. cache_get_field_content(i, arraystring, szResult, MainPipeline); dgMoney[array] = strval(szResult);
  1121. format(arraystring, sizeof(arraystring), "dgRimKit%d", array);
  1122. cache_get_field_content(i, arraystring, szResult, MainPipeline); dgRimKit[array] = strval(szResult);
  1123. format(arraystring, sizeof(arraystring), "dgFirework%d", array);
  1124. cache_get_field_content(i, arraystring, szResult, MainPipeline); dgFirework[array] = strval(szResult);
  1125. format(arraystring, sizeof(arraystring), "dgGVIP%d", array);
  1126. cache_get_field_content(i, arraystring, szResult, MainPipeline); dgGVIP[array] = strval(szResult);
  1127. format(arraystring, sizeof(arraystring), "dgSVIP%d", array);
  1128. cache_get_field_content(i, arraystring, szResult, MainPipeline); dgSVIP[array] = strval(szResult);
  1129. format(arraystring, sizeof(arraystring), "dgGVIPEx%d", array);
  1130. cache_get_field_content(i, arraystring, szResult, MainPipeline); dgGVIPEx[array] = strval(szResult);
  1131. format(arraystring, sizeof(arraystring), "dgSVIPEx%d", array);
  1132. cache_get_field_content(i, arraystring, szResult, MainPipeline); dgSVIPEx[array] = strval(szResult);
  1133. format(arraystring, sizeof(arraystring), "dgCarSlot%d", array);
  1134. cache_get_field_content(i, arraystring, szResult, MainPipeline); dgCarSlot[array] = strval(szResult);
  1135. format(arraystring, sizeof(arraystring), "dgToySlot%d", array);
  1136. cache_get_field_content(i, arraystring, szResult, MainPipeline); dgToySlot[array] = strval(szResult);
  1137. format(arraystring, sizeof(arraystring), "dgArmor%d", array);
  1138. cache_get_field_content(i, arraystring, szResult, MainPipeline); dgArmor[array] = strval(szResult);
  1139. format(arraystring, sizeof(arraystring), "dgFirstaid%d", array);
  1140. cache_get_field_content(i, arraystring, szResult, MainPipeline); dgFirstaid[array] = strval(szResult);
  1141. format(arraystring, sizeof(arraystring), "dgDDFlag%d", array);
  1142. cache_get_field_content(i, arraystring, szResult, MainPipeline); dgDDFlag[array] = strval(szResult);
  1143. format(arraystring, sizeof(arraystring), "dgGateFlage%d", array);
  1144. cache_get_field_content(i, arraystring, szResult, MainPipeline); dgGateFlag[array] = strval(szResult);
  1145. format(arraystring, sizeof(arraystring), "dgCredits%d", array);
  1146. cache_get_field_content(i, arraystring, szResult, MainPipeline); dgCredits[array] = strval(szResult);
  1147. format(arraystring, sizeof(arraystring), "dgPriorityAd%d", array);
  1148. cache_get_field_content(i, arraystring, szResult, MainPipeline); dgPriorityAd[array] = strval(szResult);
  1149. format(arraystring, sizeof(arraystring), "dgHealthNArmor%d", array);
  1150. cache_get_field_content(i, arraystring, szResult, MainPipeline); dgHealthNArmor[array] = strval(szResult);
  1151. format(arraystring, sizeof(arraystring), "dgGiftReset%d", array);
  1152. cache_get_field_content(i, arraystring, szResult, MainPipeline); dgGiftReset[array] = strval(szResult);
  1153. format(arraystring, sizeof(arraystring), "dgMaterial%d", array);
  1154. cache_get_field_content(i, arraystring, szResult, MainPipeline); dgMaterial[array] = strval(szResult);
  1155. format(arraystring, sizeof(arraystring), "dgWarning%d", array);
  1156. cache_get_field_content(i, arraystring, szResult, MainPipeline); dgWarning[array] = strval(szResult);
  1157. format(arraystring, sizeof(arraystring), "dgPot%d", array);
  1158. cache_get_field_content(i, arraystring, szResult, MainPipeline); dgPot[array] = strval(szResult);
  1159. format(arraystring, sizeof(arraystring), "dgCrack%d", array);
  1160. cache_get_field_content(i, arraystring, szResult, MainPipeline); dgCrack[array] = strval(szResult);
  1161. format(arraystring, sizeof(arraystring), "dgPaintballToken%d", array);
  1162. cache_get_field_content(i, arraystring, szResult, MainPipeline); dgPaintballToken[array] = strval(szResult);
  1163. format(arraystring, sizeof(arraystring), "dgVIPToken%d", array);
  1164. cache_get_field_content(i, arraystring, szResult, MainPipeline); dgVIPToken[array] = strval(szResult);
  1165. format(arraystring, sizeof(arraystring), "dgRespectPoint%d", array);
  1166. cache_get_field_content(i, arraystring, szResult, MainPipeline); dgRespectPoint[array] = strval(szResult);
  1167. format(arraystring, sizeof(arraystring), "dgCarVoucher%d", array);
  1168. cache_get_field_content(i, arraystring, szResult, MainPipeline); dgCarVoucher[array] = strval(szResult);
  1169. format(arraystring, sizeof(arraystring), "dgBuddyInvite%d", array);
  1170. cache_get_field_content(i, arraystring, szResult, MainPipeline); dgBuddyInvite[array] = strval(szResult);
  1171. format(arraystring, sizeof(arraystring), "dgLaser%d", array);
  1172. cache_get_field_content(i, arraystring, szResult, MainPipeline); dgLaser[array] = strval(szResult);
  1173. format(arraystring, sizeof(arraystring), "dgCustomToy%d", array);
  1174. cache_get_field_content(i, arraystring, szResult, MainPipeline); dgCustomToy[array] = strval(szResult);
  1175. format(arraystring, sizeof(arraystring), "dgAdmuteReset%d", array);
  1176. cache_get_field_content(i, arraystring, szResult, MainPipeline); dgAdmuteReset[array] = strval(szResult);
  1177. format(arraystring, sizeof(arraystring), "dgNewbieMuteReset%d", array);
  1178. cache_get_field_content(i, arraystring, szResult, MainPipeline); dgNewbieMuteReset[array] = strval(szResult);
  1179. format(arraystring, sizeof(arraystring), "dgRestrictedCarVoucher%d", array);
  1180. cache_get_field_content(i, arraystring, szResult, MainPipeline); dgRestrictedCarVoucher[array] = strval(szResult);
  1181. format(arraystring, sizeof(arraystring), "dgPlatinumVIPVoucher%d", array);
  1182. cache_get_field_content(i, arraystring, szResult, MainPipeline); dgPlatinumVIPVoucher[array] = strval(szResult);
  1183. }
  1184. break;
  1185. }
  1186. print("[Dynamic Giftbox] Successfully loaded the dynamic giftbox.");
  1187. }
  1188. case LOADCP_STORE:
  1189. {
  1190. if(IsPlayerConnected(extraid))
  1191. {
  1192. new szResult[32];
  1193. for(new i; i < rows; i++)
  1194. {
  1195. cache_get_field_content(i, "User_Id", szResult, MainPipeline);
  1196.  
  1197. if(rows > 0)
  1198. {
  1199. cache_get_field_content(i, "id", szResult, MainPipeline); CpStore[extraid][cId] = strval(szResult);
  1200. cache_get_field_content(i, "XP", szResult, MainPipeline); CpStore[extraid][cXP] = strval(szResult);
  1201. // now lets process the data below to give to the player.
  1202. ClaimShopItems(extraid);
  1203. }
  1204. }
  1205. if(rows == 0)
  1206. {
  1207. SendClientMessageEx(extraid, COLOR_RED, "You have no items pending from the user control panel.");
  1208. }
  1209. }
  1210. return 1;
  1211. }
  1212. }
  1213. return 1;
  1214. }
  1215.  
  1216. public OnQueryError(errorid, error[], callback[], query[], connectionHandle)
  1217. {
  1218. printf("[MySQL] Query Error - (ErrorID: %d) (Handle: %d)", errorid, connectionHandle);
  1219. print("[MySQL] Check mysql_log.txt to review the query that threw the error.");
  1220. SQL_Log(query, error);
  1221.  
  1222. if(errorid == 2013 || errorid == 2014 || errorid == 2006 || errorid == 2027 || errorid == 2055)
  1223. {
  1224. print("[MySQL] Connection Error Detected in Threaded Query");
  1225. //mysql_query(query, resultid, extraid, MainPipeline);
  1226. }
  1227. }
  1228.  
  1229. //--------------------------------[ CUSTOM STOCK FUNCTIONS ]---------------------------
  1230.  
  1231. // g_mysql_Check_Store(playerid)
  1232. // Description: Checks if the player has any pending items from the ucp.
  1233. stock g_mysql_Check_Store(playerid)
  1234. {
  1235. new string[128];
  1236. format(string, sizeof(string), "SELECT * FROM `cp_store` WHERE `User_Id` = %d", GetPlayerSQLId(playerid));
  1237. mysql_function_query(MainPipeline, string, true, "OnQueryFinish", "iii", LOADCP_STORE, playerid, g_arrQueryHandle{playerid});
  1238. return 1;
  1239. }
  1240.  
  1241. // g_mysql_ReturnEscaped(string unEscapedString)
  1242. // Description: Takes a unescaped string and returns an escaped one.
  1243. stock g_mysql_ReturnEscaped(unEscapedString[], connectionHandle)
  1244. {
  1245. new EscapedString[256];
  1246. mysql_real_escape_string(unEscapedString, EscapedString, connectionHandle);
  1247. return EscapedString;
  1248. }
  1249.  
  1250. // g_mysql_AccountLoginCheck(playerid)
  1251. stock g_mysql_AccountLoginCheck(playerid)
  1252. {
  1253. ShowNoticeGUIFrame(playerid, 2);
  1254.  
  1255. new string[128];
  1256.  
  1257. format(string, sizeof(string), "SELECT `Username`, `Key` FROM `accounts` WHERE `Username` = '%s'", GetPlayerNameExt(playerid));
  1258. mysql_function_query(MainPipeline, string, true, "OnQueryFinish", "iii", LOGIN_THREAD, playerid, g_arrQueryHandle{playerid});
  1259. return 1;
  1260. }
  1261.  
  1262. // g_mysql_AccountAuthCheck(playerid)
  1263. stock g_mysql_AccountAuthCheck(playerid)
  1264. {
  1265. new string[128];
  1266.  
  1267. format(string, sizeof(string), "SELECT `Username` FROM `accounts` WHERE `Username` = '%s'", GetPlayerNameExt(playerid));
  1268. mysql_function_query(MainPipeline, string, true, "OnQueryFinish", "iii", AUTH_THREAD, playerid, g_arrQueryHandle{playerid});
  1269.  
  1270. // Reset the GUI
  1271. SetPlayerJoinCamera(playerid);
  1272. ClearChatbox(playerid);
  1273. SetPlayerVirtualWorld(playerid, 0);
  1274.  
  1275.  
  1276. return 1;
  1277. }
  1278.  
  1279. // g_mysql_AccountOnline(int playerid, int stateid)
  1280. stock g_mysql_AccountOnline(playerid, stateid)
  1281. {
  1282. new string[128];
  1283. format(string, sizeof(string), "UPDATE `accounts` SET `Online`=%d, `LastLogin` = NOW() WHERE `id` = %d", stateid, GetPlayerSQLId(playerid));
  1284. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "ii", SENDDATA_THREAD, playerid);
  1285. return 1;
  1286. }
  1287.  
  1288. stock g_mysql_AccountOnlineReset()
  1289. {
  1290. new string[128];
  1291. format(string, sizeof(string), "UPDATE `accounts` SET `Online` = 0 WHERE `Online` = %d", servernumber);
  1292. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  1293. return 1;
  1294. }
  1295.  
  1296. // g_mysql_CreateAccount(int playerid, string accountPassword[])
  1297. // Description: Creates a new account in the database.
  1298. stock g_mysql_CreateAccount(playerid, accountPassword[])
  1299. {
  1300. new string[256];
  1301. new passbuffer[129];
  1302. WP_Hash(passbuffer, sizeof(passbuffer), accountPassword);
  1303.  
  1304. format(string, sizeof(string), "INSERT INTO `accounts` (`RegiDate`, `LastLogin`, `Username`, `Key`) VALUES (NOW(), NOW(), '%s','%s')", GetPlayerNameExt(playerid), passbuffer);
  1305. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "iii", REGISTER_THREAD, playerid, g_arrQueryHandle{playerid});
  1306. return 1;
  1307. }
  1308.  
  1309. stock g_mysql_LoadPVehicles(playerid)
  1310. {
  1311. new string[128];
  1312. format(string, sizeof(string), "SELECT * FROM `vehicles` WHERE `sqlID` = %d", PlayerInfo[playerid][pId]);
  1313. mysql_function_query(MainPipeline, string, true, "OnQueryFinish", "iii", LOADPVEHICLE_THREAD, playerid, g_arrQueryHandle{playerid});
  1314. return 1;
  1315. }
  1316.  
  1317. // g_mysql_LoadPVehiclePositions(playerid)
  1318. // Description: Loads vehicle positions if person has timed out.
  1319. stock g_mysql_LoadPVehiclePositions(playerid)
  1320. {
  1321. new string[128];
  1322.  
  1323. format(string, sizeof(string), "SELECT * FROM `pvehpositions` WHERE `id` = %d", PlayerInfo[playerid][pId]);
  1324. mysql_function_query(MainPipeline, string, true, "OnQueryFinish", "iii", LOADPVEHPOS_THREAD, playerid, g_arrQueryHandle{playerid});
  1325. return 1;
  1326. }
  1327.  
  1328. // g_mysql_LoadPlayerToys(playerid)
  1329. // Description: Load the player toys
  1330. stock g_mysql_LoadPlayerToys(playerid)
  1331. {
  1332. new szQuery[128];
  1333. format(szQuery, sizeof(szQuery), "SELECT * FROM `toys` WHERE `player` = %d", PlayerInfo[playerid][pId]);
  1334. mysql_function_query(MainPipeline, szQuery, true, "OnQueryFinish", "iii", LOADPTOYS_THREAD, playerid, g_arrQueryHandle{playerid});
  1335. return 1;
  1336. }
  1337.  
  1338. // g_mysql_LoadAccount(playerid)
  1339. // Description: Loads an account from database into memory.
  1340. stock g_mysql_LoadAccount(playerid)
  1341. {
  1342. ShowNoticeGUIFrame(playerid, 3);
  1343.  
  1344. new string[164];
  1345. format(string, sizeof(string), "SELECT * FROM `accounts` WHERE `Username` = '%s'", GetPlayerNameExt(playerid));
  1346. mysql_function_query(MainPipeline, string, true, "OnQueryFinish", "iii", LOADUSERDATA_THREAD, playerid, g_arrQueryHandle{playerid});
  1347. return 1;
  1348. }
  1349.  
  1350. // g_mysql_RemoveDumpFile(sqlid)
  1351. // Description: Removes a account's dump file. Helpful upon logoff.
  1352. stock g_mysql_RemoveDumpFile(sqlid)
  1353. {
  1354. new pwnfile[128];
  1355. format(pwnfile, sizeof(pwnfile), "/accdump/%d.dump", sqlid);
  1356.  
  1357. if(fexist(pwnfile))
  1358. {
  1359. fremove(pwnfile);
  1360. return 1;
  1361. }
  1362. return 0;
  1363. }
  1364.  
  1365. GivePlayerCredits(Player, Amount, Shop)
  1366. {
  1367. new szQuery[128];
  1368. PlayerInfo[Player][pCredits] += Amount;
  1369.  
  1370. format(szQuery, sizeof(szQuery), "UPDATE `accounts` SET `Credits`=%d WHERE `id` = %d", PlayerInfo[Player][pCredits], GetPlayerSQLId(Player));
  1371. mysql_function_query(MainPipeline, szQuery, false, "OnQueryFinish", "ii", SENDDATA_THREAD, Player);
  1372. print(szQuery);
  1373.  
  1374. if(Shop == 1)
  1375. {
  1376. if(Amount < 0) Amount = Amount*-1;
  1377. PlayerInfo[Player][pTotalCredits] += Amount;
  1378. }
  1379.  
  1380. format(szQuery, sizeof(szQuery), "UPDATE `accounts` SET `TotalCredits`=%d WHERE `id` = %d", PlayerInfo[Player][pTotalCredits], GetPlayerSQLId(Player));
  1381. mysql_function_query(MainPipeline, szQuery, false, "OnQueryFinish", "ii", SENDDATA_THREAD, Player);
  1382. print(szQuery);
  1383. }
  1384.  
  1385. // g_mysql_SaveVehicle(int playerid, int slotid)
  1386. // Description: Saves a account's specified vehicle slot.
  1387. stock g_mysql_SaveVehicle(playerid, slotid)
  1388. {
  1389. new query[2048];
  1390. printf("%s (%i) saving their %d (slot %i) (Model %i)...", GetPlayerNameEx(playerid), playerid, PlayerVehicleInfo[playerid][slotid][pvModelId], slotid, PlayerVehicleInfo[playerid][slotid][pvModelId]);
  1391.  
  1392. format(query, sizeof(query), "UPDATE `vehicles` SET");
  1393. format(query, sizeof(query), "%s `pvPosX` = %0.5f,", query, PlayerVehicleInfo[playerid][slotid][pvPosX]);
  1394. format(query, sizeof(query), "%s `pvPosY` = %0.5f,", query, PlayerVehicleInfo[playerid][slotid][pvPosY]);
  1395. format(query, sizeof(query), "%s `pvPosZ` = %0.5f,", query, PlayerVehicleInfo[playerid][slotid][pvPosZ]);
  1396. format(query, sizeof(query), "%s `pvPosAngle` = %0.5f,", query, PlayerVehicleInfo[playerid][slotid][pvPosAngle]);
  1397. format(query, sizeof(query), "%s `pvLock` = %d,", query, PlayerVehicleInfo[playerid][slotid][pvLock]);
  1398. format(query, sizeof(query), "%s `pvLocked` = %d,", query, PlayerVehicleInfo[playerid][slotid][pvLocked]);
  1399. format(query, sizeof(query), "%s `pvPaintJob` = %d,", query, PlayerVehicleInfo[playerid][slotid][pvPaintJob]);
  1400. format(query, sizeof(query), "%s `pvColor1` = %d,", query, PlayerVehicleInfo[playerid][slotid][pvColor1]);
  1401. format(query, sizeof(query), "%s `pvColor2` = %d,", query, PlayerVehicleInfo[playerid][slotid][pvColor2]);
  1402. format(query, sizeof(query), "%s `pvPrice` = %d,", query, PlayerVehicleInfo[playerid][slotid][pvPrice]);
  1403. format(query, sizeof(query), "%s `pvWeapon0` = %d,", query, PlayerVehicleInfo[playerid][slotid][pvWeapons][0]);
  1404. format(query, sizeof(query), "%s `pvWeapon1` = %d,", query, PlayerVehicleInfo[playerid][slotid][pvWeapons][1]);
  1405. format(query, sizeof(query), "%s `pvWeapon2` = %d,", query, PlayerVehicleInfo[playerid][slotid][pvWeapons][2]);
  1406. format(query, sizeof(query), "%s `pvLock` = %d,", query, PlayerVehicleInfo[playerid][slotid][pvLock]);
  1407. format(query, sizeof(query), "%s `pvWepUpgrade` = %d,", query, PlayerVehicleInfo[playerid][slotid][pvWepUpgrade]);
  1408. format(query, sizeof(query), "%s `pvFuel` = %0.5f,", query, PlayerVehicleInfo[playerid][slotid][pvFuel]);
  1409. format(query, sizeof(query), "%s `pvImpound` = %d,", query, PlayerVehicleInfo[playerid][slotid][pvImpounded]);
  1410. format(query, sizeof(query), "%s `pvDisabled` = %d,", query, PlayerVehicleInfo[playerid][slotid][pvDisabled]);
  1411. format(query, sizeof(query), "%s `pvPlate` = '%s',", query, g_mysql_ReturnEscaped(PlayerVehicleInfo[playerid][slotid][pvPlate], MainPipeline));
  1412. format(query, sizeof(query), "%s `pvTicket` = %d,", query, PlayerVehicleInfo[playerid][slotid][pvTicket]);
  1413. format(query, sizeof(query), "%s `pvRestricted` = %d,", query, PlayerVehicleInfo[playerid][slotid][pvRestricted]);
  1414. format(query, sizeof(query), "%s `pvVW` = %d,", query, PlayerVehicleInfo[playerid][slotid][pvVW]);
  1415. format(query, sizeof(query), "%s `pvInt` = %d,", query, PlayerVehicleInfo[playerid][slotid][pvInt]);
  1416. format(query, sizeof(query), "%s `pvCrashFlag` = %d,", query, PlayerVehicleInfo[playerid][slotid][pvCrashFlag]);
  1417. format(query, sizeof(query), "%s `pvCrashVW` = %d,", query, PlayerVehicleInfo[playerid][slotid][pvCrashVW]);
  1418. format(query, sizeof(query), "%s `pvCrashX` = %0.5f,", query, PlayerVehicleInfo[playerid][slotid][pvCrashX]);
  1419. format(query, sizeof(query), "%s `pvCrashY` = %0.5f,", query, PlayerVehicleInfo[playerid][slotid][pvCrashY]);
  1420. format(query, sizeof(query), "%s `pvCrashZ` = %0.5f,", query, PlayerVehicleInfo[playerid][slotid][pvCrashZ]);
  1421. format(query, sizeof(query), "%s `pvCrashAngle` = %0.5f,", query, PlayerVehicleInfo[playerid][slotid][pvCrashAngle]);
  1422.  
  1423. for(new m = 0; m < MAX_MODS; m++)
  1424. {
  1425. if(m == MAX_MODS-1)
  1426. {
  1427. format(query, sizeof(query), "%s `pvMod%d` = %d WHERE `id` = '%d'", query, m, PlayerVehicleInfo[playerid][slotid][pvMods][m], PlayerVehicleInfo[playerid][slotid][pvSlotId]);
  1428. }
  1429. else
  1430. {
  1431. format(query, sizeof(query), "%s `pvMod%d` = %d,", query, m, PlayerVehicleInfo[playerid][slotid][pvMods][m]);
  1432. }
  1433. }
  1434. //print(query);
  1435.  
  1436. new szLog[128];
  1437. format(szLog, sizeof(szLog), "[VEHICLESAVE] [User: %s(%i)] [Model: %d] [Vehicle ID: %d]", GetPlayerNameEx(playerid), PlayerInfo[playerid][pId], PlayerVehicleInfo[playerid][slotid][pvModelId], PlayerVehicleInfo[playerid][slotid][pvSlotId]);
  1438. Log("logs/vehicledebug.log", szLog);
  1439.  
  1440. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "ii", SENDDATA_THREAD, playerid);
  1441. }
  1442.  
  1443. // native g_mysql_SaveToys(int playerid, int slotid)
  1444. stock g_mysql_SaveToys(playerid, slotid)
  1445. {
  1446. new szQuery[2048];
  1447.  
  1448. if(PlayerToyInfo[playerid][slotid][ptID] >= 1) // Making sure the player actually has a toy so we won't save a empty row
  1449. {
  1450. //printf("%s (%i) saving toy %i...", GetPlayerNameEx(playerid), playerid, slotid);
  1451.  
  1452. format(szQuery, sizeof(szQuery), "UPDATE `toys` SET `modelid` = '%d', `bone` = '%d', `posx` = '%f', `posy` = '%f', `posz` = '%f', `rotx` = '%f', `roty` = '%f', `rotz` = '%f', `scalex` = '%f', `scaley` = '%f', `scalez` = '%f', `tradable` = '%d' WHERE `id` = '%d'",
  1453. PlayerToyInfo[playerid][slotid][ptModelID],
  1454. PlayerToyInfo[playerid][slotid][ptBone],
  1455. PlayerToyInfo[playerid][slotid][ptPosX],
  1456. PlayerToyInfo[playerid][slotid][ptPosY],
  1457. PlayerToyInfo[playerid][slotid][ptPosZ],
  1458. PlayerToyInfo[playerid][slotid][ptRotX],
  1459. PlayerToyInfo[playerid][slotid][ptRotY],
  1460. PlayerToyInfo[playerid][slotid][ptRotZ],
  1461. PlayerToyInfo[playerid][slotid][ptScaleX],
  1462. PlayerToyInfo[playerid][slotid][ptScaleY],
  1463. PlayerToyInfo[playerid][slotid][ptScaleZ],
  1464. PlayerToyInfo[playerid][slotid][ptTradable],
  1465. PlayerToyInfo[playerid][slotid][ptID]);
  1466.  
  1467. mysql_function_query(MainPipeline, szQuery, false, "OnQueryFinish", "ii", SENDDATA_THREAD, playerid);
  1468. }
  1469. }
  1470.  
  1471. // native g_mysql_NewToy(int playerid, int slotid)
  1472. stock g_mysql_NewToy(playerid, slotid)
  1473. {
  1474. new szQuery[2048];
  1475. if(PlayerToyInfo[playerid][slotid][ptSpecial] != 1) { PlayerToyInfo[playerid][slotid][ptSpecial] = 0; }
  1476.  
  1477. format(szQuery, sizeof(szQuery), "INSERT INTO `toys` (player, modelid, bone, posx, posy, posz, rotx, roty, rotz, scalex, scaley, scalez, tradable, special) VALUES ('%d', '%d', '%d', '%f', '%f', '%f', '%f', '%f', '%f', '%f', '%f', '%f', '%d', '%d')",
  1478. PlayerInfo[playerid][pId],
  1479. PlayerToyInfo[playerid][slotid][ptModelID],
  1480. PlayerToyInfo[playerid][slotid][ptBone],
  1481. PlayerToyInfo[playerid][slotid][ptPosX],
  1482. PlayerToyInfo[playerid][slotid][ptPosY],
  1483. PlayerToyInfo[playerid][slotid][ptPosZ],
  1484. PlayerToyInfo[playerid][slotid][ptRotX],
  1485. PlayerToyInfo[playerid][slotid][ptRotY],
  1486. PlayerToyInfo[playerid][slotid][ptRotZ],
  1487. PlayerToyInfo[playerid][slotid][ptScaleX],
  1488. PlayerToyInfo[playerid][slotid][ptScaleY],
  1489. PlayerToyInfo[playerid][slotid][ptScaleZ],
  1490. PlayerToyInfo[playerid][slotid][ptTradable],
  1491. PlayerToyInfo[playerid][slotid][ptSpecial]);
  1492.  
  1493. mysql_function_query(MainPipeline, szQuery, true, "OnQueryCreateToy", "ii", playerid, slotid);
  1494. }
  1495.  
  1496. // g_mysql_LoadMOTD()
  1497. // Description: Loads the MOTDs from the MySQL Database.
  1498. stock g_mysql_LoadMOTD()
  1499. {
  1500. mysql_function_query(MainPipeline, "SELECT `gMOTD`,`aMOTD`,`vMOTD`,`cMOTD`,`pMOTD`,`ShopTechPay`,`GiftCode`,`GiftCodeBypass`,`TotalCitizens`,`TRCitizens`,`SecurityCode`,`ShopClosed`,`RimMod`,`CarVoucher`,`PVIPVoucher`, `GarageVW`, `PumpkinStock`, `HalloweenShop` FROM `misc`", true, "OnQueryFinish", "iii", LOADMOTDDATA_THREAD, INVALID_PLAYER_ID, -1);
  1501. }
  1502.  
  1503. stock g_mysql_LoadSales()
  1504. {
  1505. mysql_function_query(MainPipeline, "SELECT * FROM `sales` WHERE `Month` > NOW() - INTERVAL 1 MONTH", true, "OnQueryFinish", "iii", LOADSALEDATA_THREAD, INVALID_PLAYER_ID, -1);
  1506. //mysql_function_query(MainPipeline, "SELECT `TotalToySales`,`TotalCarSales`,`GoldVIPSales`,`SilverVIPSales`,`BronzeVIPSales` FROM `sales` WHERE `Month` > NOW() - INTERVAL 1 MONTH", true, "OnQueryFinish", "iii", LOADSALEDATA_THREAD, INVALID_PLAYER_ID, -1);
  1507. }
  1508.  
  1509. stock g_mysql_LoadPrices()
  1510. {
  1511. mysql_function_query(MainPipeline, "SELECT * FROM `shopprices`", true, "OnQueryFinish", "iii", LOADSHOPDATA_THREAD, INVALID_PLAYER_ID, -1);
  1512. }
  1513.  
  1514. g_mysql_SavePrices()
  1515. {
  1516. new query[2000];
  1517. format(query, sizeof(query), "UPDATE `shopprices` SET `Price0` = '%d', `Price1` = '%d', `Price2` = '%d', `Price3` = '%d', `Price4` = '%d', `Price5` = '%d', `Price6` = '%d', `Price7` = '%d', `Price8` = '%d', `Price9` = '%d', `Price10` = '%d', \
  1518. `Price11` = '%d', `Price12` = '%d', `Price13` = '%d', `Price14` = '%d', `Price15` = '%d', `Price16` = '%d', `Price17` = '%d',", ShopItems[0][sItemPrice], ShopItems[1][sItemPrice], ShopItems[2][sItemPrice], ShopItems[3][sItemPrice], ShopItems[4][sItemPrice],
  1519. ShopItems[5][sItemPrice], ShopItems[6][sItemPrice], ShopItems[7][sItemPrice], ShopItems[8][sItemPrice], ShopItems[9][sItemPrice], ShopItems[10][sItemPrice], ShopItems[11][sItemPrice], ShopItems[12][sItemPrice], ShopItems[13][sItemPrice], ShopItems[14][sItemPrice], ShopItems[15][sItemPrice],
  1520. ShopItems[16][sItemPrice], ShopItems[17][sItemPrice]);
  1521. format(query, sizeof(query), "%s `Price18` = '%d', `Price19` = '%d', `Price20` = '%d', `Price21` = '%d', `Price22` = '%d', `Price23` = '%d', `Price24` = '%d', `Price25` = '%d', `Price26` = '%d', `Price27` = '%d', `Price28` = '%d'", query, ShopItems[18][sItemPrice], ShopItems[19][sItemPrice], ShopItems[20][sItemPrice], ShopItems[21][sItemPrice],
  1522. ShopItems[22][sItemPrice], ShopItems[23][sItemPrice], ShopItems[24][sItemPrice], ShopItems[25][sItemPrice], ShopItems[26][sItemPrice], ShopItems[27][sItemPrice], ShopItems[28][sItemPrice]);
  1523. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  1524. }
  1525.  
  1526. stock g_mysql_SaveMOTD()
  1527. {
  1528. new query[1024];
  1529.  
  1530. format(query, sizeof(query), "UPDATE `misc` SET ");
  1531.  
  1532. format(query, sizeof(query), "%s `gMOTD` = '%s',", query, g_mysql_ReturnEscaped(GlobalMOTD, MainPipeline));
  1533. format(query, sizeof(query), "%s `aMOTD` = '%s',", query, g_mysql_ReturnEscaped(AdminMOTD, MainPipeline));
  1534. format(query, sizeof(query), "%s `vMOTD` = '%s',", query, g_mysql_ReturnEscaped(VIPMOTD, MainPipeline));
  1535. format(query, sizeof(query), "%s `cMOTD` = '%s',", query, g_mysql_ReturnEscaped(CAMOTD, MainPipeline));
  1536. format(query, sizeof(query), "%s `pMOTD` = '%s',", query, g_mysql_ReturnEscaped(pMOTD, MainPipeline));
  1537. format(query, sizeof(query), "%s `ShopTechPay` = '%.2f',", query, ShopTechPay);
  1538. format(query, sizeof(query), "%s `GiftCode` = '%s',", query, g_mysql_ReturnEscaped(GiftCode, MainPipeline));
  1539. format(query, sizeof(query), "%s `GiftCodeBypass` = '%d',", query, GiftCodeBypass);
  1540. format(query, sizeof(query), "%s `TotalCitizens` = '%d',", query, TotalCitizens);
  1541. format(query, sizeof(query), "%s `TRCitizens` = '%d',", query, TRCitizens);
  1542. format(query, sizeof(query), "%s `ShopClosed` = '%d',", query, ShopClosed);
  1543. format(query, sizeof(query), "%s `RimMod` = '%d',", query, RimMod);
  1544. format(query, sizeof(query), "%s `CarVoucher` = '%d',", query, CarVoucher);
  1545. format(query, sizeof(query), "%s `PVIPVoucher` = '%d',", query, PVIPVoucher);
  1546. format(query, sizeof(query), "%s `GarageVW` = '%d',", query, GarageVW);
  1547. format(query, sizeof(query), "%s `PumpkinStock` = '%d',", query, PumpkinStock);
  1548. format(query, sizeof(query), "%s `HalloweenShop` = '%d'", query, HalloweenShop);
  1549.  
  1550. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  1551. }
  1552.  
  1553. // g_mysql_LoadMOTD()
  1554. // Description: Loads the Crates from the MySQL Database.
  1555. stock mysql_LoadCrates()
  1556. {
  1557. mysql_function_query(MainPipeline, "SELECT * FROM `crates`", true, "OnQueryFinish", "iii", LOADCRATE_THREAD, INVALID_PLAYER_ID, -1);
  1558. print("[LoadCrates] Load Query Sent");
  1559. }
  1560.  
  1561. stock mysql_SaveCrates()
  1562. {
  1563. new query[1024];
  1564. for(new i; i < MAX_CRATES; i++)
  1565. {
  1566. printf("Saving Crate %d", i);
  1567. format(query, sizeof(query), "UPDATE `crates` SET ");
  1568.  
  1569. format(query, sizeof(query), "%s `Active` = '%d',", query, CrateInfo[i][crActive]);
  1570. format(query, sizeof(query), "%s `CrateX` = '%.2f',", query, CrateInfo[i][crX]);
  1571. format(query, sizeof(query), "%s `CrateY` = '%.2f',", query, CrateInfo[i][crY]);
  1572. format(query, sizeof(query), "%s `CrateZ` = '%.2f',", query, CrateInfo[i][crZ]);
  1573. format(query, sizeof(query), "%s `GunQuantity` = '%d',", query, CrateInfo[i][GunQuantity]);
  1574. format(query, sizeof(query), "%s `InVehicle` = '%d',", query, CrateInfo[i][InVehicle]);
  1575. format(query, sizeof(query), "%s `Int` = '%d',", query, CrateInfo[i][crInt]);
  1576. format(query, sizeof(query), "%s `VW` = '%d',", query, CrateInfo[i][crVW]);
  1577. format(query, sizeof(query), "%s `PlacedBy` = '%s'", query, CrateInfo[i][crPlacedBy]);
  1578. format(query, sizeof(query), "%s WHERE id = %d", query, i);
  1579.  
  1580. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  1581. }
  1582. }
  1583.  
  1584. stock RemoveBan(Player, Ip[])
  1585. {
  1586. new string[128];
  1587. SetPVarString(Player, "UnbanIP", Ip);
  1588. format(string, sizeof(string), "SELECT `ip` FROM `ip_bans` WHERE `ip` = '%s'", Ip);
  1589. mysql_function_query(MainPipeline, string, true, "AddingBan", "ii", Player, 2);
  1590. return 1;
  1591. }
  1592.  
  1593. stock CheckBanEx(playerid)
  1594. {
  1595. new string[60];
  1596. format(string, sizeof(string), "SELECT `ip` FROM `ip_bans` WHERE `ip` = '%s'", GetPlayerIpEx(playerid));
  1597. mysql_function_query(MainPipeline, string, true, "OnQueryFinish", "iii", IPBAN_THREAD, playerid, g_arrQueryHandle{playerid});
  1598. return 1;
  1599. }
  1600.  
  1601. stock AddBan(Admin, Player, Reason[])
  1602. {
  1603. new string[128];
  1604. SetPVarInt(Admin, "BanningPlayer", Player);
  1605. SetPVarString(Admin, "BanningReason", Reason);
  1606. format(string, sizeof(string), "SELECT `ip` FROM `ip_bans` WHERE `ip` = '%s'", GetPlayerIpEx(Player));
  1607. mysql_function_query(MainPipeline, string, true, "AddingBan", "ii", Admin, 1);
  1608. return 1;
  1609. }
  1610.  
  1611.  
  1612. stock SystemBan(Player, Reason[])
  1613. {
  1614. new string[150];
  1615. format(string, sizeof(string), "INSERT INTO `ip_bans` (`ip`, `date`, `reason`, `admin`) VALUES ('%s', NOW(), '%s', 'System')", GetPlayerIpEx(Player), Reason);
  1616. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  1617. return 1;
  1618. }
  1619.  
  1620.  
  1621. stock MySQLBan(userid,ip[],reason[],status,admin[])
  1622. {
  1623. new string[200];
  1624. format(string, sizeof(string), "INSERT INTO `bans` (`user_id`, `ip_address`, `reason`, `date_added`, `status`, `admin`) VALUES ('%d','%s','%s', NOW(), '%d','%s')", userid,ip,reason,status,admin);
  1625. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  1626. return 1;
  1627. }
  1628.  
  1629. stock AddCrime(cop, suspect, crime[])
  1630. {
  1631. new query[256];
  1632. format(query, sizeof(query), "INSERT INTO `mdc` (`id` ,`time` ,`issuer` ,`crime`) VALUES ('%d',NOW(),'%s','%s')", GetPlayerSQLId(suspect), g_mysql_ReturnEscaped(GetPlayerNameEx(cop), MainPipeline), g_mysql_ReturnEscaped(crime, MainPipeline));
  1633. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  1634. format(query, sizeof(query), "MDC: %s added crime %s to %s.", GetPlayerNameEx(cop), crime, GetPlayerNameEx(suspect));
  1635. Log("logs/crime.log", query);
  1636. return 1;
  1637. }
  1638.  
  1639. stock ClearCrimes(playerid)
  1640. {
  1641. new query[80];
  1642. format(query, sizeof(query), "UPDATE `mdc` SET `active`=0 WHERE `id` = %i AND `active` = 1", GetPlayerSQLId(playerid));
  1643. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  1644. return 1;
  1645. }
  1646.  
  1647. stock DisplayCrimes(playerid, suspectid)
  1648. {
  1649. new query[128];
  1650. format(query, sizeof(query), "SELECT issuer, crime, active FROM `mdc` WHERE id=%d ORDER BY `time` AND `active` DESC LIMIT 12", GetPlayerSQLId(suspectid));
  1651. mysql_function_query(MainPipeline, query, true, "MDCQueryFinish", "ii", playerid, suspectid);
  1652. return 1;
  1653. }
  1654.  
  1655. stock DisplayReports(playerid, suspectid)
  1656. {
  1657. new query[812];
  1658. format(query, sizeof(query), "SELECT arrestreports.id, copid, shortreport, datetime, accounts.id, accounts.Username FROM `arrestreports` LEFT JOIN `accounts` ON arrestreports.copid=accounts.id WHERE arrestreports.suspectid=%d ORDER BY arrestreports.datetime DESC LIMIT 12", GetPlayerSQLId(suspectid));
  1659. mysql_function_query(MainPipeline, query, true, "MDCReportsQueryFinish", "ii", playerid, suspectid);
  1660. return 1;
  1661. }
  1662.  
  1663. stock DisplayReport(playerid, reportid)
  1664. {
  1665. new query[812];
  1666. format(query, sizeof(query), "SELECT arrestreports.id, copid, shortreport, datetime, accounts.id, accounts.Username FROM `arrestreports` LEFT JOIN `accounts` ON arrestreports.copid=accounts.id WHERE arrestreports.id=%d ORDER BY arrestreports.datetime DESC LIMIT 12", reportid);
  1667. mysql_function_query(MainPipeline, query, true, "MDCReportQueryFinish", "ii", playerid, reportid);
  1668. return 1;
  1669. }
  1670.  
  1671. stock SetUnreadMailsNotification(playerid)
  1672. {
  1673. new query[128];
  1674. format(query, sizeof(query), "SELECT COUNT(*) AS Unread_Count FROM letters WHERE Receiver_ID = %d AND `Read` = 0", GetPlayerSQLId(playerid));
  1675. mysql_function_query(MainPipeline, query, true, "UnreadMailsNotificationQueryFin", "i", playerid);
  1676. return 1;
  1677. }
  1678.  
  1679. stock DisplayMails(playerid)
  1680. {
  1681. new query[150];
  1682. format(query, sizeof(query), "SELECT `Id`, `Message`, `Read` FROM `letters` WHERE `Receiver_Id` = %d AND `Delivery_Min` = 0 ORDER BY `Id` DESC LIMIT 50", GetPlayerSQLId(playerid));
  1683. mysql_function_query(MainPipeline, query, true, "MailsQueryFinish", "i", playerid);
  1684. }
  1685.  
  1686. stock DisplayMailDetails(playerid, letterid)
  1687. {
  1688. new query[256];
  1689. format(query, sizeof(query), "SELECT `Id`, `Date`, `Sender_Id`, `Read`, `Notify`, `Message`, (SELECT `Username` FROM `accounts` WHERE `id` = letters.Sender_Id) AS `SenderUser` FROM `letters` WHERE id = %d", letterid);
  1690. mysql_function_query(MainPipeline, query, true, "MailDetailsQueryFinish", "i", playerid);
  1691. }
  1692.  
  1693. stock CountFlags(playerid)
  1694. {
  1695. new query[80];
  1696. format(query, sizeof(query), "SELECT * FROM `flags` WHERE id=%d", GetPlayerSQLId(playerid));
  1697. mysql_function_query(MainPipeline, query, true, "FlagQueryFinish", "iii", playerid, INVALID_PLAYER_ID, Flag_Query_Count);
  1698. return 1;
  1699. }
  1700.  
  1701. stock AddFlag(playerid, adminid, flag[])
  1702. {
  1703. new query[300];
  1704. new admin[24];
  1705. if(adminid != INVALID_PLAYER_ID) {
  1706. format(admin, sizeof(admin), "%s", GetPlayerNameEx(adminid));
  1707. }
  1708. else {
  1709. format(admin, sizeof(admin), "Gifted/Script Added");
  1710. }
  1711. PlayerInfo[playerid][pFlagged]++;
  1712. format(query, sizeof(query), "INSERT INTO `flags` (`id` ,`time` ,`issuer` ,`flag`) VALUES ('%d',NOW(),'%s','%s')", GetPlayerSQLId(playerid), g_mysql_ReturnEscaped(admin, MainPipeline), g_mysql_ReturnEscaped(flag, MainPipeline));
  1713. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  1714. format(query, sizeof(query), "FLAG: %s added flag %s to %s.", admin, flag, GetPlayerNameEx(playerid));
  1715. Log("logs/flags.log", query);
  1716. return 1;
  1717. }
  1718.  
  1719. stock AddOFlag(sqlid, adminid, flag[]) // offline add
  1720. {
  1721. new query[300];
  1722. new admin[24], name[24];
  1723. if(adminid != INVALID_PLAYER_ID) {
  1724. format(admin, sizeof(admin), "%s", GetPlayerNameEx(adminid));
  1725. }
  1726. else {
  1727. format(admin, sizeof(admin), "Gifted/Script Added");
  1728. }
  1729. GetPVarString(adminid, "OnAddFlag", name, sizeof(name));
  1730. format(query, sizeof(query), "INSERT INTO `flags` (`id` ,`time` ,`issuer` ,`flag`) VALUES ('%d',NOW(),'%s','%s')", sqlid, g_mysql_ReturnEscaped(admin, MainPipeline), g_mysql_ReturnEscaped(flag, MainPipeline));
  1731. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  1732. format(query, sizeof(query), "FLAG: %s added flag %s to %s.", admin, flag, name);
  1733. Log("logs/flags.log", query);
  1734. DeletePVar(adminid, "OnAddFlag");
  1735. return 1;
  1736. }
  1737.  
  1738. stock DeleteFlag(flagid, adminid)
  1739. {
  1740. new query[80];
  1741. format(query, sizeof(query), "FLAG: Flag %d was deleted by %s.", flagid, GetPlayerNameEx(adminid));
  1742. Log("logs/flags.log", query);
  1743. format(query, sizeof(query), "DELETE FROM `flags` WHERE `fid` = %i", flagid);
  1744. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  1745. return 1;
  1746. }
  1747.  
  1748. stock DisplayFlags(playerid, targetid)
  1749. {
  1750. new query[128];
  1751. CountFlags(targetid);
  1752. format(query, sizeof(query), "SELECT fid, issuer, flag, time FROM `flags` WHERE id=%d ORDER BY `time` LIMIT 15", GetPlayerSQLId(targetid));
  1753. mysql_function_query(MainPipeline, query, true, "FlagQueryFinish", "iii", playerid, targetid, Flag_Query_Display);
  1754. return 1;
  1755. }
  1756.  
  1757. stock CountSkins(playerid)
  1758. {
  1759. new query[80];
  1760. format(query, sizeof(query), "SELECT NULL FROM `house_closet` WHERE playerid = %d", GetPlayerSQLId(playerid));
  1761. mysql_function_query(MainPipeline, query, true, "SkinQueryFinish", "ii", playerid, Skin_Query_Count);
  1762. return 1;
  1763. }
  1764.  
  1765. stock AddSkin(playerid, skinid)
  1766. {
  1767. new query[300];
  1768. PlayerInfo[playerid][pSkins]++;
  1769. format(query, sizeof(query), "INSERT INTO `house_closet` (`id`, `playerid`, `skinid`) VALUES (NULL, '%d', '%d')", GetPlayerSQLId(playerid), skinid);
  1770. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  1771. return 1;
  1772. }
  1773.  
  1774. stock DeleteSkin(skinid)
  1775. {
  1776. new query[80];
  1777. format(query, sizeof(query), "DELETE FROM `house_closet` WHERE `id` = %i", skinid);
  1778. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  1779. return 1;
  1780. }
  1781.  
  1782. stock DisplaySkins(playerid)
  1783. {
  1784. new query[128];
  1785. CountSkins(playerid);
  1786. format(query, sizeof(query), "SELECT `skinid` FROM `house_closet` WHERE playerid = %d ORDER BY `skinid` ASC", GetPlayerSQLId(playerid));
  1787. mysql_function_query(MainPipeline, query, true, "SkinQueryFinish", "ii", playerid, Skin_Query_Display);
  1788. return 1;
  1789. }
  1790.  
  1791. stock CountCitizens()
  1792. {
  1793. mysql_function_query(MainPipeline, "SELECT NULL FROM `accounts` WHERE `Nation` = 1 && `UpdateDate` > NOW() - INTERVAL 1 WEEK", true, "CitizenQueryFinish", "i", TR_Citizen_Count);
  1794. mysql_function_query(MainPipeline, "SELECT NULL FROM `accounts` WHERE `UpdateDate` > NOW() - INTERVAL 1 WEEK", true, "CitizenQueryFinish", "i", Total_Count);
  1795. return 1;
  1796. }
  1797.  
  1798. stock CheckNationQueue(playerid, nation)
  1799. {
  1800. new query[300];
  1801. format(query, sizeof(query), "SELECT NULL FROM `nation_queue` WHERE `playerid` = %d AND `status` = 1", GetPlayerSQLId(playerid));
  1802. mysql_function_query(MainPipeline, query, true, "NationQueueQueryFinish", "iii", playerid, nation, CheckQueue);
  1803. }
  1804.  
  1805. stock AddNationQueue(playerid, nation, status)
  1806. {
  1807. new query[300];
  1808. if(nation == 0)
  1809. {
  1810. format(query, sizeof(query), "INSERT INTO `nation_queue` (`id`, `playerid`, `name`, `date`, `nation`, `status`) VALUES (NULL, %d, '%s', NOW(), 0, %d)", GetPlayerSQLId(playerid), GetPlayerNameExt(playerid), status);
  1811. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  1812. }
  1813. if(nation == 1)
  1814. {
  1815. if(status == 1)
  1816. {
  1817. format(query, sizeof(query), "SELECT NULL FROM `nation_queue` WHERE `playerid` = %d AND `nation` = 1", GetPlayerSQLId(playerid));
  1818. mysql_function_query(MainPipeline, query, true, "NationQueueQueryFinish", "iii", playerid, nation, AddQueue);
  1819. }
  1820. else if(status == 2)
  1821. {
  1822. format(query, sizeof(query), "INSERT INTO `nation_queue` (`id`, `playerid`, `name`, `date`, `nation`, `status`) VALUES (NULL, %d, '%s', NOW(), 1, %d)", GetPlayerSQLId(playerid), GetPlayerNameExt(playerid), status);
  1823. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  1824. PlayerInfo[playerid][pNation] = 1;
  1825. }
  1826. }
  1827. return 1;
  1828. }
  1829.  
  1830. stock UpdateCitizenApp(playerid, nation)
  1831. {
  1832. new query[300];
  1833. format(query, sizeof(query), "SELECT NULL FROM `nation_queue` WHERE `playerid` = %d AND `status` = 1", GetPlayerSQLId(playerid));
  1834. mysql_function_query(MainPipeline, query, true, "NationQueueQueryFinish", "iii", playerid, nation, UpdateQueue);
  1835. }
  1836.  
  1837. stock AddTicket(playerid, number)
  1838. {
  1839. new query[80];
  1840. PlayerInfo[playerid][pLottoNr]++;
  1841. format(query, sizeof(query), "INSERT INTO `lotto` (`id` ,`number`) VALUES ('%d', '%d')", GetPlayerSQLId(playerid), number);
  1842. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  1843. return 1;
  1844. }
  1845.  
  1846. stock DeleteTickets(playerid)
  1847. {
  1848. new query[80];
  1849. format(query, sizeof(query), "DELETE FROM `lotto` WHERE `id` = %i", GetPlayerSQLId(playerid));
  1850. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  1851. return 1;
  1852. }
  1853.  
  1854. stock LoadTickets(playerid)
  1855. {
  1856. new query[128];
  1857. format(query, sizeof(query), "SELECT `tid`, `number` FROM `lotto` WHERE `id` = %d LIMIT 5", GetPlayerSQLId(playerid));
  1858. mysql_function_query(MainPipeline, query, true, "LoadTicket", "i", playerid);
  1859. return 1;
  1860. }
  1861.  
  1862. stock CountTickets(playerid)
  1863. {
  1864. new query[80];
  1865. format(query, sizeof(query), "SELECT * FROM `lotto` WHERE `id` = %i", GetPlayerSQLId(playerid));
  1866. mysql_function_query(MainPipeline, query, true, "CountAmount", "i", playerid);
  1867. return 1;
  1868. }
  1869.  
  1870. stock LoadTreasureInventory(playerid)
  1871. {
  1872. new query[175];
  1873. format(query, sizeof(query), "SELECT `junkmetal`, `newcoin`, `oldcoin`, `brokenwatch`, `oldkey`, `treasure`, `goldwatch`, `silvernugget`, `goldnugget` FROM `jobstuff` WHERE `pId` = %d", GetPlayerSQLId(playerid));
  1874. mysql_function_query(MainPipeline, query, true, "LoadTreasureInvent", "i", playerid);
  1875. return 1;
  1876. }
  1877.  
  1878. stock SaveTreasureInventory(playerid)
  1879. {
  1880. new string[220];
  1881. format(string, sizeof(string), "UPDATE `jobstuff` SET `junkmetal` = %d, `newcoin` = %d, `oldcoin` = %d, `brokenwatch` = %d, `oldkey` = %d, \
  1882. `treasure` = %d, `goldwatch` = %d, `silvernugget` = %d, `goldnugget` =%d WHERE `pId` = %d", GetPVarInt(playerid, "junkmetal"), GetPVarInt(playerid, "newcoin"), GetPVarInt(playerid, "oldcoin"),
  1883. GetPVarInt(playerid, "brokenwatch"), GetPVarInt(playerid, "oldkey"), GetPVarInt(playerid, "treasure"), GetPVarInt(playerid, "goldwatch"), GetPVarInt(playerid, "silvernugget"), GetPVarInt(playerid, "goldnugget"), GetPlayerSQLId(playerid));
  1884. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  1885. return 1;
  1886. }
  1887.  
  1888. stock SQL_Log(szQuery[], szDesc[] = "none", iExtraID = 0) {
  1889. new i_dateTime[2][3];
  1890. gettime(i_dateTime[0][0], i_dateTime[0][1], i_dateTime[0][2]);
  1891. getdate(i_dateTime[1][0], i_dateTime[1][1], i_dateTime[1][2]);
  1892.  
  1893. printf("Dumping query from %i/%i/%i (%i:%i:%i)\r\nDescription: %s (index %i). Query:\r\n", i_dateTime[1][0], i_dateTime[1][1], i_dateTime[1][2], i_dateTime[0][0], i_dateTime[0][1], i_dateTime[0][2], szDesc, iExtraID);
  1894. if(strlen(szQuery) > 1023)
  1895. {
  1896. new sz_print[1024];
  1897. new Float:maxfloat = strlen(szQuery)/1023;
  1898. for(new x;x<=floatround(maxfloat, floatround_ceil);x++)
  1899. {
  1900. strmid(sz_print, szQuery, 0+(x*1023), 1023+(x*1023));
  1901. print(sz_print);
  1902. }
  1903. }
  1904. else
  1905. {
  1906. print(szQuery);
  1907. }
  1908. return 1;
  1909. }
  1910.  
  1911. stock LoadFamilies()
  1912. {
  1913. printf("[LoadFamilies] Loading data from database...");
  1914. mysql_function_query(MainPipeline, "SELECT * FROM `families`", true, "OnLoadFamilies", "");
  1915. }
  1916.  
  1917. stock FamilyMemberCount(famid)
  1918. {
  1919. new query[56];
  1920. format(query, sizeof(query), "SELECT NULL FROM `accounts` WHERE `FMember` = '%d'", famid);
  1921. mysql_function_query(MainPipeline, query, true, "OnFamilyMemberCount", "i", famid);
  1922. return 1;
  1923. }
  1924.  
  1925. stock SaveFamily(id) {
  1926.  
  1927. new string[2048];
  1928.  
  1929. format(string, sizeof(string), "UPDATE `families` SET \
  1930. `Taken`=%d, \
  1931. `Name`='%s', \
  1932. `Leader`='%s', \
  1933. `Bank`=%d, \
  1934. `Cash`=%d, \
  1935. `FamilyUSafe`=%d, \
  1936. `FamilySafeX`=%f, \
  1937. `FamilySafeY`=%f, \
  1938. `FamilySafeZ`=%f, \
  1939. `FamilySafeVW`=%d, \
  1940. `FamilySafeInt`=%d, \
  1941. `Pot`=%d, \
  1942. `Crack`=%d, \
  1943. `Mats`=%d, \
  1944. `Heroin`=%d, \
  1945. `Rank0`='%s', \
  1946. `Rank1`='%s', \
  1947. `Rank2`='%s', \
  1948. `Rank3`='%s', \
  1949. `Rank4`='%s', \
  1950. `Rank5`='%s', \
  1951. `Rank6`='%s', \
  1952. `Division0`='%s', \
  1953. `Division1`='%s', \
  1954. `Division2`='%s', \
  1955. `Division3`='%s', \
  1956. `Division4`='%s', ",
  1957. FamilyInfo[id][FamilyTaken],
  1958. g_mysql_ReturnEscaped(FamilyInfo[id][FamilyName], MainPipeline),
  1959. FamilyInfo[id][FamilyLeader],
  1960. FamilyInfo[id][FamilyBank],
  1961. FamilyInfo[id][FamilyCash],
  1962. FamilyInfo[id][FamilyUSafe],
  1963. FamilyInfo[id][FamilySafe][0],
  1964. FamilyInfo[id][FamilySafe][1],
  1965. FamilyInfo[id][FamilySafe][2],
  1966. FamilyInfo[id][FamilySafeVW],
  1967. FamilyInfo[id][FamilySafeInt],
  1968. FamilyInfo[id][FamilyPot],
  1969. FamilyInfo[id][FamilyCrack],
  1970. FamilyInfo[id][FamilyMats],
  1971. FamilyInfo[id][FamilyHeroin],
  1972. g_mysql_ReturnEscaped(FamilyRankInfo[id][0], MainPipeline),
  1973. g_mysql_ReturnEscaped(FamilyRankInfo[id][1], MainPipeline),
  1974. g_mysql_ReturnEscaped(FamilyRankInfo[id][2], MainPipeline),
  1975. g_mysql_ReturnEscaped(FamilyRankInfo[id][3], MainPipeline),
  1976. g_mysql_ReturnEscaped(FamilyRankInfo[id][4], MainPipeline),
  1977. g_mysql_ReturnEscaped(FamilyRankInfo[id][5], MainPipeline),
  1978. g_mysql_ReturnEscaped(FamilyRankInfo[id][6], MainPipeline),
  1979. g_mysql_ReturnEscaped(FamilyDivisionInfo[id][0], MainPipeline),
  1980. g_mysql_ReturnEscaped(FamilyDivisionInfo[id][1], MainPipeline),
  1981. g_mysql_ReturnEscaped(FamilyDivisionInfo[id][2], MainPipeline),
  1982. g_mysql_ReturnEscaped(FamilyDivisionInfo[id][3], MainPipeline),
  1983. g_mysql_ReturnEscaped(FamilyDivisionInfo[id][4], MainPipeline)
  1984. );
  1985.  
  1986. format(string, sizeof(string), "%s\
  1987. `fontface`='%s', \
  1988. `fontsize`=%d, \
  1989. `bold`=%d, \
  1990. `fontcolor`=%d, \
  1991. `gtUsed`=%d, \
  1992. `text`='%s', ",
  1993. string,
  1994. FamilyInfo[id][gt_FontFace],
  1995. FamilyInfo[id][gt_FontSize],
  1996. FamilyInfo[id][gt_Bold],
  1997. FamilyInfo[id][gt_FontColor],
  1998. FamilyInfo[id][gt_SPUsed],
  1999. g_mysql_ReturnEscaped(FamilyInfo[id][gt_Text], MainPipeline)
  2000. );
  2001.  
  2002. format(string, sizeof(string), "%s \
  2003. `MaxSkins`=%d, \
  2004. `Skin1`=%d, \
  2005. `Skin2`=%d, \
  2006. `Skin3`=%d, \
  2007. `Skin4`=%d, \
  2008. `Skin5`=%d, \
  2009. `Skin6`=%d, \
  2010. `Skin7`=%d, \
  2011. `Skin8`=%d, \
  2012. `Color`=%d, \
  2013. `TurfTokens`=%d, \
  2014. `Gun1`=%d, \
  2015. `Gun2`=%d, \
  2016. `Gun3`=%d, \
  2017. `Gun4`=%d, \
  2018. `Gun5`=%d, \
  2019. `Gun6`=%d, \
  2020. `Gun7`=%d, \
  2021. `Gun8`=%d, \
  2022. `Gun9`=%d, \
  2023. `Gun10`=%d, \
  2024. `GtObject`=%d, \
  2025. `MOTD1`='%s', \
  2026. `MOTD2`='%s', \
  2027. `MOTD3`='%s' \
  2028. WHERE `ID` = %d",
  2029. string,
  2030. FamilyInfo[id][FamilyMaxSkins],
  2031. FamilyInfo[id][FamilySkins][0],
  2032. FamilyInfo[id][FamilySkins][1],
  2033. FamilyInfo[id][FamilySkins][2],
  2034. FamilyInfo[id][FamilySkins][3],
  2035. FamilyInfo[id][FamilySkins][4],
  2036. FamilyInfo[id][FamilySkins][5],
  2037. FamilyInfo[id][FamilySkins][6],
  2038. FamilyInfo[id][FamilySkins][7],
  2039. FamilyInfo[id][FamilyColor],
  2040. FamilyInfo[id][FamilyTurfTokens],
  2041. FamilyInfo[id][FamilyGuns][0],
  2042. FamilyInfo[id][FamilyGuns][1],
  2043. FamilyInfo[id][FamilyGuns][2],
  2044. FamilyInfo[id][FamilyGuns][3],
  2045. FamilyInfo[id][FamilyGuns][4],
  2046. FamilyInfo[id][FamilyGuns][5],
  2047. FamilyInfo[id][FamilyGuns][6],
  2048. FamilyInfo[id][FamilyGuns][7],
  2049. FamilyInfo[id][FamilyGuns][8],
  2050. FamilyInfo[id][FamilyGuns][9],
  2051. FamilyInfo[id][gtObject],
  2052. g_mysql_ReturnEscaped(FamilyMOTD[id][0], MainPipeline),
  2053. g_mysql_ReturnEscaped(FamilyMOTD[id][1], MainPipeline),
  2054. g_mysql_ReturnEscaped(FamilyMOTD[id][2], MainPipeline),
  2055. id
  2056. );
  2057.  
  2058. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  2059.  
  2060. return 1;
  2061. }
  2062.  
  2063. stock SaveFamiliesHQ(id)
  2064. {
  2065. if(!( 1 <= id < MAX_FAMILY))
  2066. return 0;
  2067.  
  2068. new query[300];
  2069. format(query, sizeof(query), "UPDATE `families` SET `ExteriorX` = %f, `ExteriorY` = %f, `ExteriorZ` = %f, `ExteriorA` = %f, `InteriorX` = %f, `InteriorY` = %f, `InteriorZ` = %f, `InteriorA` = %f, \
  2070. `INT` = %d, `VW` = %d, `CustomInterior` = %d WHERE ID = %d", FamilyInfo[id][FamilyEntrance][0], FamilyInfo[id][FamilyEntrance][1], FamilyInfo[id][FamilyEntrance][2], FamilyInfo[id][FamilyEntrance][3],
  2071. FamilyInfo[id][FamilyExit][0], FamilyInfo[id][FamilyExit][1], FamilyInfo[id][FamilyExit][2], FamilyInfo[id][FamilyExit][3], FamilyInfo[id][FamilyInterior], FamilyInfo[id][FamilyVirtualWorld],
  2072. FamilyInfo[id][FamilyCustomMap], id);
  2073. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "ii", SENDDATA_THREAD, INVALID_PLAYER_ID);
  2074. return 1;
  2075. }
  2076.  
  2077. stock LoadGates()
  2078. {
  2079. printf("[LoadGates] Loading data from database...");
  2080. mysql_function_query(MainPipeline, "SELECT * FROM `gates`", true, "OnLoadGates", "");
  2081. }
  2082.  
  2083. stock SaveDynamicMapIcon(mapiconid)
  2084. {
  2085. new string[512];
  2086.  
  2087. format(string, sizeof(string), "UPDATE `dmapicons` SET \
  2088. `MarkerType`=%d, \
  2089. `Color`=%d, \
  2090. `VW`=%d, \
  2091. `Int`=%d, \
  2092. `PosX`=%f, \
  2093. `PosY`=%f, \
  2094. `PosZ`=%f WHERE `id`=%d",
  2095. DMPInfo[mapiconid][dmpMarkerType],
  2096. DMPInfo[mapiconid][dmpColor],
  2097. DMPInfo[mapiconid][dmpVW],
  2098. DMPInfo[mapiconid][dmpInt],
  2099. DMPInfo[mapiconid][dmpPosX],
  2100. DMPInfo[mapiconid][dmpPosY],
  2101. DMPInfo[mapiconid][dmpPosZ],
  2102. mapiconid
  2103. ); // Array starts from zero, MySQL starts at 1 (this is why we are adding one).
  2104.  
  2105. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  2106. }
  2107.  
  2108. stock LoadDynamicMapIcon(mapiconid)
  2109. {
  2110. new string[128];
  2111. format(string, sizeof(string), "SELECT * FROM `dmapicons` WHERE `id`=%d", mapiconid);
  2112. mysql_function_query(MainPipeline, string, true, "OnLoadDynamicMapIcon", "i", mapiconid);
  2113. }
  2114.  
  2115. stock LoadDynamicMapIcons()
  2116. {
  2117. printf("[LoadDynamicMapIcons] Loading data from database...");
  2118. mysql_function_query(MainPipeline, "SELECT * FROM `dmapicons`", true, "OnLoadDynamicMapIcons", "");
  2119. }
  2120.  
  2121. stock SaveDynamicDoor(doorid)
  2122. {
  2123. new string[1024];
  2124. format(string, sizeof(string), "UPDATE `ddoors` SET \
  2125. `Description`='%s', \
  2126. `Owner`=%d, \
  2127. `OwnerName`='%s', \
  2128. `CustomInterior`=%d, \
  2129. `ExteriorVW`=%d, \
  2130. `ExteriorInt`=%d, \
  2131. `InteriorVW`=%d, \
  2132. `InteriorInt`=%d, \
  2133. `ExteriorX`=%f, \
  2134. `ExteriorY`=%f, \
  2135. `ExteriorZ`=%f, \
  2136. `ExteriorA`=%f, \
  2137. `InteriorX`=%f, \
  2138. `InteriorY`=%f, \
  2139. `InteriorZ`=%f, \
  2140. `InteriorA`=%f,",
  2141. g_mysql_ReturnEscaped(DDoorsInfo[doorid][ddDescription], MainPipeline),
  2142. DDoorsInfo[doorid][ddOwner],
  2143. g_mysql_ReturnEscaped(DDoorsInfo[doorid][ddOwnerName], MainPipeline),
  2144. DDoorsInfo[doorid][ddCustomInterior],
  2145. DDoorsInfo[doorid][ddExteriorVW],
  2146. DDoorsInfo[doorid][ddExteriorInt],
  2147. DDoorsInfo[doorid][ddInteriorVW],
  2148. DDoorsInfo[doorid][ddInteriorInt],
  2149. DDoorsInfo[doorid][ddExteriorX],
  2150. DDoorsInfo[doorid][ddExteriorY],
  2151. DDoorsInfo[doorid][ddExteriorZ],
  2152. DDoorsInfo[doorid][ddExteriorA],
  2153. DDoorsInfo[doorid][ddInteriorX],
  2154. DDoorsInfo[doorid][ddInteriorY],
  2155. DDoorsInfo[doorid][ddInteriorZ],
  2156. DDoorsInfo[doorid][ddInteriorA]
  2157. );
  2158.  
  2159. format(string, sizeof(string), "%s \
  2160. `CustomExterior`=%d, \
  2161. `Type`=%d, \
  2162. `Rank`=%d, \
  2163. `VIP`=%d, \
  2164. `Famed`=%d, \
  2165. `DPC`=%d, \
  2166. `Allegiance`=%d, \
  2167. `GroupType`=%d, \
  2168. `Family`=%d, \
  2169. `Faction`=%d, \
  2170. `Admin`=%d, \
  2171. `Wanted`=%d, \
  2172. `VehicleAble`=%d, \
  2173. `Color`=%d, \
  2174. `PickupModel`=%d, \
  2175. `Pass`='%s', \
  2176. `Locked`=%d WHERE `id`=%d",
  2177. string,
  2178. DDoorsInfo[doorid][ddCustomExterior],
  2179. DDoorsInfo[doorid][ddType],
  2180. DDoorsInfo[doorid][ddRank],
  2181. DDoorsInfo[doorid][ddVIP],
  2182. DDoorsInfo[doorid][ddFamed],
  2183. DDoorsInfo[doorid][ddDPC],
  2184. DDoorsInfo[doorid][ddAllegiance],
  2185. DDoorsInfo[doorid][ddGroupType],
  2186. DDoorsInfo[doorid][ddFamily],
  2187. DDoorsInfo[doorid][ddFaction],
  2188. DDoorsInfo[doorid][ddAdmin],
  2189. DDoorsInfo[doorid][ddWanted],
  2190. DDoorsInfo[doorid][ddVehicleAble],
  2191. DDoorsInfo[doorid][ddColor],
  2192. DDoorsInfo[doorid][ddPickupModel],
  2193. g_mysql_ReturnEscaped(DDoorsInfo[doorid][ddPass], MainPipeline),
  2194. DDoorsInfo[doorid][ddLocked],
  2195. doorid+1
  2196. ); // Array starts from zero, MySQL starts at 1 (this is why we are adding one).
  2197.  
  2198. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  2199. }
  2200.  
  2201. stock LoadDynamicDoor(doorid)
  2202. {
  2203. new string[128];
  2204. format(string, sizeof(string), "SELECT * FROM `ddoors` WHERE `id`=%d", doorid+1); // Array starts at zero, MySQL starts at 1.
  2205. mysql_function_query(MainPipeline, string, true, "OnLoadDynamicDoor", "i", doorid);
  2206. }
  2207.  
  2208. stock LoadDynamicDoors()
  2209. {
  2210. printf("[LoadDynamicDoors] Loading data from database...");
  2211. mysql_function_query(MainPipeline, "SELECT * FROM `ddoors`", true, "OnLoadDynamicDoors", "");
  2212. }
  2213.  
  2214. stock SaveHouse(houseid)
  2215. {
  2216. new string[2048];
  2217. printf("Saving House ID %d", houseid);
  2218. format(string, sizeof(string), "UPDATE `houses` SET \
  2219. `Owned`=%d, \
  2220. `Level`=%d, \
  2221. `Description`='%s', \
  2222. `OwnerID`=%d, \
  2223. `ExteriorX`=%f, \
  2224. `ExteriorY`=%f, \
  2225. `ExteriorZ`=%f, \
  2226. `ExteriorR`=%f, \
  2227. `InteriorX`=%f, \
  2228. `InteriorY`=%f, \
  2229. `InteriorZ`=%f, \
  2230. `InteriorR`=%f, \
  2231. `ExtIW`=%d, \
  2232. `ExtVW`=%d, \
  2233. `IntIW`=%d, \
  2234. `IntVW`=%d,",
  2235. HouseInfo[houseid][hOwned],
  2236. HouseInfo[houseid][hLevel],
  2237. g_mysql_ReturnEscaped(HouseInfo[houseid][hDescription], MainPipeline),
  2238. HouseInfo[houseid][hOwnerID],
  2239. HouseInfo[houseid][hExteriorX],
  2240. HouseInfo[houseid][hExteriorY],
  2241. HouseInfo[houseid][hExteriorZ],
  2242. HouseInfo[houseid][hExteriorR],
  2243. HouseInfo[houseid][hInteriorX],
  2244. HouseInfo[houseid][hInteriorY],
  2245. HouseInfo[houseid][hInteriorZ],
  2246. HouseInfo[houseid][hInteriorR],
  2247. HouseInfo[houseid][hExtIW],
  2248. HouseInfo[houseid][hExtVW],
  2249. HouseInfo[houseid][hIntIW],
  2250. HouseInfo[houseid][hIntVW]
  2251. );
  2252.  
  2253. format(string, sizeof(string), "%s \
  2254. `Lock`=%d, \
  2255. `Rentable`=%d, \
  2256. `RentFee`=%d, \
  2257. `Value`=%d, \
  2258. `SafeMoney`=%d, \
  2259. `Pot`=%d, \
  2260. `Crack`=%d, \
  2261. `Materials`=%d, \
  2262. `Heroin`=%d, \
  2263. `Weapons0`=%d, \
  2264. `Weapons1`=%d, \
  2265. `Weapons2`=%d, \
  2266. `Weapons3`=%d, \
  2267. `Weapons4`=%d, \
  2268. `GLUpgrade`=%d, \
  2269. `CustomInterior`=%d, \
  2270. `CustomExterior`=%d, \
  2271. `ExteriorA`=%f, \
  2272. `InteriorA`=%f, \
  2273. `MailX`=%f, \
  2274. `MailY`=%f, \
  2275. `MailZ`=%f, \
  2276. `MailA`=%f, \
  2277. `MailType`=%d, \
  2278. `ClosetX`=%f, \
  2279. `ClosetY`=%f, \
  2280. `ClosetZ`=%f WHERE `id`=%d",
  2281. string,
  2282. HouseInfo[houseid][hLock],
  2283. HouseInfo[houseid][hRentable],
  2284. HouseInfo[houseid][hRentFee],
  2285. HouseInfo[houseid][hValue],
  2286. HouseInfo[houseid][hSafeMoney],
  2287. HouseInfo[houseid][hPot],
  2288. HouseInfo[houseid][hCrack],
  2289. HouseInfo[houseid][hMaterials],
  2290. HouseInfo[houseid][hHeroin],
  2291. HouseInfo[houseid][hWeapons][0],
  2292. HouseInfo[houseid][hWeapons][1],
  2293. HouseInfo[houseid][hWeapons][2],
  2294. HouseInfo[houseid][hWeapons][3],
  2295. HouseInfo[houseid][hWeapons][4],
  2296. HouseInfo[houseid][hGLUpgrade],
  2297. HouseInfo[houseid][hCustomInterior],
  2298. HouseInfo[houseid][hCustomExterior],
  2299. HouseInfo[houseid][hExteriorA],
  2300. HouseInfo[houseid][hInteriorA],
  2301. HouseInfo[houseid][hMailX],
  2302. HouseInfo[houseid][hMailY],
  2303. HouseInfo[houseid][hMailZ],
  2304. HouseInfo[houseid][hMailA],
  2305. HouseInfo[houseid][hMailType],
  2306. HouseInfo[houseid][hClosetX],
  2307. HouseInfo[houseid][hClosetY],
  2308. HouseInfo[houseid][hClosetZ],
  2309. houseid+1
  2310. ); // Array starts from zero, MySQL starts at 1 (this is why we are adding one).
  2311.  
  2312. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  2313. }
  2314.  
  2315. stock LoadHouse(houseid)
  2316. {
  2317. new string[128];
  2318. printf("[LoadHouse] Loading HouseID %d's data from database...", houseid);
  2319. format(string, sizeof(string), "SELECT OwnerName.Username, h.* FROM houses h LEFT JOIN accounts OwnerName ON h.OwnerID = OwnerName.id WHERE `id` = %d", houseid+1); // Array starts at zero, MySQL starts at one.
  2320. mysql_function_query(MainPipeline, string, true, "OnLoadHouse", "i", houseid);
  2321. }
  2322.  
  2323. stock LoadHouses()
  2324. {
  2325. printf("[LoadHouses] Loading data from database...");
  2326. mysql_function_query(MainPipeline, "SELECT OwnerName.Username, h.* FROM houses h LEFT JOIN accounts OwnerName ON h.OwnerID = OwnerName.id", true, "OnLoadHouses", "");
  2327. }
  2328.  
  2329. stock LoadMailboxes()
  2330. {
  2331. printf("[LoadMailboxes] Loading data from database...");
  2332. mysql_function_query(MainPipeline, "SELECT * FROM `mailboxes`", true, "OnLoadMailboxes", "");
  2333. }
  2334.  
  2335. stock LoadPoints()
  2336. {
  2337. printf("[LoadFamilyPoints] Loading Family Points from the database, please wait...");
  2338. mysql_function_query(MainPipeline, "SELECT * FROM `points`", true, "OnLoadPoints", "");
  2339. }
  2340.  
  2341. stock LoadHGBackpacks()
  2342. {
  2343. printf("[Loading Hunger Games] Loading Hunger Games Backpacks from the database, please wait...");
  2344. mysql_function_query(MainPipeline, "SELECT * FROM `hgbackpacks`", true, "OnLoadHGBackpacks", "");
  2345. }
  2346.  
  2347. stock SaveMailbox(id)
  2348. {
  2349. new string[512];
  2350.  
  2351. format(string, sizeof(string), "UPDATE `mailboxes` SET \
  2352. `VW`=%d, \
  2353. `Int`=%d, \
  2354. `Model`=%d, \
  2355. `PosX`=%f, \
  2356. `PosY`=%f, \
  2357. `PosZ`=%f, \
  2358. `Angle`=%f WHERE `id`=%d",
  2359. MailBoxes[id][mbVW],
  2360. MailBoxes[id][mbInt],
  2361. MailBoxes[id][mbModel],
  2362. MailBoxes[id][mbPosX],
  2363. MailBoxes[id][mbPosY],
  2364. MailBoxes[id][mbPosZ],
  2365. MailBoxes[id][mbAngle],
  2366. id+1
  2367. ); // Array starts from zero, MySQL starts at 1 (this is why we are adding one).
  2368.  
  2369. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  2370. }
  2371.  
  2372. stock SaveSpeedCamera(i)
  2373. {
  2374. if (SpeedCameras[i][_scActive] != true)
  2375. return;
  2376.  
  2377. new query[1024];
  2378. format(query, sizeof(query), "UPDATE speed_cameras SET pos_x=%f, pos_y=%f, pos_z=%f, rotation=%f, `range`=%f, speed_limit=%f WHERE id=%i",
  2379. SpeedCameras[i][_scPosX], SpeedCameras[i][_scPosY], SpeedCameras[i][_scPosZ], SpeedCameras[i][_scRotation], SpeedCameras[i][_scRange], SpeedCameras[i][_scLimit],
  2380. SpeedCameras[i][_scDatabase]);
  2381.  
  2382. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  2383. }
  2384.  
  2385. stock LoadSpeedCameras()
  2386. {
  2387. printf("[SpeedCameras] Loading data from database...");
  2388. mysql_function_query(MainPipeline, "SELECT * FROM speed_cameras", true, "OnLoadSpeedCameras", "");
  2389.  
  2390. return 1;
  2391. }
  2392.  
  2393. stock StoreNewSpeedCameraInMySQL(index)
  2394. {
  2395. new string[512];
  2396. format(string, sizeof(string), "INSERT INTO speed_cameras (pos_x, pos_y, pos_z, rotation, `range`, speed_limit) VALUES (%f, %f, %f, %f, %f, %f)",
  2397. SpeedCameras[index][_scPosX], SpeedCameras[index][_scPosY], SpeedCameras[index][_scPosZ], SpeedCameras[index][_scRotation], SpeedCameras[index][_scRange], SpeedCameras[index][_scLimit]);
  2398.  
  2399. mysql_function_query(MainPipeline, string, true, "OnNewSpeedCamera", "i", index);
  2400. return 1;
  2401. }
  2402.  
  2403. stock SaveTxtLabel(labelid)
  2404. {
  2405. new string[1024];
  2406. format(string, sizeof(string), "UPDATE `text_labels` SET \
  2407. `Text`='%s', \
  2408. `PosX`=%f, \
  2409. `PosY`=%f, \
  2410. `PosZ`=%f, \
  2411. `VW`=%d, \
  2412. `Int`=%d, \
  2413. `Color`=%d, \
  2414. `PickupModel`=%d WHERE `id`=%d",
  2415. g_mysql_ReturnEscaped(TxtLabels[labelid][tlText], MainPipeline),
  2416. TxtLabels[labelid][tlPosX],
  2417. TxtLabels[labelid][tlPosY],
  2418. TxtLabels[labelid][tlPosZ],
  2419. TxtLabels[labelid][tlVW],
  2420. TxtLabels[labelid][tlInt],
  2421. TxtLabels[labelid][tlColor],
  2422. TxtLabels[labelid][tlPickupModel],
  2423. labelid+1
  2424. ); // Array starts from zero, MySQL starts at 1 (this is why we are adding one).
  2425.  
  2426. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  2427. }
  2428.  
  2429. stock LoadTxtLabel(labelid)
  2430. {
  2431. new string[128];
  2432. format(string, sizeof(string), "SELECT * FROM `text_labels` WHERE `id`=%d", labelid+1); // Array starts at zero, MySQL starts at 1.
  2433. mysql_function_query(MainPipeline, string, true, "OnLoadTxtLabel", "i", labelid);
  2434. }
  2435.  
  2436. stock LoadTxtLabels()
  2437. {
  2438. printf("[LoadTxtLabels] Loading data from database...");
  2439. mysql_function_query(MainPipeline, "SELECT * FROM `text_labels`", true, "OnLoadTxtLabels", "");
  2440. }
  2441.  
  2442. stock SavePayNSpray(id)
  2443. {
  2444. new string[1024];
  2445. format(string, sizeof(string), "UPDATE `paynsprays` SET \
  2446. `Status`=%d, \
  2447. `PosX`=%f, \
  2448. `PosY`=%f, \
  2449. `PosZ`=%f, \
  2450. `VW`=%d, \
  2451. `Int`=%d, \
  2452. `GroupCost`=%d, \
  2453. `RegCost`=%d WHERE `id`=%d",
  2454. PayNSprays[id][pnsStatus],
  2455. PayNSprays[id][pnsPosX],
  2456. PayNSprays[id][pnsPosY],
  2457. PayNSprays[id][pnsPosZ],
  2458. PayNSprays[id][pnsVW],
  2459. PayNSprays[id][pnsInt],
  2460. PayNSprays[id][pnsGroupCost],
  2461. PayNSprays[id][pnsRegCost],
  2462. id
  2463. );
  2464.  
  2465. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  2466. }
  2467.  
  2468. stock SavePayNSprays()
  2469. {
  2470. for(new i = 0; i < MAX_PAYNSPRAYS; i++)
  2471. {
  2472. SavePayNSpray(i);
  2473. }
  2474. return 1;
  2475. }
  2476.  
  2477. stock RehashPayNSpray(id)
  2478. {
  2479. DestroyDynamicPickup(PayNSprays[id][pnsPickupID]);
  2480. DestroyDynamic3DTextLabel(PayNSprays[id][pnsTextID]);
  2481. DestroyDynamicMapIcon(PayNSprays[id][pnsMapIconID]);
  2482. PayNSprays[id][pnsSQLId] = -1;
  2483. PayNSprays[id][pnsStatus] = 0;
  2484. PayNSprays[id][pnsPosX] = 0.0;
  2485. PayNSprays[id][pnsPosY] = 0.0;
  2486. PayNSprays[id][pnsPosZ] = 0.0;
  2487. PayNSprays[id][pnsVW] = 0;
  2488. PayNSprays[id][pnsInt] = 0;
  2489. PayNSprays[id][pnsGroupCost] = 0;
  2490. PayNSprays[id][pnsRegCost] = 0;
  2491. LoadPayNSpray(id);
  2492. }
  2493.  
  2494. stock RehashPayNSprays()
  2495. {
  2496. printf("[RehashPayNSprays] Deleting Pay N' Sprays from server...");
  2497. for(new i = 0; i < MAX_PAYNSPRAYS; i++)
  2498. {
  2499. RehashPayNSpray(i);
  2500. }
  2501. LoadPayNSprays();
  2502. }
  2503.  
  2504. stock LoadPayNSpray(id)
  2505. {
  2506. new string[128];
  2507. format(string, sizeof(string), "SELECT * FROM `paynsprays` WHERE `id`=%d", id);
  2508. mysql_function_query(MainPipeline, string, true, "OnLoadPayNSprays", "i", id);
  2509. }
  2510.  
  2511. stock IsAdminSpawnedVehicle(vehicleid)
  2512. {
  2513. for(new i = 0; i < sizeof(CreatedCars); ++i) {
  2514. if(CreatedCars[i] == vehicleid) return 1;
  2515. }
  2516. return 0;
  2517. }
  2518.  
  2519. forward OnLoadPayNSpray(index);
  2520. public OnLoadPayNSpray(index)
  2521. {
  2522. new rows, fields, tmp[128], string[128];
  2523. cache_get_data(rows, fields, MainPipeline);
  2524.  
  2525. for(new row; row < rows; row++)
  2526. {
  2527. cache_get_field_content(row, "id", tmp, MainPipeline); PayNSprays[index][pnsSQLId] = strval(tmp);
  2528. cache_get_field_content(row, "Status", tmp, MainPipeline); PayNSprays[index][pnsStatus] = strval(tmp);
  2529. cache_get_field_content(row, "PosX", tmp, MainPipeline); PayNSprays[index][pnsPosX] = floatstr(tmp);
  2530. cache_get_field_content(row, "PosY", tmp, MainPipeline); PayNSprays[index][pnsPosY] = floatstr(tmp);
  2531. cache_get_field_content(row, "PosZ", tmp, MainPipeline); PayNSprays[index][pnsPosZ] = floatstr(tmp);
  2532. cache_get_field_content(row, "VW", tmp, MainPipeline); PayNSprays[index][pnsVW] = strval(tmp);
  2533. cache_get_field_content(row, "Int", tmp, MainPipeline); PayNSprays[index][pnsInt] = strval(tmp);
  2534. cache_get_field_content(row, "GroupCost", tmp, MainPipeline); PayNSprays[index][pnsGroupCost] = strval(tmp);
  2535. cache_get_field_content(row, "RegCost", tmp, MainPipeline); PayNSprays[index][pnsRegCost] = strval(tmp);
  2536. if(PayNSprays[index][pnsStatus] > 0)
  2537. {
  2538. format(string, sizeof(string), "/repaircar\nRepair Cost -- Regular: $%s | Faction: $%s\nID: %d", number_format(PayNSprays[index][pnsRegCost]), number_format(PayNSprays[index][pnsGroupCost]), index);
  2539. PayNSprays[index][pnsTextID] = CreateDynamic3DTextLabel(string, COLOR_RED, PayNSprays[index][pnsPosX], PayNSprays[index][pnsPosY], PayNSprays[index][pnsPosZ]+0.5,10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, PayNSprays[index][pnsVW], PayNSprays[index][pnsInt], -1);
  2540. PayNSprays[index][pnsPickupID] = CreateDynamicPickup(1239, 23, PayNSprays[index][pnsPosX], PayNSprays[index][pnsPosY], PayNSprays[index][pnsPosZ], PayNSprays[index][pnsVW]);
  2541. PayNSprays[index][pnsMapIconID] = CreateDynamicMapIcon(PayNSprays[index][pnsPosX], PayNSprays[index][pnsPosY], PayNSprays[index][pnsPosZ], 63, 0, PayNSprays[index][pnsVW], PayNSprays[index][pnsInt], -1, 500.0);
  2542. }
  2543. }
  2544. return 1;
  2545. }
  2546.  
  2547. stock LoadPayNSprays()
  2548. {
  2549. printf("[LoadPayNSprays] Loading data from database...");
  2550. mysql_function_query(MainPipeline, "SELECT * FROM `paynsprays`", true, "OnLoadPayNSprays", "");
  2551. }
  2552.  
  2553. stock SaveArrestPoint(id)
  2554. {
  2555. new string[1024];
  2556. format(string, sizeof(string), "UPDATE `arrestpoints` SET \
  2557. `PosX`=%f, \
  2558. `PosY`=%f, \
  2559. `PosZ`=%f, \
  2560. `VW`=%d, \
  2561. `Int`=%d, \
  2562. `Type`=%d WHERE `id`=%d",
  2563. ArrestPoints[id][arrestPosX],
  2564. ArrestPoints[id][arrestPosY],
  2565. ArrestPoints[id][arrestPosZ],
  2566. ArrestPoints[id][arrestVW],
  2567. ArrestPoints[id][arrestInt],
  2568. ArrestPoints[id][arrestType],
  2569. id
  2570. );
  2571.  
  2572. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  2573. }
  2574.  
  2575. stock SaveArrestPoints()
  2576. {
  2577. for(new i = 0; i < MAX_ARRESTPOINTS; i++)
  2578. {
  2579. SaveArrestPoint(i);
  2580. }
  2581. return 1;
  2582. }
  2583.  
  2584. stock RehashArrestPoint(id)
  2585. {
  2586. DestroyDynamic3DTextLabel(ArrestPoints[id][arrestTextID]);
  2587. DestroyDynamicPickup(ArrestPoints[id][arrestPickupID]);
  2588. ArrestPoints[id][arrestSQLId] = -1;
  2589. ArrestPoints[id][arrestPosX] = 0.0;
  2590. ArrestPoints[id][arrestPosY] = 0.0;
  2591. ArrestPoints[id][arrestPosZ] = 0.0;
  2592. ArrestPoints[id][arrestVW] = 0;
  2593. ArrestPoints[id][arrestInt] = 0;
  2594. ArrestPoints[id][arrestType] = 0;
  2595. LoadArrestPoint(id);
  2596. }
  2597.  
  2598. stock RehashArrestPoints()
  2599. {
  2600. printf("[RehashArrestPoints] Deleting Arrest Points from server...");
  2601. for(new i = 0; i < MAX_ARRESTPOINTS; i++)
  2602. {
  2603. RehashArrestPoint(i);
  2604. }
  2605. LoadArrestPoints();
  2606. }
  2607.  
  2608. stock LoadArrestPoint(id)
  2609. {
  2610. new string[128];
  2611. format(string, sizeof(string), "SELECT * FROM `arrestpoints` WHERE `id`=%d", id);
  2612. mysql_function_query(MainPipeline, string, true, "OnLoadArrestPoints", "i", id);
  2613. }
  2614.  
  2615. stock LoadArrestPoints()
  2616. {
  2617. printf("[LoadArrestPoints] Loading data from database...");
  2618. mysql_function_query(MainPipeline, "SELECT * FROM `arrestpoints`", true, "OnLoadArrestPoints", "");
  2619. }
  2620.  
  2621. stock SaveImpoundPoint(id)
  2622. {
  2623. new string[1024];
  2624. format(string, sizeof(string), "UPDATE `impoundpoints` SET \
  2625. `PosX`=%f, \
  2626. `PosY`=%f, \
  2627. `PosZ`=%f, \
  2628. `VW`=%d, \
  2629. `Int`=%d WHERE `id`=%d",
  2630. ImpoundPoints[id][impoundPosX],
  2631. ImpoundPoints[id][impoundPosY],
  2632. ImpoundPoints[id][impoundPosZ],
  2633. ImpoundPoints[id][impoundVW],
  2634. ImpoundPoints[id][impoundInt],
  2635. id
  2636. );
  2637.  
  2638. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  2639. }
  2640.  
  2641. stock SaveImpoundPoints()
  2642. {
  2643. for(new i = 0; i < MAX_ImpoundPoints; i++)
  2644. {
  2645. SaveImpoundPoint(i);
  2646. }
  2647. return 1;
  2648. }
  2649.  
  2650. stock RehashImpoundPoint(id)
  2651. {
  2652. DestroyDynamic3DTextLabel(ImpoundPoints[id][impoundTextID]);
  2653. ImpoundPoints[id][impoundSQLId] = -1;
  2654. ImpoundPoints[id][impoundPosX] = 0.0;
  2655. ImpoundPoints[id][impoundPosY] = 0.0;
  2656. ImpoundPoints[id][impoundPosZ] = 0.0;
  2657. ImpoundPoints[id][impoundVW] = 0;
  2658. ImpoundPoints[id][impoundInt] = 0;
  2659. LoadImpoundPoint(id);
  2660. }
  2661.  
  2662. stock RehashImpoundPoints()
  2663. {
  2664. printf("[RehashImpoundPoints] Deleting impound Points from server...");
  2665. for(new i = 0; i < MAX_ImpoundPoints; i++)
  2666. {
  2667. RehashImpoundPoint(i);
  2668. }
  2669. LoadImpoundPoints();
  2670. }
  2671.  
  2672. stock LoadImpoundPoint(id)
  2673. {
  2674. new string[128];
  2675. format(string, sizeof(string), "SELECT * FROM `impoundpoints` WHERE `id`=%d", id);
  2676. mysql_function_query(MainPipeline, string, true, "OnLoadImpoundPoints", "i", id);
  2677. }
  2678.  
  2679. stock LoadImpoundPoints()
  2680. {
  2681. printf("[LoadImpoundPoints] Loading data from database...");
  2682. mysql_function_query(MainPipeline, "SELECT * FROM `impoundpoints`", true, "OnLoadImpoundPoints", "");
  2683. }
  2684.  
  2685. // credits to Luk0r
  2686. stock MySQLUpdateBuild(query[], sqlplayerid)
  2687. {
  2688. new querylen = strlen(query);
  2689. if (!query[0]) {
  2690. format(query, 2048, "UPDATE `accounts` SET ");
  2691. }
  2692. else if (2048-querylen < 200)
  2693. {
  2694. new whereclause[32];
  2695. format(whereclause, sizeof(whereclause), " WHERE `id`=%d", sqlplayerid);
  2696. strcat(query, whereclause, 2048);
  2697. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  2698. format(query, 2048, "UPDATE `accounts` SET ");
  2699. }
  2700. else if (strfind(query, "=", true) != -1) strcat(query, ",", 2048);
  2701. return 1;
  2702. }
  2703.  
  2704. stock MySQLUpdateFinish(query[], sqlplayerid)
  2705. {
  2706. if (strcmp(query, "WHERE id=", false) == 0) mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  2707. else
  2708. {
  2709. new whereclause[32];
  2710. format(whereclause, sizeof(whereclause), " WHERE id=%d", sqlplayerid);
  2711. strcat(query, whereclause, 2048);
  2712. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  2713. format(query, 2048, "UPDATE `accounts` SET ");
  2714. }
  2715. return 1;
  2716. }
  2717.  
  2718. stock SavePlayerInteger(query[], sqlid, Value[], Integer)
  2719. {
  2720. MySQLUpdateBuild(query, sqlid);
  2721. new updval[64];
  2722. format(updval, sizeof(updval), "`%s`=%d", Value, Integer);
  2723. strcat(query, updval, 2048);
  2724. return 1;
  2725. }
  2726.  
  2727.  
  2728. stock SavePlayerString(query[], sqlid, Value[], String[])
  2729. {
  2730. MySQLUpdateBuild(query, sqlid);
  2731. new escapedstring[160], string[160];
  2732. mysql_real_escape_string(String, escapedstring);
  2733. format(string, sizeof(string), "`%s`='%s'", Value, escapedstring);
  2734. strcat(query, string, 2048);
  2735. return 1;
  2736. }
  2737.  
  2738. stock SavePlayerFloat(query[], sqlid, Value[], Float:Number)
  2739. {
  2740. new flotostr[32];
  2741. format(flotostr, sizeof(flotostr), "%0.2f", Number);
  2742. SavePlayerString(query, sqlid, Value, flotostr);
  2743. return 1;
  2744. }
  2745.  
  2746. stock g_mysql_SaveAccount(playerid)
  2747. {
  2748. new query[2048];
  2749.  
  2750. format(query, 2048, "UPDATE `accounts` SET `SPos_x` = '%0.2f', `SPos_y` = '%0.2f', `SPos_z` = '%0.2f', `SPos_r` = '%0.2f' WHERE id = '%d'",PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z], PlayerInfo[playerid][pPos_r], GetPlayerSQLId(playerid));
  2751. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  2752.  
  2753. format(query, 2048, "UPDATE `accounts` SET ");
  2754. SavePlayerString(query, GetPlayerSQLId(playerid), "IP", PlayerInfo[playerid][pIP]);
  2755. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Registered", PlayerInfo[playerid][pReg]);
  2756. SavePlayerInteger(query, GetPlayerSQLId(playerid), "ConnectedTime", PlayerInfo[playerid][pConnectHours]);
  2757. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Sex", PlayerInfo[playerid][pSex]);
  2758. SavePlayerString(query, GetPlayerSQLId(playerid), "BirthDate", PlayerInfo[playerid][pBirthDate]);
  2759. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Band", PlayerInfo[playerid][pBanned]);
  2760. SavePlayerInteger(query, GetPlayerSQLId(playerid), "PermBand", PlayerInfo[playerid][pPermaBanned]);
  2761. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Warnings", PlayerInfo[playerid][pWarns]);
  2762. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Disabled", PlayerInfo[playerid][pDisabled]);
  2763. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Level", PlayerInfo[playerid][pLevel]);
  2764. SavePlayerInteger(query, GetPlayerSQLId(playerid), "AdminLevel", PlayerInfo[playerid][pAdmin]);
  2765. SavePlayerInteger(query, GetPlayerSQLId(playerid), "SeniorModerator", PlayerInfo[playerid][pSMod]);
  2766. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Helper", PlayerInfo[playerid][pHelper]);
  2767. SavePlayerInteger(query, GetPlayerSQLId(playerid), "DonateRank", PlayerInfo[playerid][pDonateRank]);
  2768. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Respect", PlayerInfo[playerid][pExp]);
  2769. SavePlayerInteger(query, GetPlayerSQLId(playerid), "XP", PlayerInfo[playerid][pXP]);
  2770. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Money", GetPlayerCash(playerid));
  2771.  
  2772. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Bank", PlayerInfo[playerid][pAccount]);
  2773. SavePlayerFloat(query, GetPlayerSQLId(playerid), "pHealth", PlayerInfo[playerid][pHealth]);
  2774. SavePlayerFloat(query, GetPlayerSQLId(playerid), "pArmor", PlayerInfo[playerid][pArmor]);
  2775. SavePlayerFloat(query, GetPlayerSQLId(playerid), "pSHealth", PlayerInfo[playerid][pSHealth]);
  2776. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Int", PlayerInfo[playerid][pInt]);
  2777. SavePlayerInteger(query, GetPlayerSQLId(playerid), "VirtualWorld", PlayerInfo[playerid][pVW]);
  2778. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Model", PlayerInfo[playerid][pModel]);
  2779. SavePlayerInteger(query, GetPlayerSQLId(playerid), "BanAppealer", PlayerInfo[playerid][pBanAppealer]);
  2780. SavePlayerInteger(query, GetPlayerSQLId(playerid), "PR", PlayerInfo[playerid][pPR]);
  2781. SavePlayerInteger(query, GetPlayerSQLId(playerid), "HR", PlayerInfo[playerid][pHR]);
  2782. SavePlayerInteger(query, GetPlayerSQLId(playerid), "AP", PlayerInfo[playerid][pAP]);
  2783. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Security", PlayerInfo[playerid][pSecurity]);
  2784. SavePlayerInteger(query, GetPlayerSQLId(playerid), "ShopTech", PlayerInfo[playerid][pShopTech]);
  2785. SavePlayerInteger(query, GetPlayerSQLId(playerid), "FactionModerator", PlayerInfo[playerid][pFactionModerator]);
  2786. SavePlayerInteger(query, GetPlayerSQLId(playerid), "GangModerator", PlayerInfo[playerid][pGangModerator]);
  2787. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Undercover", PlayerInfo[playerid][pUndercover]);
  2788.  
  2789. SavePlayerInteger(query, GetPlayerSQLId(playerid), "TogReports", PlayerInfo[playerid][pTogReports]);
  2790. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Radio", PlayerInfo[playerid][pRadio]);
  2791. SavePlayerInteger(query, GetPlayerSQLId(playerid), "RadioFreq", PlayerInfo[playerid][pRadioFreq]);
  2792. SavePlayerInteger(query, GetPlayerSQLId(playerid), "UpgradePoints", PlayerInfo[playerid][gPupgrade]);
  2793. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Origin", PlayerInfo[playerid][pOrigin]);
  2794. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Muted", PlayerInfo[playerid][pMuted]);
  2795. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Crimes", PlayerInfo[playerid][pCrimes]);
  2796. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Accent", PlayerInfo[playerid][pAccent]);
  2797. SavePlayerInteger(query, GetPlayerSQLId(playerid), "CHits", PlayerInfo[playerid][pCHits]);
  2798. SavePlayerInteger(query, GetPlayerSQLId(playerid), "FHits", PlayerInfo[playerid][pFHits]);
  2799. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Arrested", PlayerInfo[playerid][pArrested]);
  2800. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Phonebook", PlayerInfo[playerid][pPhoneBook]);
  2801. SavePlayerInteger(query, GetPlayerSQLId(playerid), "LottoNr", PlayerInfo[playerid][pLottoNr]);
  2802. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Fishes", PlayerInfo[playerid][pFishes]);
  2803. SavePlayerInteger(query, GetPlayerSQLId(playerid), "BiggestFish", PlayerInfo[playerid][pBiggestFish]);
  2804. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Job", PlayerInfo[playerid][pJob]);
  2805.  
  2806. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Job2", PlayerInfo[playerid][pJob2]);
  2807. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Paycheck", PlayerInfo[playerid][pPayCheck]);
  2808. SavePlayerInteger(query, GetPlayerSQLId(playerid), "HeadValue", PlayerInfo[playerid][pHeadValue]);
  2809. SavePlayerInteger(query, GetPlayerSQLId(playerid), "JailTime", PlayerInfo[playerid][pJailTime]);
  2810. SavePlayerInteger(query, GetPlayerSQLId(playerid), "WRestricted", PlayerInfo[playerid][pWRestricted]);
  2811. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Materials", PlayerInfo[playerid][pMats]);
  2812. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Crates", PlayerInfo[playerid][pCrates]);
  2813. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Pot", PlayerInfo[playerid][pPot]);
  2814. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Crack", PlayerInfo[playerid][pCrack]);
  2815. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Nation", PlayerInfo[playerid][pNation]);
  2816. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Leader", PlayerInfo[playerid][pLeader]);
  2817. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Member", PlayerInfo[playerid][pMember]);
  2818. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Division", PlayerInfo[playerid][pDivision]);
  2819. SavePlayerInteger(query, GetPlayerSQLId(playerid), "FMember", PlayerInfo[playerid][pFMember]);
  2820.  
  2821. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Rank", PlayerInfo[playerid][pRank]);
  2822. SavePlayerInteger(query, GetPlayerSQLId(playerid), "DetSkill", PlayerInfo[playerid][pDetSkill]);
  2823. SavePlayerInteger(query, GetPlayerSQLId(playerid), "SexSkill", PlayerInfo[playerid][pSexSkill]);
  2824. SavePlayerInteger(query, GetPlayerSQLId(playerid), "BoxSkill", PlayerInfo[playerid][pBoxSkill]);
  2825. SavePlayerInteger(query, GetPlayerSQLId(playerid), "LawSkill", PlayerInfo[playerid][pLawSkill]);
  2826. SavePlayerInteger(query, GetPlayerSQLId(playerid), "MechSkill", PlayerInfo[playerid][pMechSkill]);
  2827. SavePlayerInteger(query, GetPlayerSQLId(playerid), "TruckSkill", PlayerInfo[playerid][pTruckSkill]);
  2828. SavePlayerInteger(query, GetPlayerSQLId(playerid), "DrugsSkill", PlayerInfo[playerid][pDrugsSkill]);
  2829. SavePlayerInteger(query, GetPlayerSQLId(playerid), "ArmsSkill", PlayerInfo[playerid][pArmsSkill]);
  2830. SavePlayerInteger(query, GetPlayerSQLId(playerid), "SmugglerSkill", PlayerInfo[playerid][pSmugSkill]);
  2831. SavePlayerInteger(query, GetPlayerSQLId(playerid), "FishSkill", PlayerInfo[playerid][pFishSkill]);
  2832. SavePlayerInteger(query, GetPlayerSQLId(playerid), "CheckCash", PlayerInfo[playerid][pCheckCash]);
  2833.  
  2834. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Checks", PlayerInfo[playerid][pChecks]);
  2835. SavePlayerInteger(query, GetPlayerSQLId(playerid), "BoatLic", PlayerInfo[playerid][pBoatLic]);
  2836. SavePlayerInteger(query, GetPlayerSQLId(playerid), "FlyLic", PlayerInfo[playerid][pFlyLic]);
  2837. SavePlayerInteger(query, GetPlayerSQLId(playerid), "GunLic", PlayerInfo[playerid][pGunLic]);
  2838. SavePlayerInteger(query, GetPlayerSQLId(playerid), "FishLic", PlayerInfo[playerid][pFishLic]);
  2839. SavePlayerInteger(query, GetPlayerSQLId(playerid), "FishSkill", PlayerInfo[playerid][pFishSkill]);
  2840. SavePlayerInteger(query, GetPlayerSQLId(playerid), "FightingStyle", PlayerInfo[playerid][pFightStyle]);
  2841. SavePlayerInteger(query, GetPlayerSQLId(playerid), "PhoneNr", PlayerInfo[playerid][pPnumber]);
  2842. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Apartment", PlayerInfo[playerid][pPhousekey]);
  2843. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Apartment2", PlayerInfo[playerid][pPhousekey2]);
  2844. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Renting", PlayerInfo[playerid][pRenting]);
  2845. SavePlayerInteger(query, GetPlayerSQLId(playerid), "CarLic", PlayerInfo[playerid][pCarLic]);
  2846.  
  2847. SavePlayerInteger(query, GetPlayerSQLId(playerid), "DrugsTime", PlayerInfo[playerid][pDrugsTime]);
  2848. SavePlayerInteger(query, GetPlayerSQLId(playerid), "LawyerTime", PlayerInfo[playerid][pLawyerTime]);
  2849. SavePlayerInteger(query, GetPlayerSQLId(playerid), "LawyerFreeTime", PlayerInfo[playerid][pLawyerFreeTime]);
  2850. SavePlayerInteger(query, GetPlayerSQLId(playerid), "MechTime", PlayerInfo[playerid][pMechTime]);
  2851. SavePlayerInteger(query, GetPlayerSQLId(playerid), "SexTime", PlayerInfo[playerid][pSexTime]);
  2852. SavePlayerInteger(query, GetPlayerSQLId(playerid), "PayDay", PlayerInfo[playerid][pConnectSeconds]);
  2853. SavePlayerInteger(query, GetPlayerSQLId(playerid), "PayDayHad", PlayerInfo[playerid][pPayDayHad]);
  2854. SavePlayerInteger(query, GetPlayerSQLId(playerid), "CDPlayer", PlayerInfo[playerid][pCDPlayer]);
  2855. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Dice", PlayerInfo[playerid][pDice]);
  2856. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Spraycan", PlayerInfo[playerid][pSpraycan]);
  2857. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Rope", PlayerInfo[playerid][pRope]);
  2858. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Cigars", PlayerInfo[playerid][pCigar]);
  2859. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Sprunk", PlayerInfo[playerid][pSprunk]);
  2860. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Bombs", PlayerInfo[playerid][pBombs]);
  2861. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Wins", PlayerInfo[playerid][pWins]);
  2862.  
  2863. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Gun0", PlayerInfo[playerid][pGuns][0]);
  2864. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Gun1", PlayerInfo[playerid][pGuns][1]);
  2865. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Gun2", PlayerInfo[playerid][pGuns][2]);
  2866. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Gun3", PlayerInfo[playerid][pGuns][3]);
  2867. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Gun4", PlayerInfo[playerid][pGuns][4]);
  2868. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Gun5", PlayerInfo[playerid][pGuns][5]);
  2869. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Gun6", PlayerInfo[playerid][pGuns][6]);
  2870. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Gun7", PlayerInfo[playerid][pGuns][7]);
  2871. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Gun8", PlayerInfo[playerid][pGuns][8]);
  2872. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Gun9", PlayerInfo[playerid][pGuns][9]);
  2873. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Gun10", PlayerInfo[playerid][pGuns][10]);
  2874. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Gun11", PlayerInfo[playerid][pGuns][11]);
  2875.  
  2876. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Loses", PlayerInfo[playerid][pLoses]);
  2877. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Tutorial", PlayerInfo[playerid][pTut]);
  2878. SavePlayerInteger(query, GetPlayerSQLId(playerid), "OnDuty", PlayerInfo[playerid][pDuty]);
  2879. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Hospital", PlayerInfo[playerid][pHospital]);
  2880. SavePlayerInteger(query, GetPlayerSQLId(playerid), "MarriedID", PlayerInfo[playerid][pMarriedID]);
  2881. SavePlayerString(query, GetPlayerSQLId(playerid), "ContractBy", PlayerInfo[playerid][pContractBy]);
  2882. SavePlayerString(query, GetPlayerSQLId(playerid), "ContractDetail", PlayerInfo[playerid][pContractDetail]);
  2883. SavePlayerInteger(query, GetPlayerSQLId(playerid), "WantedLevel", PlayerInfo[playerid][pWantedLevel]);
  2884. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Insurance", PlayerInfo[playerid][pInsurance]);
  2885. SavePlayerInteger(query, GetPlayerSQLId(playerid), "911Muted", PlayerInfo[playerid][p911Muted]);
  2886. SavePlayerInteger(query, GetPlayerSQLId(playerid), "NewMuted", PlayerInfo[playerid][pNMute]);
  2887. SavePlayerInteger(query, GetPlayerSQLId(playerid), "NewMutedTotal", PlayerInfo[playerid][pNMuteTotal]);
  2888. SavePlayerInteger(query, GetPlayerSQLId(playerid), "AdMuted", PlayerInfo[playerid][pADMute]);
  2889. SavePlayerInteger(query, GetPlayerSQLId(playerid), "AdMutedTotal", PlayerInfo[playerid][pADMuteTotal]);
  2890.  
  2891. SavePlayerInteger(query, GetPlayerSQLId(playerid), "HelpMute", PlayerInfo[playerid][pHelpMute]);
  2892. SavePlayerInteger(query, GetPlayerSQLId(playerid), "ReportMuted", PlayerInfo[playerid][pRMuted]);
  2893. SavePlayerInteger(query, GetPlayerSQLId(playerid), "ReportMutedTotal", PlayerInfo[playerid][pRMutedTotal]);
  2894. SavePlayerInteger(query, GetPlayerSQLId(playerid), "ReportMutedTime", PlayerInfo[playerid][pRMutedTime]);
  2895. SavePlayerInteger(query, GetPlayerSQLId(playerid), "DMRMuted", PlayerInfo[playerid][pDMRMuted]);
  2896. SavePlayerInteger(query, GetPlayerSQLId(playerid), "VIPMuted", PlayerInfo[playerid][pVMuted]);
  2897. SavePlayerInteger(query, GetPlayerSQLId(playerid), "VIPMutedTime", PlayerInfo[playerid][pVMutedTime]);
  2898. SavePlayerInteger(query, GetPlayerSQLId(playerid), "GiftTime", PlayerInfo[playerid][pGiftTime]);
  2899. SavePlayerInteger(query, GetPlayerSQLId(playerid), "AdvisorDutyHours", PlayerInfo[playerid][pDutyHours]);
  2900. SavePlayerInteger(query, GetPlayerSQLId(playerid), "AcceptedHelp", PlayerInfo[playerid][pAcceptedHelp]);
  2901. SavePlayerInteger(query, GetPlayerSQLId(playerid), "AcceptReport", PlayerInfo[playerid][pAcceptReport]);
  2902. SavePlayerInteger(query, GetPlayerSQLId(playerid), "TrashReport", PlayerInfo[playerid][pTrashReport]);
  2903. SavePlayerInteger(query, GetPlayerSQLId(playerid), "GangWarn", PlayerInfo[playerid][pGangWarn]);
  2904.  
  2905. SavePlayerInteger(query, GetPlayerSQLId(playerid), "CSFBanned", PlayerInfo[playerid][pCSFBanned]);
  2906. SavePlayerInteger(query, GetPlayerSQLId(playerid), "VIPInviteDay", PlayerInfo[playerid][pVIPInviteDay]);
  2907. SavePlayerInteger(query, GetPlayerSQLId(playerid), "TempVIP", PlayerInfo[playerid][pTempVIP]);
  2908. SavePlayerInteger(query, GetPlayerSQLId(playerid), "BuddyInvite", PlayerInfo[playerid][pBuddyInvited]);
  2909. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Tokens", PlayerInfo[playerid][pTokens]);
  2910. SavePlayerInteger(query, GetPlayerSQLId(playerid), "PTokens", PlayerInfo[playerid][pPaintTokens]);
  2911. SavePlayerInteger(query, GetPlayerSQLId(playerid), "TriageTime", PlayerInfo[playerid][pTriageTime]);
  2912. SavePlayerString(query, GetPlayerSQLId(playerid), "PrisonedBy", PlayerInfo[playerid][pPrisonedBy]);
  2913. SavePlayerString(query, GetPlayerSQLId(playerid), "PrisonReason", PlayerInfo[playerid][pPrisonReason]);
  2914. SavePlayerInteger(query, GetPlayerSQLId(playerid), "TaxiLicense", PlayerInfo[playerid][pTaxiLicense]);
  2915. SavePlayerInteger(query, GetPlayerSQLId(playerid), "TicketTime", PlayerInfo[playerid][pTicketTime]);
  2916. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Screwdriver", PlayerInfo[playerid][pScrewdriver]);
  2917. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Smslog", PlayerInfo[playerid][pSmslog]);
  2918. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Speedo", PlayerInfo[playerid][pSpeedo]);
  2919.  
  2920. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Wristwatch", PlayerInfo[playerid][pWristwatch]);
  2921. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Surveillance", PlayerInfo[playerid][pSurveillance]);
  2922. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Tire", PlayerInfo[playerid][pTire]);
  2923. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Firstaid", PlayerInfo[playerid][pFirstaid]);
  2924. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Rccam", PlayerInfo[playerid][pRccam]);
  2925. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Receiver", PlayerInfo[playerid][pReceiver]);
  2926. SavePlayerInteger(query, GetPlayerSQLId(playerid), "GPS", PlayerInfo[playerid][pGPS]);
  2927. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Sweep", PlayerInfo[playerid][pSweep]);
  2928. SavePlayerInteger(query, GetPlayerSQLId(playerid), "SweepLeft", PlayerInfo[playerid][pSweepLeft]);
  2929. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Bugged", PlayerInfo[playerid][pBugged]);
  2930.  
  2931. SavePlayerInteger(query, GetPlayerSQLId(playerid), "pWExists", PlayerInfo[playerid][pWeedObject]);
  2932. SavePlayerInteger(query, GetPlayerSQLId(playerid), "pWSeeds", PlayerInfo[playerid][pWSeeds]);
  2933. SavePlayerString(query, GetPlayerSQLId(playerid), "Warrants", PlayerInfo[playerid][pWarrant]);
  2934. SavePlayerInteger(query, GetPlayerSQLId(playerid), "JudgeJailTime", PlayerInfo[playerid][pJudgeJailTime]);
  2935. SavePlayerInteger(query, GetPlayerSQLId(playerid), "JudgeJailType", PlayerInfo[playerid][pJudgeJailType]);
  2936. SavePlayerInteger(query, GetPlayerSQLId(playerid), "BeingSentenced", PlayerInfo[playerid][pBeingSentenced]);
  2937. SavePlayerInteger(query, GetPlayerSQLId(playerid), "ProbationTime", PlayerInfo[playerid][pProbationTime]);
  2938. SavePlayerInteger(query, GetPlayerSQLId(playerid), "DMKills", PlayerInfo[playerid][pDMKills]);
  2939.  
  2940. SavePlayerInteger(query, GetPlayerSQLId(playerid), "OrderConfirmed", PlayerInfo[playerid][pOrderConfirmed]);
  2941. SavePlayerInteger(query, GetPlayerSQLId(playerid), "FreezeHouse", PlayerInfo[playerid][pFreezeHouse]);
  2942. SavePlayerInteger(query, GetPlayerSQLId(playerid), "FreezeCar", PlayerInfo[playerid][pFreezeCar]);
  2943. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Firework", PlayerInfo[playerid][pFirework]);
  2944. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Boombox", PlayerInfo[playerid][pBoombox]);
  2945. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Hydration", PlayerInfo[playerid][pHydration]);
  2946. SavePlayerInteger(query, GetPlayerSQLId(playerid), "DoubleEXP", PlayerInfo[playerid][pDoubleEXP]);
  2947. SavePlayerInteger(query, GetPlayerSQLId(playerid), "EXPToken", PlayerInfo[playerid][pEXPToken]);
  2948. SavePlayerInteger(query, GetPlayerSQLId(playerid), "RacePlayerLaps", PlayerInfo[playerid][pRacePlayerLaps]);
  2949. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Ringtone", PlayerInfo[playerid][pRingtone]);
  2950.  
  2951. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Order", PlayerInfo[playerid][pOrder]);
  2952. SavePlayerInteger(query, GetPlayerSQLId(playerid), "CallsAccepted", PlayerInfo[playerid][pCallsAccepted]);
  2953. SavePlayerInteger(query, GetPlayerSQLId(playerid), "PatientsDelivered", PlayerInfo[playerid][pPatientsDelivered]);
  2954. SavePlayerInteger(query, GetPlayerSQLId(playerid), "LiveBanned", PlayerInfo[playerid][pLiveBanned]);
  2955. SavePlayerInteger(query, GetPlayerSQLId(playerid), "FreezeBank", PlayerInfo[playerid][pFreezeBank]);
  2956. SavePlayerInteger(query, GetPlayerSQLId(playerid), "VIPM", PlayerInfo[playerid][pVIPM]);
  2957. SavePlayerInteger(query, GetPlayerSQLId(playerid), "VIPMO", PlayerInfo[playerid][pVIPMO]);
  2958. SavePlayerInteger(query, GetPlayerSQLId(playerid), "VIPExpire", PlayerInfo[playerid][pVIPExpire]);
  2959. SavePlayerInteger(query, GetPlayerSQLId(playerid), "GVip", PlayerInfo[playerid][pGVip]);
  2960. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Watchdog", PlayerInfo[playerid][pWatchdog]);
  2961. SavePlayerInteger(query, GetPlayerSQLId(playerid), "VIPSold", PlayerInfo[playerid][pVIPSold]);
  2962. SavePlayerInteger(query, GetPlayerSQLId(playerid), "GoldBoxTokens", PlayerInfo[playerid][pGoldBoxTokens]);
  2963. SavePlayerInteger(query, GetPlayerSQLId(playerid), "DrawChance", PlayerInfo[playerid][pRewardDrawChance]);
  2964. SavePlayerFloat(query, GetPlayerSQLId(playerid), "RewardHours", PlayerInfo[playerid][pRewardHours]);
  2965. SavePlayerInteger(query, GetPlayerSQLId(playerid), "CarsRestricted", PlayerInfo[playerid][pRVehRestricted]);
  2966. SavePlayerInteger(query, GetPlayerSQLId(playerid), "LastCarWarning", PlayerInfo[playerid][pLastRVehWarn]);
  2967. SavePlayerInteger(query, GetPlayerSQLId(playerid), "CarWarns", PlayerInfo[playerid][pRVehWarns]);
  2968. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Flagged", PlayerInfo[playerid][pFlagged]);
  2969.  
  2970. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Paper", PlayerInfo[playerid][pPaper]);
  2971. SavePlayerInteger(query, GetPlayerSQLId(playerid), "MailEnabled", PlayerInfo[playerid][pMailEnabled]);
  2972. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Mailbox", PlayerInfo[playerid][pMailbox]);
  2973. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Business", PlayerInfo[playerid][pBusiness]);
  2974. SavePlayerInteger(query, GetPlayerSQLId(playerid), "BusinessRank", PlayerInfo[playerid][pBusinessRank]);
  2975. SavePlayerInteger(query, GetPlayerSQLId(playerid), "TreasureSkill", PlayerInfo[playerid][pTreasureSkill]);
  2976. SavePlayerInteger(query, GetPlayerSQLId(playerid), "MetalDetector", PlayerInfo[playerid][pMetalDetector]);
  2977. SavePlayerInteger(query, GetPlayerSQLId(playerid), "HelpedBefore", PlayerInfo[playerid][pHelpedBefore]);
  2978. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Trickortreat", PlayerInfo[playerid][pTrickortreat]);
  2979. SavePlayerInteger(query, GetPlayerSQLId(playerid), "LastCharmReceived", PlayerInfo[playerid][pLastCharmReceived]);
  2980. SavePlayerInteger(query, GetPlayerSQLId(playerid), "RHMutes", PlayerInfo[playerid][pRHMutes]);
  2981. SavePlayerInteger(query, GetPlayerSQLId(playerid), "RHMuteTime", PlayerInfo[playerid][pRHMuteTime]);
  2982. SavePlayerInteger(query, GetPlayerSQLId(playerid), "GiftCode", PlayerInfo[playerid][pGiftCode]);
  2983. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Table", PlayerInfo[playerid][pTable]);
  2984. SavePlayerInteger(query, GetPlayerSQLId(playerid), "OpiumSeeds", PlayerInfo[playerid][pOpiumSeeds]);
  2985. SavePlayerInteger(query, GetPlayerSQLId(playerid), "RawOpium", PlayerInfo[playerid][pRawOpium]);
  2986. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Heroin", PlayerInfo[playerid][pHeroin]);
  2987. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Syringe", PlayerInfo[playerid][pSyringes]);
  2988. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Skins", PlayerInfo[playerid][pSkins]);
  2989. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Hunger", PlayerInfo[playerid][pHunger]);
  2990. SavePlayerInteger(query, GetPlayerSQLId(playerid), "HungerTimer", PlayerInfo[playerid][pHungerTimer]);
  2991. SavePlayerInteger(query, GetPlayerSQLId(playerid), "HungerDeathTimer", PlayerInfo[playerid][pHungerDeathTimer]);
  2992. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Fitness", PlayerInfo[playerid][pFitness]);
  2993. SavePlayerInteger(query, GetPlayerSQLId(playerid), "HealthCare", PlayerInfo[playerid][pHealthCare]);
  2994. SavePlayerInteger(query, GetPlayerSQLId(playerid), "ReceivedCredits", PlayerInfo[playerid][pReceivedCredits]);
  2995. SavePlayerInteger(query, GetPlayerSQLId(playerid), "RimMod", PlayerInfo[playerid][pRimMod]);
  2996. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Tazer", PlayerInfo[playerid][pHasTazer]);
  2997. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Cuff", PlayerInfo[playerid][pHasCuff]);
  2998. SavePlayerInteger(query, GetPlayerSQLId(playerid), "CarVoucher", PlayerInfo[playerid][pCarVoucher]);
  2999. SavePlayerString(query, GetPlayerSQLId(playerid), "ReferredBy", PlayerInfo[playerid][pReferredBy]);
  3000. SavePlayerInteger(query, GetPlayerSQLId(playerid), "PendingRefReward", PlayerInfo[playerid][pPendingRefReward]);
  3001. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Refers", PlayerInfo[playerid][pRefers]);
  3002. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Famed", PlayerInfo[playerid][pFamed]);
  3003. SavePlayerInteger(query, GetPlayerSQLId(playerid), "FamedMuted", PlayerInfo[playerid][pFMuted]);
  3004. SavePlayerInteger(query, GetPlayerSQLId(playerid), "DefendTime", PlayerInfo[playerid][pDefendTime]);
  3005. SavePlayerInteger(query, GetPlayerSQLId(playerid), "PVIPVoucher", PlayerInfo[playerid][pPVIPVoucher]);
  3006. SavePlayerInteger(query, GetPlayerSQLId(playerid), "VehicleSlot", PlayerInfo[playerid][pVehicleSlot]);
  3007. SavePlayerInteger(query, GetPlayerSQLId(playerid), "ToySlot", PlayerInfo[playerid][pToySlot]);
  3008. SavePlayerInteger(query, GetPlayerSQLId(playerid), "RFLTeam", PlayerInfo[playerid][pRFLTeam]);
  3009. SavePlayerInteger(query, GetPlayerSQLId(playerid), "RFLTeamL", PlayerInfo[playerid][pRFLTeamL]);
  3010. SavePlayerInteger(query, GetPlayerSQLId(playerid), "VehVoucher", PlayerInfo[playerid][pVehVoucher]);
  3011. SavePlayerInteger(query, GetPlayerSQLId(playerid), "SVIPVoucher", PlayerInfo[playerid][pSVIPVoucher]);
  3012. SavePlayerInteger(query, GetPlayerSQLId(playerid), "GVIPVoucher", PlayerInfo[playerid][pGVIPVoucher]);
  3013. SavePlayerInteger(query, GetPlayerSQLId(playerid), "GiftVoucher", PlayerInfo[playerid][pGiftVoucher]);
  3014. SavePlayerInteger(query, GetPlayerSQLId(playerid), "FallIntoFun", PlayerInfo[playerid][pFallIntoFun]);
  3015. SavePlayerInteger(query, GetPlayerSQLId(playerid), "HungerVoucher", PlayerInfo[playerid][pHungerVoucher]);
  3016. SavePlayerInteger(query, GetPlayerSQLId(playerid), "BoughtCure", PlayerInfo[playerid][pBoughtCure]);
  3017. SavePlayerInteger(query, GetPlayerSQLId(playerid), "Vials", PlayerInfo[playerid][pVials]);
  3018. SavePlayerInteger(query, GetPlayerSQLId(playerid), "AdvertVoucher", PlayerInfo[playerid][pAdvertVoucher]);
  3019. SavePlayerInteger(query, GetPlayerSQLId(playerid), "ShopCounter", PlayerInfo[playerid][pShopCounter]);
  3020. SavePlayerInteger(query, GetPlayerSQLId(playerid), "ShopNotice", PlayerInfo[playerid][pShopNotice]);
  3021. SavePlayerInteger(query, GetPlayerSQLId(playerid), "SVIPExVoucher", PlayerInfo[playerid][pSVIPExVoucher]);
  3022. SavePlayerInteger(query, GetPlayerSQLId(playerid), "GVIPExVoucher", PlayerInfo[playerid][pGVIPExVoucher]);
  3023. SavePlayerInteger(query, GetPlayerSQLId(playerid), "VIPSellable", PlayerInfo[playerid][pVIPSellable]);
  3024. SavePlayerInteger(query, GetPlayerSQLId(playerid), "ReceivedPrize", PlayerInfo[playerid][pReceivedPrize]);
  3025.  
  3026. MySQLUpdateFinish(query, GetPlayerSQLId(playerid));
  3027. return 1;
  3028. }
  3029.  
  3030. stock SaveGate(id) {
  3031. new string[512];
  3032. format(string, sizeof(string), "UPDATE `gates` SET \
  3033. `HID`=%d, \
  3034. `Speed`=%f, \
  3035. `Range`=%f, \
  3036. `Model`=%d, \
  3037. `VW`=%d, \
  3038. `Int`=%d, \
  3039. `Pass`='%s', \
  3040. `PosX`=%f, \
  3041. `PosY`=%f, \
  3042. `PosZ`=%f, \
  3043. `RotX`=%f, \
  3044. `RotY`=%f, \
  3045. `RotZ`=%f, \
  3046. `PosXM`=%f, \
  3047. `PosYM`=%f, \
  3048. `PosZM`=%f, \
  3049. `RotXM`=%f, \
  3050. `RotYM`=%f, \
  3051. `RotZM`=%f, \
  3052. `Allegiance`=%d, \
  3053. `GroupType`=%d, \
  3054. `GroupID`=%d, \
  3055. `FamilyID`=%d, \
  3056. `RenderHQ`=%d, \
  3057. `Timer`=%d, \
  3058. `Automate`=%d, \
  3059. `Locked`=%d \
  3060. WHERE `ID` = %d",
  3061. GateInfo[id][gHID],
  3062. GateInfo[id][gSpeed],
  3063. GateInfo[id][gRange],
  3064. GateInfo[id][gModel],
  3065. GateInfo[id][gVW],
  3066. GateInfo[id][gInt],
  3067. g_mysql_ReturnEscaped(GateInfo[id][gPass], MainPipeline),
  3068. GateInfo[id][gPosX],
  3069. GateInfo[id][gPosY],
  3070. GateInfo[id][gPosZ],
  3071. GateInfo[id][gRotX],
  3072. GateInfo[id][gRotY],
  3073. GateInfo[id][gRotZ],
  3074. GateInfo[id][gPosXM],
  3075. GateInfo[id][gPosYM],
  3076. GateInfo[id][gPosZM],
  3077. GateInfo[id][gRotXM],
  3078. GateInfo[id][gRotYM],
  3079. GateInfo[id][gRotZM],
  3080. GateInfo[id][gAllegiance],
  3081. GateInfo[id][gGroupType],
  3082. GateInfo[id][gGroupID],
  3083. GateInfo[id][gFamilyID],
  3084. GateInfo[id][gRenderHQ],
  3085. GateInfo[id][gTimer],
  3086. GateInfo[id][gAutomate],
  3087. GateInfo[id][gLocked],
  3088. id+1
  3089. );
  3090. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  3091. return 0;
  3092. }
  3093.  
  3094. stock SaveAuction(auction) {
  3095. new query[200];
  3096. format(query, sizeof(query), "UPDATE `auctions` SET");
  3097. format(query, sizeof(query), "%s `BiddingFor` = '%s', `InProgress` = %d, `Bid` = %d, `Bidder` = %d, `Expires` = %d, `Wining` = '%s', `Increment` = %d", query, g_mysql_ReturnEscaped(Auctions[auction][BiddingFor], MainPipeline), Auctions[auction][InProgress], Auctions[auction][Bid], Auctions[auction][Bidder], Auctions[auction][Expires], g_mysql_ReturnEscaped(Auctions[auction][Wining], MainPipeline), Auctions[auction][Increment]);
  3098. format(query, sizeof(query), "%s WHERE `id` = %d", query, auction+1);
  3099. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "ii", SENDDATA_THREAD, INVALID_PLAYER_ID);
  3100. }
  3101.  
  3102. stock SaveDealershipSpawn(businessid) {
  3103. new query[200];
  3104. format(query, sizeof(query), "UPDATE `businesses` SET");
  3105. format(query, sizeof(query), "%s `PurchaseX` = %0.5f, `PurchaseY` = %0.5f, `PurchaseZ` = %0.5f, `PurchaseAngle` = %0.5f", query, Businesses[businessid][bPurchaseX], Businesses[businessid][bPurchaseY], Businesses[businessid][bPurchaseZ], Businesses[businessid][bPurchaseAngle]);
  3106. format(query, sizeof(query), "%s WHERE `Id` = %d", query, businessid+1);
  3107. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "ii", SENDDATA_THREAD, INVALID_PLAYER_ID);
  3108. }
  3109.  
  3110. stock SaveDealershipVehicle(businessid, slotid)
  3111. {
  3112. new query[256];
  3113. //slotid++;
  3114. format(query, sizeof(query), "UPDATE `businesses` SET");
  3115. format(query, sizeof(query), "%s `Car%dPosX` = %0.5f,", query, slotid, Businesses[businessid][bParkPosX][slotid]);
  3116. format(query, sizeof(query), "%s `Car%dPosY` = %0.5f,", query, slotid, Businesses[businessid][bParkPosY][slotid]);
  3117. format(query, sizeof(query), "%s `Car%dPosZ` = %0.5f,", query, slotid, Businesses[businessid][bParkPosZ][slotid]);
  3118. format(query, sizeof(query), "%s `Car%dPosAngle` = %0.5f,", query, slotid, Businesses[businessid][bParkAngle][slotid]);
  3119. format(query, sizeof(query), "%s `Car%dModelId` = %d,", query, slotid, Businesses[businessid][bModel][slotid]);
  3120. format(query, sizeof(query), "%s `Car%dPrice` = %d", query, slotid, Businesses[businessid][bPrice][slotid]);
  3121. format(query, sizeof(query), "%s WHERE `Id` = %d", query, businessid+1);
  3122. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "ii", SENDDATA_THREAD, INVALID_PLAYER_ID);
  3123. }
  3124.  
  3125. stock GetLatestKills(playerid, giveplayerid)
  3126. {
  3127. new query[256];
  3128. format(query, sizeof(query), "SELECT Killer.Username, Killed.Username, k.* FROM kills k LEFT JOIN accounts Killed ON k.killedid = Killed.id LEFT JOIN accounts Killer ON Killer.id = k.killerid WHERE k.killerid = %d OR k.killedid = %d ORDER BY `date` DESC LIMIT 10", GetPlayerSQLId(giveplayerid), GetPlayerSQLId(giveplayerid));
  3129. mysql_function_query(MainPipeline, query, true, "OnGetLatestKills", "ii", playerid, giveplayerid);
  3130. }
  3131.  
  3132. stock GetSMSLog(playerid)
  3133. {
  3134. new query[256];
  3135. format(query, sizeof(query), "SELECT `sender`, `sendernumber`, `message`, `date` FROM `sms` WHERE `receiverid` = %d ORDER BY `date` DESC LIMIT 10", GetPlayerSQLId(playerid));
  3136. mysql_function_query(MainPipeline, query, true, "OnGetSMSLog", "i", playerid);
  3137. }
  3138.  
  3139. stock LoadBusinessSales() {
  3140.  
  3141. print("[LoadBusinessSales] Loading data from database...");
  3142. mysql_function_query(MainPipeline, "SELECT * FROM `businesssales`", true, "LoadBusinessesSaless", "");
  3143. }
  3144.  
  3145. stock LoadBusinesses() {
  3146. printf("[LoadBusinesses] Loading data from database...");
  3147. mysql_function_query(MainPipeline, "SELECT OwnerName.Username, b.* FROM businesses b LEFT JOIN accounts OwnerName ON b.OwnerID = OwnerName.id", true, "BusinessesLoadQueryFinish", "");
  3148. }
  3149.  
  3150. stock LoadAuctions() {
  3151. printf("[LoadAuctions] Loading data from database...");
  3152. mysql_function_query(MainPipeline, "SELECT * FROM `auctions`", true, "AuctionLoadQuery", "");
  3153. }
  3154.  
  3155. stock LoadPlants() {
  3156. printf("[LoadPlants] Loading data from database...");
  3157. mysql_function_query(MainPipeline, "SELECT * FROM `plants`", true, "PlantsLoadQuery", "");
  3158. }
  3159.  
  3160. stock SaveBusinessSale(id)
  3161. {
  3162. new query[200];
  3163. format(query, 200, "UPDATE `businesssales` SET `BusinessID` = '%d', `Text` = '%s', `Price` = '%d', `Available` = '%d', `Purchased` = '%d', `Type` = '%d' WHERE `bID` = '%d'", BusinessSales[id][bBusinessID], BusinessSales[id][bText],
  3164. BusinessSales[id][bPrice], BusinessSales[id][bAvailable], BusinessSales[id][bPurchased], BusinessSales[id][bType], BusinessSales[id][bID]);
  3165. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  3166. printf("[BusinessSale] saved %i", id);
  3167. return 1;
  3168. }
  3169.  
  3170. stock SavePlant(plant)
  3171. {
  3172. new query[300];
  3173. format(query, sizeof(query), "UPDATE `plants` SET `Owner` = %d, `Object` = %d, `PlantType` = %d, `PositionX` = %f, `PositionY` = %f, `PositionZ` = %f, `Virtual` = %d, \
  3174. `Interior` = %d, `Growth` = %d, `Expires` = %d, `DrugsSkill` = %d WHERE `PlantID` = %d",Plants[plant][pOwner], Plants[plant][pObject], Plants[plant][pPlantType], Plants[plant][pPos][0], Plants[plant][pPos][1], Plants[plant][pPos][2],
  3175. Plants[plant][pVirtual], Plants[plant][pInterior], Plants[plant][pGrowth], Plants[plant][pExpires], Plants[plant][pDrugsSkill], plant+1);
  3176. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  3177. return 1;
  3178. }
  3179.  
  3180. stock SaveBusiness(id)
  3181. {
  3182. new query[4019];
  3183.  
  3184. format(query, sizeof(query), "UPDATE `businesses` SET ");
  3185.  
  3186. format(query, sizeof(query), "%s \
  3187. `Name` = '%s', `Type` = %d, `Value` = %d, `OwnerID` = %d, `Months` = %d, `SafeBalance` = %d, `Inventory` = %d, `InventoryCapacity` = %d, `Status` = %d, `Level` = %d, \
  3188. `LevelProgress` = %d, `AutoSale` = %d, `OrderDate` = '%s', `OrderAmount` = %d, `OrderBy` = '%s', `OrderState` = %d, `TotalSales` = %d, ",
  3189. query,
  3190. g_mysql_ReturnEscaped(Businesses[id][bName], MainPipeline), Businesses[id][bType], Businesses[id][bValue], Businesses[id][bOwner], Businesses[id][bMonths], Businesses[id][bSafeBalance], Businesses[id][bInventory], Businesses[id][bInventoryCapacity], Businesses[id][bStatus], Businesses[id][bLevel],
  3191. Businesses[id][bLevelProgress], Businesses[id][bAutoSale], Businesses[id][bOrderDate], Businesses[id][bOrderAmount], g_mysql_ReturnEscaped(Businesses[id][bOrderBy], MainPipeline), Businesses[id][bOrderState], Businesses[id][bTotalSales]);
  3192.  
  3193. format(query, sizeof(query), "%s \
  3194. `ExteriorX` = %f, `ExteriorY` = %f, `ExteriorZ` = %f, `ExteriorA` = %f, \
  3195. `InteriorX` = %f, `InteriorY` = %f, `InteriorZ` = %f, `InteriorA` = %f, \
  3196. `Interior` = %d, `CustomExterior` = %d, `CustomInterior` = %d, `Grade` = %d, `CustomVW` = %d, `SupplyPointX` = %f, `SupplyPointY` = %f, `SupplyPointZ` = %f, ",
  3197. query,
  3198. Businesses[id][bExtPos][0], Businesses[id][bExtPos][1], Businesses[id][bExtPos][2], Businesses[id][bExtPos][3],
  3199. Businesses[id][bIntPos][0], Businesses[id][bIntPos][1], Businesses[id][bIntPos][2], Businesses[id][bIntPos][3],
  3200. Businesses[id][bInt], Businesses[id][bCustomExterior], Businesses[id][bCustomInterior], Businesses[id][bGrade], Businesses[id][bVW], Businesses[id][bSupplyPos][0],Businesses[id][bSupplyPos][1], Businesses[id][bSupplyPos][2]);
  3201.  
  3202. for (new i; i < 17; i++) format(query, sizeof(query), "%s`Item%dPrice` = %d, ", query, i+1, Businesses[id][bItemPrices][i]);
  3203. for (new i; i < 5; i++) format(query, sizeof(query), "%s`Rank%dPay` = %d, ", query, i, Businesses[id][bRankPay][i], id);
  3204. for (new i; i < MAX_BUSINESS_GAS_PUMPS; i++) format(query, sizeof(query), "%s `GasPump%dPosX` = %f, `GasPump%dPosY` = %f, `GasPump%dPosZ` = %f, `GasPump%dAngle` = %f, `GasPump%dModel` = %d, `GasPump%dCapacity` = %f, `GasPump%dGas` = %f, ", query, i+1, Businesses[id][GasPumpPosX][i], i+1, Businesses[id][GasPumpPosY][i], i+1, Businesses[id][GasPumpPosZ][i], i+1, Businesses[id][GasPumpAngle][i], i+1, 1646,i+1, Businesses[id][GasPumpCapacity], i+1, Businesses[id][GasPumpGallons]);
  3205.  
  3206. format(query, sizeof(query), "%s \
  3207. `Pay` = %d, `GasPrice` = %f, `MinInviteRank` = %d, `MinSupplyRank` = %d, `MinGiveRankRank` = %d, `MinSafeRank` = %d, `GymEntryFee` = %d, `GymType` = %d, `TotalProfits` = %d WHERE `Id` = %d",
  3208. query,
  3209. Businesses[id][bAutoPay], Businesses[id][bGasPrice], Businesses[id][bMinInviteRank], Businesses[id][bMinSupplyRank], Businesses[id][bMinGiveRankRank], Businesses[id][bMinSafeRank], Businesses[id][bGymEntryFee], Businesses[id][bGymType], Businesses[id][bTotalProfits], id+1);
  3210.  
  3211. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  3212.  
  3213. //printf("Len :%d", strlen(query));
  3214. printf("[business] saved %i", id);
  3215.  
  3216. return 1;
  3217. }
  3218.  
  3219. //--------------------------------[ CUSTOM PUBLIC FUNCTIONS ]---------------------------
  3220.  
  3221. forward OnPhoneNumberCheck(index, extraid);
  3222. public OnPhoneNumberCheck(index, extraid)
  3223. {
  3224. if(IsPlayerConnected(index))
  3225. {
  3226. new string[128];
  3227. new rows, fields;
  3228. cache_get_data(rows, fields, MainPipeline);
  3229.  
  3230. switch(extraid)
  3231. {
  3232. case 1: {
  3233. if(rows)
  3234. {
  3235. SendClientMessageEx(index, COLOR_WHITE, "That phone number has already been taken.");
  3236. DeletePVar(index, "PhChangerId");
  3237. DeletePVar(index, "WantedPh");
  3238. DeletePVar(index, "PhChangeCost");
  3239. DeletePVar(index, "CurrentPh");
  3240. }
  3241. else
  3242. {
  3243. format(string,sizeof(string),"The phone number requested, %d, will cost a total of $%s.\n\nTo confirm, press OK.", GetPVarInt(index, "WantedPh"), number_format(GetPVarInt(index, "PhChangeCost")));
  3244. ShowPlayerDialog(index, VIPNUMMENU2, DIALOG_STYLE_MSGBOX, "Confirmation", string, "OK", "Cancel");
  3245. }
  3246. }
  3247. case 2: {
  3248. if(rows)
  3249. {
  3250. SendClientMessageEx(index, COLOR_WHITE, "That phone number has already been taken.");
  3251. }
  3252. else
  3253. {
  3254. PlayerInfo[index][pPnumber] = GetPVarInt(index, "WantedPh");
  3255. GivePlayerCash(index, -GetPVarInt(index, "PhChangeCost"));
  3256. format(string, sizeof(string), "Cellphone purchased, your new phone number is %d.", GetPVarInt(index, "WantedPh"));
  3257. SendClientMessageEx(index, COLOR_GRAD4, string);
  3258. SendClientMessageEx(index, COLOR_GRAD5, "You can check this any time you wish by typing /stats.");
  3259. SendClientMessageEx(index, COLOR_WHITE, "HINT: You can now type /cellphonehelp to see your cellphone commands.");
  3260. format(string, sizeof(string), "UPDATE `accounts` SET `PhoneNr` = %d WHERE `id` = '%d'", PlayerInfo[index][pPnumber], GetPlayerSQLId(index));
  3261. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "ii", SENDDATA_THREAD, index);
  3262. DeletePVar(index, "PhChangerId");
  3263. DeletePVar(index, "WantedPh");
  3264. DeletePVar(index, "PhChangeCost");
  3265. DeletePVar(index, "CurrentPh");
  3266. }
  3267. }
  3268. case 3: {
  3269. if(rows && GetPVarInt(index, "WantedPh") != 0)
  3270. {
  3271. SendClientMessageEx(index, COLOR_WHITE, "That phone number has already been taken.");
  3272. }
  3273. else
  3274. {
  3275. PlayerInfo[index][pPnumber] = GetPVarInt(index, "WantedPh");
  3276. format(string, sizeof(string), " %s's Phone Number has been set to %d.", GetPlayerNameEx(index), GetPVarInt(index, "WantedPh"));
  3277.  
  3278. format(string, sizeof(string), "%s by %s", string, GetPlayerNameEx(index));
  3279. Log("logs/undercover.log", string);
  3280. SendClientMessageEx(index, COLOR_GRAD1, string);
  3281. format(string, sizeof(string), "UPDATE `accounts` SET `PhoneNr` = %d WHERE `id` = '%d'", PlayerInfo[index][pPnumber], GetPlayerSQLId(index));
  3282. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "ii", SENDDATA_THREAD, index);
  3283. DeletePVar(index, "PhChangerId");
  3284. DeletePVar(index, "WantedPh");
  3285. DeletePVar(index, "PhChangeCost");
  3286. DeletePVar(index, "CurrentPh");
  3287. }
  3288. }
  3289. case 4: {
  3290. if(IsPlayerConnected(GetPVarInt(index, "PhChangerId")))
  3291. {
  3292. if(rows)
  3293. {
  3294. SendClientMessageEx(GetPVarInt(index, "PhChangerId"), COLOR_WHITE, "That phone number has already been taken.");
  3295. }
  3296. else
  3297. {
  3298. PlayerInfo[index][pPnumber] = GetPVarInt(index, "WantedPh");
  3299. format(string, sizeof(string), " %s's Phone Number has been set to %d.", GetPlayerNameEx(index), GetPVarInt(index, "WantedPh"));
  3300.  
  3301. format(string, sizeof(string), "%s by %s", string, GetPlayerNameEx(GetPVarInt(index, "PhChangerId")));
  3302. Log("logs/stats.log", string);
  3303. SendClientMessageEx(GetPVarInt(index, "PhChangerId"), COLOR_GRAD1, string);
  3304. format(string, sizeof(string), "UPDATE `accounts` SET `PhoneNr` = %d WHERE `id` = '%d'", PlayerInfo[index][pPnumber], GetPlayerSQLId(index));
  3305. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "ii", SENDDATA_THREAD, index);
  3306. DeletePVar(index, "PhChangerId");
  3307. DeletePVar(index, "WantedPh");
  3308. DeletePVar(index, "PhChangeCost");
  3309. DeletePVar(index, "CurrentPh");
  3310. }
  3311. }
  3312. }
  3313. }
  3314. }
  3315. return 1;
  3316. }
  3317.  
  3318. forward AddingBan(index, type);
  3319. public AddingBan(index, type)
  3320. {
  3321. if(IsPlayerConnected(index))
  3322. {
  3323. if(type == 1) // Add Ban
  3324. {
  3325. new rows, fields;
  3326. cache_get_data(rows, fields, MainPipeline);
  3327. if(rows)
  3328. {
  3329. DeletePVar(index, "BanningPlayer");
  3330. DeletePVar(index, "BanningReason");
  3331. SendClientMessageEx(index, COLOR_GREY, "That player is already banned.");
  3332. }
  3333. else
  3334. {
  3335. if(IsPlayerConnected(GetPVarInt(index, "BanningPlayer")))
  3336. {
  3337. new string[150], reason[64];
  3338. GetPVarString(index, "BanningReason", reason, sizeof(reason));
  3339.  
  3340. format(string, sizeof(string), "INSERT INTO `ip_bans` (`ip`, `date`, `reason`, `admin`) VALUES ('%s', NOW(), '%s', '%s')", GetPlayerIpEx(GetPVarInt(index, "BanningPlayer")), reason, GetPlayerNameEx(index));
  3341. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  3342.  
  3343. DeletePVar(index, "BanningPlayer");
  3344. DeletePVar(index, "BanningReason");
  3345. }
  3346. }
  3347. }
  3348. else if(type == 2) // Unban IP
  3349. {
  3350. new rows, fields;
  3351. cache_get_data(rows, fields, MainPipeline);
  3352. if(rows)
  3353. {
  3354. new string[128], ip[32];
  3355. GetPVarString(index, "UnbanIP", ip, sizeof(ip));
  3356.  
  3357. format(string, sizeof(string), "DELETE FROM `ip_bans` WHERE `ip` = '%s'", ip);
  3358. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  3359.  
  3360. DeletePVar(index, "UnbanIP");
  3361. }
  3362. else
  3363. {
  3364. SendClientMessageEx(index, COLOR_GREY, "That IP address was not found in the ban database.");
  3365. DeletePVar(index, "UnbanIP");
  3366. }
  3367. }
  3368. else if(type == 3) // Ban IP
  3369. {
  3370. new rows, fields;
  3371. cache_get_data(rows, fields, MainPipeline);
  3372. if(rows)
  3373. {
  3374. SendClientMessageEx(index, COLOR_GREY, "That IP address is already banned.");
  3375. DeletePVar(index, "BanIP");
  3376. }
  3377. else
  3378. {
  3379. new string[128], ip[32];
  3380. GetPVarString(index, "BanIP", ip, sizeof(ip));
  3381. format(string, sizeof(string), "INSERT INTO `ip_bans` (`ip`, `date`, `reason`, `admin`) VALUES ('%s', NOW(), '%s', '%s')", ip, "/banip", GetPlayerNameEx(index));
  3382. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  3383.  
  3384. SendClientMessageEx(index, COLOR_WHITE, "That IP address was successfully banned.");
  3385. DeletePVar(index, "BanIP");
  3386. }
  3387. }
  3388. }
  3389. return 1;
  3390. }
  3391.  
  3392. forward MailsQueryFinish(playerid);
  3393. public MailsQueryFinish(playerid)
  3394. {
  3395.  
  3396. new rows, fields;
  3397. cache_get_data(rows, fields, MainPipeline);
  3398.  
  3399. if (rows == 0) {
  3400. ShowPlayerDialog(playerid, DIALOG_NOTHING, DIALOG_STYLE_MSGBOX, " ", "Your mailbox is empty.", "OK", "");
  3401. return 1;
  3402. }
  3403.  
  3404. new id, string[2000], message[129], tmp[128], read;
  3405. for(new i; i < rows;i++)
  3406. {
  3407. cache_get_field_content(i, "Id", tmp, MainPipeline); id = strval(tmp);
  3408. cache_get_field_content(i, "Read", tmp, MainPipeline); read= strval(tmp);
  3409. cache_get_field_content(i, "Message", message, MainPipeline, 129);
  3410. strmid(message,message,0,30);
  3411. if (strlen(message) > 30) strcat(message,"...");
  3412. strcat(string, (read) ? ("{BBBBBB}") : ("{FFFFFF}"));
  3413. strcat(string, message);
  3414. if (i != rows - 1) strcat(string, "\n");
  3415. ListItemTrackId[playerid][i] = id;
  3416. }
  3417.  
  3418. ShowPlayerDialog(playerid, DIALOG_POMAILS, DIALOG_STYLE_LIST, "Your mails", string, "Read", "Close");
  3419.  
  3420. return 1;
  3421. }
  3422.  
  3423. forward MailDetailsQueryFinish(playerid);
  3424. public MailDetailsQueryFinish(playerid)
  3425. {
  3426. new string[256];
  3427. new rows, fields;
  3428. cache_get_data(rows, fields, MainPipeline);
  3429.  
  3430. new senderid, sender[MAX_PLAYER_NAME], message[131], notify, szTmp[128], Date[32], read, id;
  3431. cache_get_field_content(0, "Id", szTmp, MainPipeline); id = strval(szTmp);
  3432. cache_get_field_content(0, "Notify", szTmp, MainPipeline); notify = strval(szTmp);
  3433. cache_get_field_content(0, "Sender_Id", szTmp, MainPipeline); senderid = strval(szTmp);
  3434. cache_get_field_content(0, "Read", szTmp, MainPipeline); read = strval(szTmp);
  3435. cache_get_field_content(0, "Message", message, MainPipeline, 131);
  3436. cache_get_field_content(0, "SenderUser", sender, MainPipeline, MAX_PLAYER_NAME);
  3437. cache_get_field_content(0, "Date", Date, MainPipeline, 32);
  3438.  
  3439. if (strlen(message) > 80) strins(message, "\n", 70);
  3440.  
  3441. format(string, sizeof(string), "{EEEEEE}%s\n\n{BBBBBB}Sender: {FFFFFF}%s\n{BBBBBB}Date: {EEEEEE}%s", message, sender,Date);
  3442. ShowPlayerDialog(playerid, DIALOG_PODETAIL, DIALOG_STYLE_MSGBOX, "Mail Content", string, "Back", "Trash");
  3443.  
  3444. if (notify && !read) {
  3445. foreach(new i: Player)
  3446. {
  3447. if (GetPlayerSQLId(i) == senderid) {
  3448. format(string, sizeof(string), "Your message has just been read by %s!", GetPlayerNameEx(playerid));
  3449. SendClientMessageEx(i, COLOR_YELLOW, string);
  3450. break;
  3451. }
  3452. }
  3453. }
  3454.  
  3455. format(string, sizeof(string), "UPDATE `letters` SET `Read` = 1 WHERE `id` = %d", id);
  3456. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  3457.  
  3458. return 1;
  3459. }
  3460.  
  3461.  
  3462. forward MailDeliveryQueryFinish();
  3463. public MailDeliveryQueryFinish()
  3464. {
  3465.  
  3466. new rows, fields, id, tmp[128], i;
  3467. cache_get_data(rows, fields, MainPipeline);
  3468.  
  3469. for(; i < rows;i++)
  3470. {
  3471. cache_get_field_content(i, "Receiver_Id", tmp, MainPipeline);
  3472. id = strval(tmp);
  3473. foreach(new j: Player)
  3474. {
  3475. if (GetPlayerSQLId(j) == id) {
  3476. if (PlayerInfo[j][pDonateRank] >= 4 && HasMailbox(j)) {
  3477. SendClientMessageEx(j, COLOR_YELLOW, "Mail has just been delivered to your mailbox.");
  3478. SetPVarInt(j, "UnreadMails", 1);
  3479. break;
  3480. }
  3481.  
  3482. }
  3483. }
  3484. }
  3485.  
  3486. return 1;
  3487.  
  3488. }
  3489.  
  3490.  
  3491. forward MDCQueryFinish(playerid, suspectid);
  3492. public MDCQueryFinish(playerid, suspectid)
  3493. {
  3494. new rows, fields;
  3495. cache_get_data(rows, fields, MainPipeline);
  3496. new resultline[1424];
  3497. new crimes = PlayerInfo[suspectid][pCrimes];
  3498. new arrests = PlayerInfo[suspectid][pArrested];
  3499. format(resultline, sizeof(resultline), "{FF6347}Name:{BFC0C2} %s\t{FF6347}Phone Number:{BFC0C2} %d\n{FF6347}Total Previous Crimes: {BFC0C2}%d\t {FF6347}Total Arrests: {BFC0C2}%d \n{FF6347}Crime Key: {FF7D7D}Currently Wanted/{BFC0C2}Past Crime\n\n", GetPlayerNameEx(suspectid),PlayerInfo[suspectid][pPnumber], crimes, arrests);
  3500.  
  3501. for(new i; i < rows; i++)
  3502. {
  3503. cache_get_field_content(i, "issuer", MDCInfo[i][mdcIssuer], MainPipeline, MAX_PLAYER_NAME);
  3504. cache_get_field_content(i, "crime", MDCInfo[i][mdcCrime], MainPipeline, 64);
  3505. cache_get_field_content(i, "active", MDCInfo[i][mdcActive], MainPipeline, 2);
  3506. if(strval(MDCInfo[i][mdcActive]) == 1)
  3507. {
  3508. format(resultline, sizeof(resultline),"%s{FF6347}Crime: {FF7D7D}%s \t{FF6347}Charged by:{BFC0C2} %s\n",resultline, MDCInfo[i][mdcCrime], MDCInfo[i][mdcIssuer]);
  3509. } else {
  3510. format(resultline, sizeof(resultline),"%s{FF6347}Crime: {BFC0C2}%s \t{FF6347}Charged by:{BFC0C2} %s\n",resultline, MDCInfo[i][mdcCrime], MDCInfo[i][mdcIssuer]);
  3511. }
  3512. }
  3513. ShowPlayerDialog(playerid, MDC_SHOWCRIMES, DIALOG_STYLE_MSGBOX, "SA-MDC - Criminal History", resultline, "Back", "");
  3514. return 1;
  3515. }
  3516.  
  3517. forward MDCReportsQueryFinish(playerid, suspectid);
  3518. public MDCReportsQueryFinish(playerid, suspectid)
  3519. {
  3520. new rows, fields;
  3521. cache_get_data(rows, fields, MainPipeline);
  3522. new resultline[1424], str[12];
  3523. new copname[MAX_PLAYER_NAME], datetime[64], reportsid;
  3524. for(new i; i < rows; i++)
  3525. {
  3526. cache_get_field_content(i, "id", str, MainPipeline, 12); reportsid = strval(str);
  3527. cache_get_field_content(i, "Username", copname, MainPipeline, MAX_PLAYER_NAME);
  3528. cache_get_field_content(i, "datetime", datetime, MainPipeline, 64);
  3529. format(resultline, sizeof(resultline),"%s{FF6347}Report (%d) {FF7D7D}Arrested by: %s on %s\n",resultline, reportsid, copname,datetime);
  3530. }
  3531. ShowPlayerDialog(playerid, MDC_SHOWREPORTS, DIALOG_STYLE_LIST, "SA-MDC - Criminal History", resultline, "Back", "");
  3532. return 1;
  3533. }
  3534.  
  3535. forward MDCReportQueryFinish(playerid, reportid);
  3536. public MDCReportQueryFinish(playerid, reportid)
  3537. {
  3538. new rows, fields;
  3539. cache_get_data(rows, fields, MainPipeline);
  3540. new resultline[1424];
  3541. new copname[MAX_PLAYER_NAME], datetime[64], shortreport[200];
  3542. for(new i; i < rows; i++)
  3543. {
  3544. cache_get_field_content(i, "Username", copname, MainPipeline, MAX_PLAYER_NAME);
  3545. cache_get_field_content(i, "datetime", datetime, MainPipeline, 64);
  3546. cache_get_field_content(i, "shortreport", shortreport, MainPipeline, 200);
  3547. format(resultline, sizeof(resultline),"{FF6347}Report #%d\n{FF7D7D}Arrested by: %s on %s\n{FF6347}Report:{BFC0C2} %s\n",reportid, copname,datetime, shortreport);
  3548. }
  3549. ShowPlayerDialog(playerid, MDC_SHOWCRIMES, DIALOG_STYLE_MSGBOX, "SA-MDC - Arrest Report", resultline, "Back", "");
  3550. return 1;
  3551. }
  3552.  
  3553. forward FlagQueryFinish(playerid, suspectid, queryid);
  3554. public FlagQueryFinish(playerid, suspectid, queryid)
  3555. {
  3556. new rows, fields;
  3557. cache_get_data(rows, fields, MainPipeline);
  3558. new resultline[2000];
  3559. new header[64], sResult[64];
  3560. new FlagID, FlagIssuer[MAX_PLAYER_NAME], FlagText[64], FlagDate[24];
  3561. switch(queryid)
  3562. {
  3563. case Flag_Query_Display:
  3564. {
  3565. format(header, sizeof(header), "{FF6347}Flag History for{BFC0C2} %s", GetPlayerNameEx(suspectid));
  3566.  
  3567. for(new i; i < rows; i++)
  3568. {
  3569. cache_get_field_content(i, "fid", sResult, MainPipeline); FlagID = strval(sResult);
  3570. cache_get_field_content(i, "issuer", FlagIssuer, MainPipeline, MAX_PLAYER_NAME);
  3571. cache_get_field_content(i, "flag", FlagText, MainPipeline, 64);
  3572. cache_get_field_content(i, "time", FlagDate, MainPipeline, 24);
  3573. format(resultline, sizeof(resultline),"%s{FF6347}Flag (ID: %d): {BFC0C2} %s \t{FF6347}Issued by:{BFC0C2} %s \t{FF6347}Date: {BFC0C2}%s\n",resultline, FlagID, FlagText, FlagIssuer, FlagDate);
  3574. }
  3575. if(rows == 0)
  3576. {
  3577. format(resultline, sizeof(resultline),"{FF6347}No Flags on this account");
  3578. }
  3579. ShowPlayerDialog(playerid, FLAG_LIST, DIALOG_STYLE_MSGBOX, header, resultline, "Delete Flag", "Close");
  3580. }
  3581. case Flag_Query_Offline:
  3582. {
  3583. new string[128], name[24], reason[64], psqlid[12];
  3584. GetPVarString(playerid, "OnAddFlag", name, 24);
  3585. GetPVarString(playerid, "OnAddFlagReason", reason, 64);
  3586. SendClientMessage(playerid, COLOR_YELLOW, string);
  3587. if(rows > 0) {
  3588. format(string, sizeof(string), "You have appended %s's flag.", name);
  3589. SendClientMessageEx(playerid, COLOR_WHITE, string);
  3590.  
  3591. format(string, sizeof(string), "AdmCmd: %s was offline flagged by %s, reason: %s.", name, GetPlayerNameEx(playerid), reason);
  3592. ABroadCast(COLOR_LIGHTRED, string, 2);
  3593.  
  3594. format(string, sizeof(string), "%s was offline flagged by %s (%s).", name, GetPlayerNameEx(playerid), reason);
  3595. Log("logs/flags.log", string);
  3596.  
  3597. cache_get_field_content(0, "id", psqlid, MainPipeline);
  3598.  
  3599. AddOFlag(strval(psqlid), playerid, reason);
  3600. }
  3601. else {
  3602. format(string, sizeof(string), "There was a problem with appending %s's flag.", name);
  3603. SendClientMessageEx(playerid, COLOR_WHITE, string);
  3604. }
  3605. DeletePVar(playerid, "OnAddFlagReason");
  3606. }
  3607. case Flag_Query_Count:
  3608. {
  3609. PlayerInfo[playerid][pFlagged] = rows;
  3610. }
  3611. }
  3612. return 1;
  3613. }
  3614.  
  3615. forward SkinQueryFinish(playerid, queryid);
  3616. public SkinQueryFinish(playerid, queryid)
  3617. {
  3618. new rows, fields;
  3619. cache_get_data(rows, fields, MainPipeline);
  3620. new resultline[2000], header[32], sResult[64], skinid;
  3621. switch(queryid)
  3622. {
  3623. case Skin_Query_Display:
  3624. {
  3625. if(PlayerInfo[playerid][pDonateRank] <= 0) format(header, sizeof(header), "Closet -- Space: %d/10", PlayerInfo[playerid][pSkins]);
  3626. else if(PlayerInfo[playerid][pDonateRank] > 0) format(header, sizeof(header), "Closet -- Space: %d/25", PlayerInfo[playerid][pSkins]);
  3627.  
  3628. if(rows == 0) return SendClientMessageEx(playerid, COLOR_GREY, "There are no clothes in this closet!");
  3629. for(new i; i < rows; i++)
  3630. {
  3631. cache_get_field_content(i, "skinid", sResult, MainPipeline); skinid = strval(sResult);
  3632. format(resultline, sizeof(resultline),"%sSkin ID: %d\n",resultline, skinid);
  3633. }
  3634. ShowPlayerDialog(playerid, SKIN_LIST, DIALOG_STYLE_LIST, header, resultline, "Select", "Cancel");
  3635. }
  3636. case Skin_Query_Count:
  3637. {
  3638. PlayerInfo[playerid][pSkins] = rows;
  3639. }
  3640. case Skin_Query_ID:
  3641. {
  3642. for(new i; i < rows; i++)
  3643. {
  3644. cache_get_field_content(i, "skinid", sResult, MainPipeline); skinid = strval(sResult);
  3645. if(i == GetPVarInt(playerid, "closetchoiceid"))
  3646. {
  3647. SetPVarInt(playerid, "closetskinid", skinid);
  3648. SetPlayerSkin(playerid, skinid);
  3649. ShowPlayerDialog(playerid, SKIN_CONFIRM, DIALOG_STYLE_MSGBOX, "Closet", "Do you want to wear these clothes?", "Yes", "Go Back");
  3650. }
  3651. }
  3652. }
  3653. case Skin_Query_Delete:
  3654. {
  3655. if(PlayerInfo[playerid][pDonateRank] <= 0) format(header, sizeof(header), "Closet -- Space: %d/10", PlayerInfo[playerid][pSkins]);
  3656. else if(PlayerInfo[playerid][pDonateRank] > 0) format(header, sizeof(header), "Closet -- Space: %d/25", PlayerInfo[playerid][pSkins]);
  3657.  
  3658. if(rows == 0) return SendClientMessageEx(playerid, COLOR_GREY, "There are no clothes in this closet!");
  3659. for(new i; i < rows; i++)
  3660. {
  3661. cache_get_field_content(i, "skinid", sResult, MainPipeline); skinid = strval(sResult);
  3662. format(resultline, sizeof(resultline),"%sSkin ID: %d\n",resultline, skinid);
  3663. }
  3664. ShowPlayerDialog(playerid, SKIN_DELETE, DIALOG_STYLE_LIST, header, resultline, "Select", "Cancel");
  3665. }
  3666. case Skin_Query_Delete_ID:
  3667. {
  3668. for(new i; i < rows; i++)
  3669. {
  3670. cache_get_field_content(i, "id", sResult, MainPipeline); skinid = strval(sResult);
  3671. if(i == GetPVarInt(playerid, "closetchoiceid"))
  3672. {
  3673. SetPVarInt(playerid, "closetskinid", skinid);
  3674. ShowPlayerDialog(playerid, SKIN_DELETE2, DIALOG_STYLE_MSGBOX, "Closet", "Are you sure you want to remove these clothes?", "Yes", "Cancel");
  3675. }
  3676. }
  3677. }
  3678. }
  3679. return 1;
  3680. }
  3681.  
  3682.  
  3683. forward CitizenQueryFinish(playerid, queryid);
  3684. public CitizenQueryFinish(playerid, queryid)
  3685. {
  3686. new rows, fields;
  3687. cache_get_data(rows, fields, MainPipeline);
  3688. switch(queryid)
  3689. {
  3690. case TR_Citizen_Count:
  3691. {
  3692. TRCitizens = rows;
  3693. }
  3694. case Total_Count:
  3695. {
  3696. TotalCitizens = rows;
  3697. }
  3698. }
  3699. return 1;
  3700. }
  3701.  
  3702. forward NationQueueQueryFinish(playerid, nation, queryid);
  3703. public NationQueueQueryFinish(playerid, nation, queryid)
  3704. {
  3705. new query[300], resultline[2000], sResult[64], rows, fields;
  3706. cache_get_data(rows, fields, MainPipeline);
  3707. switch(queryid)
  3708. {
  3709. case CheckQueue:
  3710. {
  3711. if(rows == 0)
  3712. {
  3713. format(query, sizeof(query), "INSERT INTO `nation_queue` (`id`, `playerid`, `name`, `date`, `nation`, `status`) VALUES (NULL, %d, '%s', NOW(), %d, 1)", GetPlayerSQLId(playerid), GetPlayerNameEx(playerid), nation);
  3714. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  3715. SendClientMessageEx(playerid, COLOR_GREY, "You have been added to the nation's application queue. The nation's leader can now choose to accept or deny your application.");
  3716. }
  3717. else
  3718. {
  3719. SendClientMessageEx(playerid, COLOR_GREY, "You are already in queue to join a nation.");
  3720. }
  3721. }
  3722. case UpdateQueue:
  3723. {
  3724. if(rows > 0)
  3725. {
  3726. format(query, sizeof(query), "UPDATE `nation_queue` SET `name` = '%s' WHERE `playerid` = %d", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid));
  3727. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  3728. }
  3729. }
  3730. case AppQueue:
  3731. {
  3732. new sDate[32];
  3733. if(rows == 0) return SendClientMessageEx(playerid, COLOR_GREY, "There are currently no pending applications.");
  3734. for(new i; i < rows; i++)
  3735. {
  3736. cache_get_field_content(i, "name", sResult, MainPipeline, MAX_PLAYER_NAME);
  3737. cache_get_field_content(i, "date", sDate, MainPipeline, 32);
  3738. format(resultline, sizeof(resultline), "%s%s -- Date Submitted: %s\n", resultline, sResult, sDate);
  3739. }
  3740. ShowPlayerDialog(playerid, NATION_APP_LIST, DIALOG_STYLE_LIST, "Nation Applications", resultline, "Select", "Cancel");
  3741. }
  3742. case AddQueue:
  3743. {
  3744. if(rows == 0)
  3745. {
  3746. format(query, sizeof(query), "INSERT INTO `nation_queue` (`id`, `playerid`, `name`, `date`, `nation`, `status`) VALUES (NULL, %d, '%s', NOW(), %d, 2)", GetPlayerSQLId(playerid), GetPlayerNameEx(playerid), nation);
  3747. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  3748. PlayerInfo[playerid][pNation] = 1;
  3749. }
  3750. else
  3751. {
  3752. format(query, sizeof(query), "INSERT INTO `nation_queue` (`id`, `playerid`, `name`, `date`, `nation`, `status`) VALUES (NULL, %d, NOW(), %d, 1)", GetPlayerSQLId(playerid), GetPlayerNameEx(playerid), nation);
  3753. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  3754. }
  3755. }
  3756. }
  3757. return 1;
  3758. }
  3759.  
  3760. forward NationAppFinish(playerid, queryid);
  3761. public NationAppFinish(playerid, queryid)
  3762. {
  3763. new query[300], string[128], sResult[64], rows, fields;
  3764. cache_get_data(rows, fields, MainPipeline);
  3765. switch(queryid)
  3766. {
  3767. case AcceptApp:
  3768. {
  3769. for(new i; i < rows; i++)
  3770. {
  3771. cache_get_field_content(i, "id", sResult, MainPipeline); new AppID = strval(sResult);
  3772. cache_get_field_content(i, "playerid", sResult, MainPipeline); new UserID = strval(sResult);
  3773. cache_get_field_content(i, "name", sResult, MainPipeline, MAX_PLAYER_NAME);
  3774. if(GetPVarInt(playerid, "Nation_App_ID") == i)
  3775. {
  3776. format(query, sizeof(query), "UPDATE `nation_queue` SET `status` = 2 WHERE `id` = %d", AppID);
  3777. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  3778.  
  3779. new giveplayerid = ReturnUser(sResult);
  3780. switch(arrGroupData[PlayerInfo[playerid][pMember]][g_iAllegiance])
  3781. {
  3782. case 1:
  3783. {
  3784. if(IsPlayerConnected(giveplayerid))
  3785. {
  3786. PlayerInfo[giveplayerid][pNation] = 0;
  3787. SendClientMessageEx(giveplayerid, COLOR_WHITE, "Your application for San Andreas citizenship has been approved!");
  3788. }
  3789. else
  3790. {
  3791. format(query, sizeof(query), "UPDATE `accounts` SET `Nation` = 0 WHERE `id` = %d", UserID);
  3792. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  3793. }
  3794. format(string, sizeof(string), "%s has approved %s's application for San Andreas citizenship", GetPlayerNameEx(playerid), sResult);
  3795. }
  3796. case 2:
  3797. {
  3798. if(IsPlayerConnected(giveplayerid))
  3799. {
  3800. PlayerInfo[giveplayerid][pNation] = 1;
  3801. SendClientMessageEx(giveplayerid, COLOR_WHITE, "Your application for Tierra Robada citizenship has been approved!");
  3802. }
  3803. else
  3804. {
  3805. format(query, sizeof(query), "UPDATE `accounts` SET `Nation` = 1 WHERE `id` = %d", UserID);
  3806. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  3807. }
  3808. format(string, sizeof(string), "%s has approved %s's application for Tierra Robada citizenship", GetPlayerNameEx(playerid), sResult);
  3809. }
  3810. }
  3811. Log("logs/gov.log", string);
  3812. format(string, sizeof(string), "You have successfully approved %s's application.", sResult);
  3813. SendClientMessageEx(playerid, COLOR_WHITE, string);
  3814. DeletePVar(playerid, "Nation_App_ID");
  3815. }
  3816. }
  3817. }
  3818. case DenyApp:
  3819. {
  3820. for(new i; i < rows; i++)
  3821. {
  3822. cache_get_field_content(i, "id", sResult, MainPipeline, 32); new AppID = strval(sResult);
  3823. cache_get_field_content(i, "name", sResult, MainPipeline, MAX_PLAYER_NAME);
  3824. if(GetPVarInt(playerid, "Nation_App_ID") == i)
  3825. {
  3826. format(query, sizeof(query), "UPDATE `nation_queue` SET `status` = 3 WHERE `id` = %d", AppID);
  3827. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  3828. new giveplayerid = ReturnUser(sResult);
  3829. switch(arrGroupData[PlayerInfo[playerid][pMember]][g_iAllegiance])
  3830. {
  3831. case 1:
  3832. {
  3833. if(IsPlayerConnected(giveplayerid)) SendClientMessageEx(giveplayerid, COLOR_GREY, "Your application for San Andreas citizenship has been denied.");
  3834. format(string, sizeof(string), "%s has denied %s's application for San Andreas citizenship", GetPlayerNameEx(playerid), sResult);
  3835. }
  3836. case 2:
  3837. {
  3838. if(IsPlayerConnected(giveplayerid)) SendClientMessageEx(giveplayerid, COLOR_GREY, "Your application for San Andreas citizenship has been denied.");
  3839. format(string, sizeof(string), "%s has denied %s's application for Tierra Robada citizenship", GetPlayerNameEx(playerid), sResult);
  3840. }
  3841. }
  3842. Log("logs/gov.log", string);
  3843. format(string, sizeof(string), "You have successfully denied %s's application.", sResult);
  3844. SendClientMessageEx(playerid, COLOR_WHITE, string);
  3845. DeletePVar(playerid, "Nation_App_ID");
  3846. }
  3847. }
  3848. }
  3849. }
  3850. return 1;
  3851. }
  3852.  
  3853. forward CountAmount(playerid);
  3854. public CountAmount(playerid)
  3855. {
  3856. new rows, fields;
  3857. cache_get_data(rows, fields, MainPipeline);
  3858. PlayerInfo[playerid][pLottoNr] = rows;
  3859. return 1;
  3860. }
  3861.  
  3862. forward UnreadMailsNotificationQueryFin(playerid);
  3863. public UnreadMailsNotificationQueryFin(playerid)
  3864. {
  3865. new szResult[8];
  3866. cache_get_field_content(0, "Unread_Count", szResult, MainPipeline);
  3867. if (strval(szResult) > 0) {
  3868. SetPVarInt(playerid, "UnreadMails", 1);
  3869. SendClientMessageEx(playerid, COLOR_YELLOW, "You have unread items in your mailbox.");
  3870. }
  3871. return 1;
  3872. }
  3873.  
  3874.  
  3875. forward RecipientLookupFinish(playerid);
  3876. public RecipientLookupFinish(playerid)
  3877. {
  3878. new rows,fields,szResult[16], admin, undercover, id;
  3879. cache_get_data(rows, fields, MainPipeline);
  3880.  
  3881. if (!rows) return ShowPlayerDialog(playerid, DIALOG_PORECEIVER, DIALOG_STYLE_INPUT, "Recipient", "{FF3333}Error: {FFFFFF}Invalid Recipient - Account does not exist!\n\nPlease type the name of the recipient (online or offline)", "Next", "Cancel");
  3882.  
  3883. cache_get_field_content(0, "AdminLevel", szResult, MainPipeline); admin = strval(szResult);
  3884. cache_get_field_content(0, "TogReports", szResult, MainPipeline); undercover = strval(szResult);
  3885. cache_get_field_content(0, "id", szResult, MainPipeline); id = strval(szResult);
  3886.  
  3887. if (admin >= 2 && undercover == 0) return ShowPlayerDialog(playerid, DIALOG_PORECEIVER, DIALOG_STYLE_INPUT, "Recipient", "{FF3333}Error: {FFFFFF}You can't send a letter to admins!\n\nPlease type the name of the recipient (online or offline)", "Next", "Cancel");
  3888.  
  3889. SetPVarInt(playerid, "LetterRecipient", id);
  3890. ShowPlayerDialog(playerid, DIALOG_POMESSAGE, DIALOG_STYLE_INPUT, "Send Letter", "{FFFFFF}Please type the message.", "Send", "Cancel");
  3891.  
  3892. return 1;
  3893.  
  3894. }
  3895.  
  3896. forward CheckSales(index);
  3897. public CheckSales(index)
  3898. {
  3899. if(IsPlayerConnected(index))
  3900. {
  3901. new rows, fields, szDialog[128];
  3902. cache_get_data(rows, fields, MainPipeline);
  3903. if(rows > 0)
  3904. {
  3905. for(new i;i < rows;i++)
  3906. {
  3907. new szResult[32], id;
  3908. cache_get_field_content(i, "id", szResult, MainPipeline); id = strval(szResult);
  3909. cache_get_field_content(i, "Month", szResult, MainPipeline, 25);
  3910. format(szDialog, sizeof(szDialog), "%s\n%s ", szDialog, szResult);
  3911. Selected[index][i] = id;
  3912. }
  3913. ShowPlayerDialog(index, DIALOG_VIEWSALE, DIALOG_STYLE_LIST, "Select a time frame", szDialog, "View", "Exit");
  3914. }
  3915. else
  3916. {
  3917. SendClientMessageEx(index, COLOR_WHITE, "There was an issue with checking the table.");
  3918. }
  3919. }
  3920. }
  3921.  
  3922. forward CheckSales2(index);
  3923. public CheckSales2(index)
  3924. {
  3925. if(IsPlayerConnected(index))
  3926. {
  3927. new rows, fields, szDialog[2500];
  3928. cache_get_data(rows, fields, MainPipeline);
  3929. if(rows)
  3930. {
  3931. new szResult[32], szField[15], Solds[MAX_ITEMS], Amount[MAX_ITEMS];
  3932. for(new z = 0; z < MAX_ITEMS; z++)
  3933. {
  3934. format(szField, sizeof(szField), "TotalSold%d", z);
  3935. cache_get_field_content(0, szField, szResult, MainPipeline);
  3936. Solds[z] = strval(szResult);
  3937.  
  3938. format(szField, sizeof(szField), "AmountMade%d", z);
  3939. cache_get_field_content(0, szField, szResult, MainPipeline);
  3940. Amount[z] = strval(szResult);
  3941. }
  3942.  
  3943. format(szDialog, sizeof(szDialog),"\
  3944. Gold VIP Sold: %d | Total Credits: %s\n\
  3945. Gold VIP Renew Sold: %d | Total Credits: %s\n\
  3946. Silver VIP Sold: %d | Total Credits: %s\n\
  3947. Bronze VIP Sold: %d | Total Credits: %s\n\
  3948. Toys Sold: %d | Total Credits: %s\n\
  3949. Cars Sold: %d | Total Credits: %s\n", Solds[0], number_format(Amount[0]), Solds[1], number_format(Amount[1]), Solds[2], number_format(Amount[2]), Solds[3], number_format(Amount[3]), Solds[4], number_format(Amount[4]),
  3950. Solds[5], number_format(Amount[5]));
  3951.  
  3952. format(szDialog, sizeof(szDialog), "%s\
  3953. Pokertables Sold: %d | Total Credits: %s\n\
  3954. Boomboxes Sold: %d | Total Credits: %s\n\
  3955. Paintball Tokens Sold: %d | Total Credits: %s\n\
  3956. EXP Tokens Sold: %d | Total Credits: %s\n\
  3957. Fireworks Sold: %d | Total Credits: %s\n", szDialog, Solds[6], number_format(Amount[6]), Solds[7], number_format(Amount[7]), Solds[8], number_format(Amount[8]), Solds[9], number_format(Amount[9]), Solds[10], number_format(Amount[10]));
  3958.  
  3959. format(szDialog, sizeof(szDialog), "%sBusiness Renew Regular Sold: %d | Total Credits: %s\n\
  3960. Business Renew Standard Sold: %d | Total Credits: %s\n\
  3961. Business Renew Premium Sold: %d | Total Credits: %s\n\
  3962. Houses Sold: %d | Total Credits: %s\n", szDialog, Solds[11], number_format(Amount[11]), Solds[12], number_format(Amount[12]), Solds[13], number_format(Amount[13]), Solds[14], number_format(Amount[14]));
  3963.  
  3964. format(szDialog, sizeof(szDialog), "%sHouse Moves Sold: %d | Total Credits: %s\n\
  3965. House Interiors Sold: %d | Total Credits: %s\n\
  3966. Reset Gift Timer Sold: %d | Total Credits: %s\n\
  3967. Advanced Health Care Sold: %d | Total Credits: %s\n",szDialog, Solds[15], number_format(Amount[15]), Solds[16], number_format(Amount[16]), Solds[17], number_format(Amount[17]), Solds[18], number_format(Amount[18]));
  3968.  
  3969. format(szDialog, sizeof(szDialog), "%sSuper Health Car Sold: %d | Total Credits: %s\n\
  3970. Rented Cars Sold: %d | Total Credits: %s\n\
  3971. Custom License Sold: %d | Total Credits: %s\n\
  3972. Additional Vehicle Slot Sold: %d | Total Credits: %s\n",szDialog, Solds[19], number_format(Amount[19]), Solds[20], number_format(Amount[20]),Solds[22], number_format(Amount[22]), Solds[23], number_format(Amount[23]));
  3973.  
  3974. format(szDialog, sizeof(szDialog), "%sGarage - Small Sold: %d | Total Credits: %s\n\
  3975. Garage - Medium Sold: %d | Total Credits: %s\n\
  3976. Garage - Large Sold: %d | Total Credits: %s\n\
  3977. Garage - Extra Large Sold: %d | Total Credits: %s\n", szDialog, Solds[24], number_format(Amount[24]), Solds[25], number_format(Amount[25]), Solds[26], number_format(Amount[26]), Solds[27], number_format(Amount[27]));
  3978.  
  3979. format(szDialog, sizeof(szDialog), "%sAdditional Toy Slot Sold: %d | Total Credits: %s\n\
  3980. Hunger Voucher: %d | Total Credits: %s\n\
  3981. Credits Transactions: %d | Total Credits %s\n", szDialog, Solds[28], number_format(Amount[28]), Solds[29], number_format(Amount[29]), Solds[21], number_format(Amount[21]));
  3982.  
  3983. format(szDialog, sizeof(szDialog), "%sTotal Amount of Credits spent: %s", szDialog,
  3984. number_format(Amount[0]+Amount[1]+Amount[2]+Amount[3]+Amount[4]+Amount[5]+Amount[6]+Amount[7]+Amount[8]+Amount[9]+Amount[10]+Amount[11]+Amount[12]+Amount[13]+Amount[14]+Amount[15]+Amount[16]+Amount[17]+Amount[18]+Amount[19]+Amount[20]+Amount[21]+Amount[22]+Amount[23]
  3985. +Amount[24]+Amount[25]+Amount[26]+Amount[27]+Amount[28]+Amount[29]));
  3986. ShowPlayerDialog(index, DIALOG_NOTHING, DIALOG_STYLE_MSGBOX, "Shop Statistics", szDialog, "Exit", "");
  3987. }
  3988. else
  3989. {
  3990. SendClientMessageEx(index, COLOR_GREY, "There was an issue with checking the table.");
  3991. }
  3992. }
  3993. }
  3994.  
  3995. forward LoadRentedCar(index);
  3996. public LoadRentedCar(index)
  3997. {
  3998. if(IsPlayerConnected(index))
  3999. {
  4000. new rows, fields;
  4001. cache_get_data(rows, fields, MainPipeline);
  4002. if(rows)
  4003. {
  4004. //`sqlid`, `modelid`, `posx`, `posy`, `posz`, `posa`, `spawned`, `hours`
  4005.  
  4006. new szResult[32], Info[2], Float: pos[4], string[128];
  4007. cache_get_field_content(0, "modelid", szResult, MainPipeline); Info[0] = strval(szResult);
  4008. cache_get_field_content(0, "posx", szResult, MainPipeline); pos[0] = strval(szResult);
  4009. cache_get_field_content(0, "posy", szResult, MainPipeline); pos[1] = strval(szResult);
  4010. cache_get_field_content(0, "posz", szResult, MainPipeline); pos[2] = strval(szResult);
  4011. cache_get_field_content(0, "posa", szResult, MainPipeline); pos[3] = strval(szResult);
  4012. cache_get_field_content(0, "hours", szResult, MainPipeline); Info[1] = strval(szResult);
  4013.  
  4014. SetPVarInt(index, "RentedHours", Info[1]);
  4015. SetPVarInt(index, "RentedVehicle", CreateVehicle(Info[0],pos[0],pos[1], pos[2], pos[3], random(128), random(128), 2000000));
  4016.  
  4017. format(string, sizeof(string), "Your rented vehicle has been spawned and has %d minute(s) left.", Info[1]);
  4018. SendClientMessageEx(index, COLOR_CYAN, string);
  4019. }
  4020. }
  4021. }
  4022.  
  4023. forward LoadTicket(playerid);
  4024. public LoadTicket(playerid) {
  4025. new rows, fields;
  4026. cache_get_data(rows, fields, MainPipeline);
  4027.  
  4028. if (rows == 0) {
  4029. return 1;
  4030. }
  4031.  
  4032. new number, result[10];
  4033. for(new i; i < rows; i++)
  4034. {
  4035. cache_get_field_content(i, "number", result, MainPipeline);
  4036. number = strval(result);
  4037. LottoNumbers[playerid][i] = number;
  4038. }
  4039. return 1;
  4040. }
  4041.  
  4042. forward LoadTreasureInvent(playerid);
  4043. public LoadTreasureInvent(playerid)
  4044. {
  4045. new rows, fields, szResult[10];
  4046. cache_get_data(rows, fields, MainPipeline);
  4047.  
  4048. if(IsPlayerConnected(playerid))
  4049. {
  4050. if(!rows)
  4051. {
  4052. new query[60];
  4053. format(query, sizeof(query), "INSERT INTO `jobstuff` (`pId`) VALUES ('%d')", GetPlayerSQLId(playerid));
  4054. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  4055. }
  4056. else
  4057. {
  4058. for(new row;row < rows;row++)
  4059. {
  4060. cache_get_field_content(row, "junkmetal", szResult, MainPipeline); SetPVarInt(playerid, "JunkMetal", strval(szResult));
  4061. cache_get_field_content(row, "newcoin", szResult, MainPipeline); SetPVarInt(playerid, "newcoin", strval(szResult));
  4062. cache_get_field_content(row, "oldcoin", szResult, MainPipeline); SetPVarInt(playerid, "oldcoin", strval(szResult));
  4063. cache_get_field_content(row, "brokenwatch", szResult, MainPipeline); SetPVarInt(playerid, "brokenwatch", strval(szResult));
  4064. cache_get_field_content(row, "oldkey", szResult, MainPipeline); SetPVarInt(playerid, "oldkey", strval(szResult));
  4065. cache_get_field_content(row, "treasure", szResult, MainPipeline); SetPVarInt(playerid, "treasure", strval(szResult));
  4066. cache_get_field_content(row, "goldwatch", szResult, MainPipeline); SetPVarInt(playerid, "goldwatch", strval(szResult));
  4067. cache_get_field_content(row, "silvernugget", szResult, MainPipeline); SetPVarInt(playerid, "silvernugget", strval(szResult));
  4068. cache_get_field_content(row, "goldnugget", szResult, MainPipeline); SetPVarInt(playerid, "goldnugget", strval(szResult));
  4069. }
  4070. }
  4071. }
  4072. return 1;
  4073. }
  4074.  
  4075. forward GetHomeCount(playerid);
  4076. public GetHomeCount(playerid)
  4077. {
  4078. new string[128];
  4079. format(string, sizeof(string), "SELECT NULL FROM `houses` WHERE `OwnerID` = %d", GetPlayerSQLId(playerid));
  4080. return mysql_function_query(MainPipeline, string, true, "QueryGetCountFinish", "ii", playerid, 2);
  4081. }
  4082.  
  4083. forward AddReportToken(playerid);
  4084. public AddReportToken(playerid)
  4085. {
  4086. new
  4087. sz_playerName[MAX_PLAYER_NAME],
  4088. i_timestamp[3],
  4089. tdate[11],
  4090. thour[9],
  4091. query[128];
  4092.  
  4093. GetPlayerName(playerid, sz_playerName, MAX_PLAYER_NAME);
  4094. getdate(i_timestamp[0], i_timestamp[1], i_timestamp[2]);
  4095. format(tdate, sizeof(tdate), "%d-%02d-%02d", i_timestamp[0], i_timestamp[1], i_timestamp[2]);
  4096. format(thour, sizeof(thour), "%02d:00:00", hour);
  4097.  
  4098. format(query, sizeof(query), "SELECT NULL FROM `tokens_report` WHERE `playerid` = %d AND `date` = '%s' AND `hour` = '%s'", GetPlayerSQLId(playerid), tdate, thour);
  4099. mysql_function_query(MainPipeline, query, true, "QueryTokenFinish", "ii", playerid, 1);
  4100. return 1;
  4101. }
  4102.  
  4103. forward AddCAReportToken(playerid);
  4104. public AddCAReportToken(playerid)
  4105. {
  4106. new
  4107. sz_playerName[MAX_PLAYER_NAME],
  4108. i_timestamp[3],
  4109. tdate[11],
  4110. thour[9],
  4111. query[128];
  4112.  
  4113. GetPlayerName(playerid, sz_playerName, MAX_PLAYER_NAME);
  4114. getdate(i_timestamp[0], i_timestamp[1], i_timestamp[2]);
  4115. format(tdate, sizeof(tdate), "%d-%02d-%02d", i_timestamp[0], i_timestamp[1], i_timestamp[2]);
  4116. format(thour, sizeof(thour), "%02d:00:00", hour);
  4117.  
  4118. format(query, sizeof(query), "SELECT NULL FROM `tokens_request` WHERE `playerid` = %d AND `date` = '%s' AND `hour` = '%s'", GetPlayerSQLId(playerid), tdate, thour);
  4119. mysql_function_query(MainPipeline, query, true, "QueryTokenFinish", "ii", playerid, 2);
  4120. return 1;
  4121. }
  4122.  
  4123. forward AddCallToken(playerid);
  4124. public AddCallToken(playerid)
  4125. {
  4126. new
  4127. sz_playerName[MAX_PLAYER_NAME],
  4128. i_timestamp[3],
  4129. tdate[11],
  4130. query[128];
  4131.  
  4132. GetPlayerName(playerid, sz_playerName, MAX_PLAYER_NAME);
  4133. getdate(i_timestamp[0], i_timestamp[1], i_timestamp[2]);
  4134. format(tdate, sizeof(tdate), "%d-%02d-%02d", i_timestamp[0], i_timestamp[1], i_timestamp[2]);
  4135.  
  4136. format(query, sizeof(query), "SELECT NULL FROM `tokens_call` WHERE `playerid` = %d AND `date` = '%s' AND `hour` = %d", GetPlayerSQLId(playerid), tdate, hour);
  4137. mysql_function_query(MainPipeline, query, true, "QueryTokenFinish", "ii", playerid, 3);
  4138. return 1;
  4139. }
  4140.  
  4141. forward QueryTokenFinish(playerid, type);
  4142. public QueryTokenFinish(playerid, type)
  4143. {
  4144. new rows, fields, string[128], i_timestamp[3], tdate[11], thour[9];
  4145. cache_get_data(rows, fields, MainPipeline);
  4146. getdate(i_timestamp[0], i_timestamp[1], i_timestamp[2]);
  4147. format(tdate, sizeof(tdate), "%d-%02d-%02d", i_timestamp[0], i_timestamp[1], i_timestamp[2]);
  4148. format(thour, sizeof(thour), "%02d:00:00", hour);
  4149.  
  4150. switch(type)
  4151. {
  4152. case 1:
  4153. {
  4154. if(rows == 0)
  4155. {
  4156. format(string, sizeof(string), "INSERT INTO `tokens_report` (`id`, `playerid`, `date`, `hour`, `count`) VALUES (NULL, %d, '%s', '%s', 1)", GetPlayerSQLId(playerid), tdate, thour);
  4157. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  4158. }
  4159. else
  4160. {
  4161. format(string, sizeof(string), "UPDATE `tokens_report` SET `count` = count+1 WHERE `playerid` = %d AND `date` = '%s' AND `hour` = '%s'", GetPlayerSQLId(playerid), tdate, thour);
  4162. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  4163. }
  4164. }
  4165. case 2:
  4166. {
  4167. if(rows == 0)
  4168. {
  4169. format(string, sizeof(string), "INSERT INTO `tokens_request` (`id`, `playerid`, `date`, `hour`, `count`) VALUES (NULL, %d, '%s', '%s', 1)", GetPlayerSQLId(playerid), tdate, thour);
  4170. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  4171. }
  4172. else
  4173. {
  4174. format(string, sizeof(string), "UPDATE `tokens_request` SET `count` = count+1 WHERE `playerid` = %d AND `date` = '%s' AND `hour` = '%s'", GetPlayerSQLId(playerid), tdate, thour);
  4175. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  4176. }
  4177. }
  4178. case 3:
  4179. {
  4180. if(rows == 0)
  4181. {
  4182. format(string, sizeof(string), "INSERT INTO `tokens_call` (`id`, `playerid`, `date`, `hour`, `count`) VALUES (NULL, %d, '%s', %d, 1)", GetPlayerSQLId(playerid), tdate, hour);
  4183. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  4184. }
  4185. else
  4186. {
  4187. format(string, sizeof(string), "UPDATE `tokens_call` SET `count` = count+1 WHERE `playerid` = %d AND `date` = '%s' AND `hour` = %d", GetPlayerSQLId(playerid), tdate, hour);
  4188. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  4189. }
  4190. }
  4191. }
  4192. return 1;
  4193. }
  4194.  
  4195. forward GetReportCount(userid, tdate[]);
  4196. public GetReportCount(userid, tdate[])
  4197. {
  4198. new string[128];
  4199. format(string, sizeof(string), "SELECT SUM(count) FROM `tokens_report` WHERE `playerid` = %d AND `date` = '%s'", GetPlayerSQLId(userid), tdate);
  4200. return mysql_function_query(MainPipeline, string, true, "QueryGetCountFinish", "ii", userid, 0);
  4201. }
  4202.  
  4203. forward GetHourReportCount(userid, thour[], tdate[]);
  4204. public GetHourReportCount(userid, thour[], tdate[])
  4205. {
  4206. new string[128];
  4207. format(string, sizeof(string), "SELECT `count` FROM `tokens_report` WHERE `playerid` = %d AND `date` = '%s' AND `hour` = '%s'", GetPlayerSQLId(userid), tdate, thour);
  4208. return mysql_function_query(MainPipeline, string, true, "QueryGetCountFinish", "ii", userid, 1);
  4209. }
  4210.  
  4211. forward GetRequestCount(userid, tdate[]);
  4212. public GetRequestCount(userid, tdate[])
  4213. {
  4214. new string[128];
  4215. format(string, sizeof(string), "SELECT SUM(count) FROM `tokens_request` WHERE `playerid` = %d AND `date` = '%s'", GetPlayerSQLId(userid), tdate);
  4216. return mysql_function_query(MainPipeline, string, true, "QueryGetCountFinish", "ii", userid, 0);
  4217. }
  4218.  
  4219. forward GetHourRequestCount(userid, thour[], tdate[]);
  4220. public GetHourRequestCount(userid, thour[], tdate[])
  4221. {
  4222. new string[128];
  4223. format(string, sizeof(string), "SELECT `count` FROM `tokens_request` WHERE `playerid` = %d AND `date` = '%s' AND `hour` = '%s'", GetPlayerSQLId(userid), tdate, thour);
  4224. return mysql_function_query(MainPipeline, string, true, "QueryGetCountFinish", "ii", userid, 1);
  4225. }
  4226.  
  4227. forward QueryGetCountFinish(userid, type);
  4228. public QueryGetCountFinish(userid, type)
  4229. {
  4230. new rows, fields, sResult[24];
  4231. cache_get_data(rows, fields, MainPipeline);
  4232.  
  4233. switch(type)
  4234. {
  4235. case 0:
  4236. {
  4237. if(rows > 0)
  4238. {
  4239. cache_get_field_content(0, "SUM(count)", sResult, MainPipeline);
  4240. ReportCount[userid] = strval(sResult);
  4241. }
  4242. else ReportCount[userid] = 0;
  4243. }
  4244. case 1:
  4245. {
  4246. if(rows > 0)
  4247. {
  4248. cache_get_field_content(0, "count", sResult, MainPipeline);
  4249. ReportHourCount[userid] = strval(sResult);
  4250. }
  4251. else ReportHourCount[userid] = 0;
  4252. }
  4253. case 2:
  4254. {
  4255. Homes[userid] = rows;
  4256. }
  4257. }
  4258. return 1;
  4259. }
  4260.  
  4261. forward OnLoadFamilies();
  4262. public OnLoadFamilies()
  4263. {
  4264. new i, rows, fields, tmp[128], famid;
  4265. cache_get_data(rows, fields, MainPipeline);
  4266.  
  4267. new column[32];
  4268. while(i < rows)
  4269. {
  4270. FamilyMemberCount(i);
  4271. cache_get_field_content(i, "ID", tmp, MainPipeline); famid = strval(tmp);
  4272. cache_get_field_content(i, "Taken", tmp, MainPipeline); FamilyInfo[famid][FamilyTaken] = strval(tmp);
  4273. cache_get_field_content(i, "Name", FamilyInfo[famid][FamilyName], MainPipeline, 42);
  4274. cache_get_field_content(i, "Leader", FamilyInfo[famid][FamilyLeader], MainPipeline, MAX_PLAYER_NAME);
  4275. cache_get_field_content(i, "Bank", tmp, MainPipeline); FamilyInfo[famid][FamilyBank] = strval(tmp);
  4276. cache_get_field_content(i, "Cash", tmp, MainPipeline); FamilyInfo[famid][FamilyCash] = strval(tmp);
  4277. cache_get_field_content(i, "FamilyUSafe", tmp, MainPipeline); FamilyInfo[famid][FamilyUSafe] = strval(tmp);
  4278. cache_get_field_content(i, "FamilySafeX", tmp, MainPipeline); FamilyInfo[famid][FamilySafe][0] = floatstr(tmp);
  4279. cache_get_field_content(i, "FamilySafeY", tmp, MainPipeline); FamilyInfo[famid][FamilySafe][1] = floatstr(tmp);
  4280. cache_get_field_content(i, "FamilySafeZ", tmp, MainPipeline); FamilyInfo[famid][FamilySafe][2] = floatstr(tmp);
  4281. cache_get_field_content(i, "FamilySafeVW", tmp, MainPipeline); FamilyInfo[famid][FamilySafeVW] = strval(tmp);
  4282. cache_get_field_content(i, "FamilySafeInt", tmp, MainPipeline); FamilyInfo[famid][FamilySafeInt] = strval(tmp);
  4283. cache_get_field_content(i, "Pot", tmp, MainPipeline); FamilyInfo[famid][FamilyPot] = strval(tmp);
  4284. cache_get_field_content(i, "Crack", tmp, MainPipeline); FamilyInfo[famid][FamilyCrack] = strval(tmp);
  4285. cache_get_field_content(i, "Mats", tmp, MainPipeline); FamilyInfo[famid][FamilyMats] = strval(tmp);
  4286. cache_get_field_content(i, "Heroin", tmp, MainPipeline); FamilyInfo[famid][FamilyHeroin] = strval(tmp);
  4287. cache_get_field_content(i, "MaxSkins", tmp, MainPipeline); FamilyInfo[famid][FamilyMaxSkins] = strval(tmp);
  4288. cache_get_field_content(i, "Color", tmp, MainPipeline); FamilyInfo[famid][FamilyColor] = strval(tmp);
  4289. cache_get_field_content(i, "TurfTokens", tmp, MainPipeline); FamilyInfo[famid][FamilyTurfTokens] = strval(tmp);
  4290. cache_get_field_content(i, "ExteriorX", tmp, MainPipeline); FamilyInfo[famid][FamilyEntrance][0] = floatstr(tmp);
  4291. cache_get_field_content(i, "ExteriorY", tmp, MainPipeline); FamilyInfo[famid][FamilyEntrance][1] = floatstr(tmp);
  4292. cache_get_field_content(i, "ExteriorZ", tmp, MainPipeline); FamilyInfo[famid][FamilyEntrance][2] = floatstr(tmp);
  4293. cache_get_field_content(i, "ExteriorA", tmp, MainPipeline); FamilyInfo[famid][FamilyEntrance][3] = floatstr(tmp);
  4294. cache_get_field_content(i, "InteriorX", tmp, MainPipeline); FamilyInfo[famid][FamilyExit][0] = floatstr(tmp);
  4295. cache_get_field_content(i, "InteriorY", tmp, MainPipeline); FamilyInfo[famid][FamilyExit][1] = floatstr(tmp);
  4296. cache_get_field_content(i, "InteriorZ", tmp, MainPipeline); FamilyInfo[famid][FamilyExit][2] = floatstr(tmp);
  4297. cache_get_field_content(i, "InteriorA", tmp, MainPipeline); FamilyInfo[famid][FamilyExit][3] = floatstr(tmp);
  4298. cache_get_field_content(i, "INT", tmp, MainPipeline); FamilyInfo[famid][FamilyInterior] = strval(tmp);
  4299. cache_get_field_content(i, "VW", tmp, MainPipeline); FamilyInfo[famid][FamilyVirtualWorld] = strval(tmp);
  4300. cache_get_field_content(i, "CustomInterior", tmp, MainPipeline); FamilyInfo[famid][FamilyCustomMap] = strval(tmp);
  4301. cache_get_field_content(i, "GtObject", tmp, MainPipeline); FamilyInfo[famid][gtObject] = strval(tmp);
  4302. cache_get_field_content(i, "MOTD1", FamilyMOTD[famid][0], MainPipeline, 128);
  4303. cache_get_field_content(i, "MOTD2", FamilyMOTD[famid][1], MainPipeline, 128);
  4304. cache_get_field_content(i, "MOTD3", FamilyMOTD[famid][2], MainPipeline, 128);
  4305. cache_get_field_content(i, "fontface", tmp, MainPipeline); format(FamilyInfo[famid][gt_FontFace], 32, "%s", tmp);
  4306. cache_get_field_content(i, "fontsize", tmp, MainPipeline); FamilyInfo[famid][gt_FontSize] = strval(tmp);
  4307. cache_get_field_content(i, "bold", tmp, MainPipeline); FamilyInfo[famid][gt_Bold] = strval(tmp);
  4308. cache_get_field_content(i, "fontcolor", tmp, MainPipeline); FamilyInfo[famid][gt_FontColor] = strval(tmp);
  4309. cache_get_field_content(i, "text", FamilyInfo[famid][gt_Text], MainPipeline, 32);
  4310. cache_get_field_content(i, "gtUsed", tmp, MainPipeline); FamilyInfo[famid][gt_SPUsed] = strval(tmp);
  4311. if(strcmp(FamilyInfo[famid][gt_Text], "Preview", true) == 0)
  4312. {
  4313. FamilyInfo[famid][gtObject] = 1490;
  4314. FamilyInfo[famid][gt_SPUsed] = 1;
  4315. }
  4316. for (new j; j <= 6; j++) {
  4317. format(column,sizeof(column), "Rank%d", j);
  4318. cache_get_field_content(i, column, tmp, MainPipeline); format(FamilyRankInfo[famid][j], 20, "%s", tmp);
  4319. }
  4320.  
  4321. for (new j = 0; j < 5 ;j++) {
  4322. format(column, sizeof(column), "Division%d", j);
  4323. cache_get_field_content(i, column, tmp, MainPipeline); format(FamilyDivisionInfo[famid][j], 20, "%s", tmp);
  4324. }
  4325. for (new j; j < 8; j++) {
  4326. format(column,sizeof(column), "Skin%d", j+1);
  4327. cache_get_field_content(i, column, tmp, MainPipeline); FamilyInfo[famid][FamilySkins][j] = strval(tmp);
  4328. }
  4329. for (new j; j < 10; j++) {
  4330. format(column,sizeof(column), "Gun%d", j+1);
  4331. cache_get_field_content(i, column, tmp, MainPipeline); FamilyInfo[famid][FamilyGuns][j] = strval(tmp);
  4332. }
  4333. if(FamilyInfo[famid][FamilyUSafe] > 0)
  4334. {
  4335. FamilyInfo[famid][FamilyPickup] = CreateDynamicPickup(1239, 23, FamilyInfo[famid][FamilySafe][0], FamilyInfo[famid][FamilySafe][1], FamilyInfo[famid][FamilySafe][2], .worldid = FamilyInfo[famid][FamilySafeVW], .interiorid = FamilyInfo[famid][FamilySafeInt]);
  4336. }
  4337. if(FamilyInfo[famid][FamilyEntrance][0] != 0.0 && FamilyInfo[famid][FamilyEntrance][1] != 0.0)
  4338. {
  4339. new string[42];
  4340. FamilyInfo[famid][FamilyEntrancePickup] = CreateDynamicPickup(1318, 23, FamilyInfo[famid][FamilyEntrance][0], FamilyInfo[famid][FamilyEntrance][1], FamilyInfo[famid][FamilyEntrance][2]);
  4341. format(string, sizeof(string), "%s", FamilyInfo[famid][FamilyName]);
  4342. FamilyInfo[famid][FamilyEntranceText] = CreateDynamic3DTextLabel(string,COLOR_YELLOW,FamilyInfo[famid][FamilyEntrance][0], FamilyInfo[famid][FamilyEntrance][1], FamilyInfo[famid][FamilyEntrance][2]+0.6,4.0);
  4343. }
  4344. i++;
  4345. }
  4346. //LoadGangTags();
  4347. }
  4348.  
  4349. forward OnFamilyMemberCount(famid);
  4350. public OnFamilyMemberCount(famid)
  4351. {
  4352. new rows, fields;
  4353. cache_get_data(rows, fields, MainPipeline);
  4354. FamilyInfo[famid][FamilyMembers] = rows;
  4355. }
  4356.  
  4357. forward MailDeliveryTimer();
  4358. public MailDeliveryTimer()
  4359. {
  4360. mysql_function_query(MainPipeline, "UPDATE `letters` SET `Delivery_Min` = `Delivery_Min` - 1 WHERE `Delivery_Min` > 0", false, "OnQueryFinish", "i", SENDDATA_THREAD);
  4361. mysql_function_query(MainPipeline, "SELECT `Receiver_Id` FROM `letters` WHERE `Delivery_Min` = 1", true, "MailDeliveryQueryFinish", "");
  4362. return 1;
  4363. }
  4364.  
  4365. forward OnLoadGates();
  4366. public OnLoadGates()
  4367. {
  4368. new i, rows, fields, tmp[128];
  4369. cache_get_data(rows, fields, MainPipeline);
  4370.  
  4371. while(i < rows)
  4372. {
  4373. cache_get_field_content(i, "HID", tmp, MainPipeline); GateInfo[i][gHID] = strval(tmp);
  4374. cache_get_field_content(i, "Speed", tmp, MainPipeline); GateInfo[i][gSpeed] = floatstr(tmp);
  4375. cache_get_field_content(i, "Range", tmp, MainPipeline); GateInfo[i][gRange] = floatstr(tmp);
  4376. cache_get_field_content(i, "Model", tmp, MainPipeline); GateInfo[i][gModel] = strval(tmp);
  4377. cache_get_field_content(i, "VW", tmp, MainPipeline); GateInfo[i][gVW] = strval(tmp);
  4378. cache_get_field_content(i, "Int", tmp, MainPipeline); GateInfo[i][gInt] = strval(tmp);
  4379. cache_get_field_content(i, "Pass", GateInfo[i][gPass], MainPipeline, 24);
  4380. cache_get_field_content(i, "PosX", tmp, MainPipeline); GateInfo[i][gPosX] = floatstr(tmp);
  4381. cache_get_field_content(i, "PosY", tmp, MainPipeline); GateInfo[i][gPosY] = floatstr(tmp);
  4382. cache_get_field_content(i, "PosZ", tmp, MainPipeline); GateInfo[i][gPosZ] = floatstr(tmp);
  4383. cache_get_field_content(i, "RotX", tmp, MainPipeline); GateInfo[i][gRotX] = floatstr(tmp);
  4384. cache_get_field_content(i, "RotY", tmp, MainPipeline); GateInfo[i][gRotY] = floatstr(tmp);
  4385. cache_get_field_content(i, "RotZ", tmp, MainPipeline); GateInfo[i][gRotZ] = floatstr(tmp);
  4386. cache_get_field_content(i, "PosXM", tmp, MainPipeline); GateInfo[i][gPosXM] = floatstr(tmp);
  4387. cache_get_field_content(i, "PosYM", tmp, MainPipeline); GateInfo[i][gPosYM] = floatstr(tmp);
  4388. cache_get_field_content(i, "PosZM", tmp, MainPipeline); GateInfo[i][gPosZM] = floatstr(tmp);
  4389. cache_get_field_content(i, "RotXM", tmp, MainPipeline); GateInfo[i][gRotXM] = floatstr(tmp);
  4390. cache_get_field_content(i, "RotYM", tmp, MainPipeline); GateInfo[i][gRotYM] = floatstr(tmp);
  4391. cache_get_field_content(i, "RotZM", tmp, MainPipeline); GateInfo[i][gRotZM] = floatstr(tmp);
  4392. cache_get_field_content(i, "Allegiance", tmp, MainPipeline); GateInfo[i][gAllegiance] = strval(tmp);
  4393. cache_get_field_content(i, "GroupType", tmp, MainPipeline); GateInfo[i][gGroupType] = strval(tmp);
  4394. cache_get_field_content(i, "GroupID", tmp, MainPipeline); GateInfo[i][gGroupID] = strval(tmp);
  4395. cache_get_field_content(i, "FamilyID", tmp, MainPipeline); GateInfo[i][gFamilyID] = strval(tmp);
  4396. cache_get_field_content(i, "RenderHQ", tmp, MainPipeline); GateInfo[i][gRenderHQ] = strval(tmp);
  4397. cache_get_field_content(i, "Timer", tmp, MainPipeline); GateInfo[i][gTimer] = strval(tmp);
  4398. cache_get_field_content(i, "Automate", tmp, MainPipeline); GateInfo[i][gAutomate] = strval(tmp);
  4399. cache_get_field_content(i, "Locked", tmp, MainPipeline); GateInfo[i][gLocked] = strval(tmp);
  4400. CreateGate(i);
  4401. i++;
  4402. }
  4403. }
  4404.  
  4405. forward OnLoadDynamicMapIcon(index);
  4406. public OnLoadDynamicMapIcon(index)
  4407. {
  4408. new rows, fields, tmp[128];
  4409. cache_get_data(rows, fields, MainPipeline);
  4410.  
  4411. for(new row; row < rows; row++)
  4412. {
  4413. cache_get_field_content(row, "id", tmp, MainPipeline); DMPInfo[index][dmpSQLId] = strval(tmp);
  4414. cache_get_field_content(row, "MarkerType", tmp, MainPipeline); DMPInfo[index][dmpMarkerType] = strval(tmp);
  4415. cache_get_field_content(row, "Color", tmp, MainPipeline); DMPInfo[index][dmpColor] = strval(tmp);
  4416. cache_get_field_content(row, "VW", tmp, MainPipeline); DMPInfo[index][dmpVW] = strval(tmp);
  4417. cache_get_field_content(row, "Int", tmp, MainPipeline); DMPInfo[index][dmpInt] = strval(tmp);
  4418. cache_get_field_content(row, "PosX", tmp, MainPipeline); DMPInfo[index][dmpPosX] = floatstr(tmp);
  4419. cache_get_field_content(row, "PosY", tmp, MainPipeline); DMPInfo[index][dmpPosY] = floatstr(tmp);
  4420. cache_get_field_content(row, "PosZ", tmp, MainPipeline); DMPInfo[index][dmpPosZ] = floatstr(tmp);
  4421. if(DMPInfo[index][dmpMarkerType] != 0) DMPInfo[index][dmpMapIconID] = CreateDynamicMapIcon(DMPInfo[index][dmpPosX], DMPInfo[index][dmpPosY], DMPInfo[index][dmpPosZ], DMPInfo[index][dmpMarkerType], DMPInfo[index][dmpColor], DMPInfo[index][dmpVW], DMPInfo[index][dmpInt], -1, 500.0);
  4422. }
  4423. return 1;
  4424. }
  4425.  
  4426. forward OnLoadDynamicMapIcons();
  4427. public OnLoadDynamicMapIcons()
  4428. {
  4429. new i, rows, fields, tmp[128];
  4430. cache_get_data(rows, fields, MainPipeline);
  4431.  
  4432. while(i < rows)
  4433. {
  4434. cache_get_field_content(i, "id", tmp, MainPipeline); DMPInfo[i][dmpSQLId] = strval(tmp);
  4435. cache_get_field_content(i, "MarkerType", tmp, MainPipeline); DMPInfo[i][dmpMarkerType] = strval(tmp);
  4436. cache_get_field_content(i, "Color", tmp, MainPipeline); DMPInfo[i][dmpColor] = strval(tmp);
  4437. cache_get_field_content(i, "VW", tmp, MainPipeline); DMPInfo[i][dmpVW] = strval(tmp);
  4438. cache_get_field_content(i, "Int", tmp, MainPipeline); DMPInfo[i][dmpInt] = strval(tmp);
  4439. cache_get_field_content(i, "PosX", tmp, MainPipeline); DMPInfo[i][dmpPosX] = floatstr(tmp);
  4440. cache_get_field_content(i, "PosY", tmp, MainPipeline); DMPInfo[i][dmpPosY] = floatstr(tmp);
  4441. cache_get_field_content(i, "PosZ", tmp, MainPipeline); DMPInfo[i][dmpPosZ] = floatstr(tmp);
  4442. if(DMPInfo[i][dmpMarkerType] != 0) DMPInfo[i][dmpMapIconID] = CreateDynamicMapIcon(DMPInfo[i][dmpPosX], DMPInfo[i][dmpPosY], DMPInfo[i][dmpPosZ], DMPInfo[i][dmpMarkerType], DMPInfo[i][dmpColor], DMPInfo[i][dmpVW], DMPInfo[i][dmpInt], -1, 500.0);
  4443. i++;
  4444. }
  4445. if(i > 0) printf("[LoadDynamicMapIcons] %d map icons rehashed/loaded.", i);
  4446. else printf("[LoadDynamicMapIcons] Failed to load any map icons.");
  4447. return 1;
  4448. }
  4449.  
  4450. forward OnLoadDynamicDoor(index);
  4451. public OnLoadDynamicDoor(index)
  4452. {
  4453. new rows, fields, tmp[128];
  4454. cache_get_data(rows, fields, MainPipeline);
  4455.  
  4456. for(new row; row < rows; row++)
  4457. {
  4458. cache_get_field_content(rows, "id", tmp, MainPipeline); DDoorsInfo[index][ddSQLId] = strval(tmp);
  4459. cache_get_field_content(rows, "Description", DDoorsInfo[index][ddDescription], MainPipeline, 128);
  4460. cache_get_field_content(rows, "Owner", tmp, MainPipeline); DDoorsInfo[index][ddOwner] = strval(tmp);
  4461. cache_get_field_content(rows, "OwnerName", DDoorsInfo[index][ddOwnerName], MainPipeline, 42);
  4462. cache_get_field_content(rows, "CustomExterior", tmp, MainPipeline); DDoorsInfo[index][ddCustomExterior] = strval(tmp);
  4463. cache_get_field_content(rows, "CustomInterior", tmp, MainPipeline); DDoorsInfo[index][ddCustomInterior] = strval(tmp);
  4464. cache_get_field_content(rows, "ExteriorVW", tmp, MainPipeline); DDoorsInfo[index][ddExteriorVW] = strval(tmp);
  4465. cache_get_field_content(rows, "ExteriorInt", tmp, MainPipeline); DDoorsInfo[index][ddExteriorInt] = strval(tmp);
  4466. cache_get_field_content(rows, "InteriorVW", tmp, MainPipeline); DDoorsInfo[index][ddInteriorVW] = strval(tmp);
  4467. cache_get_field_content(rows, "InteriorInt", tmp, MainPipeline); DDoorsInfo[index][ddInteriorInt] = strval(tmp);
  4468. cache_get_field_content(rows, "ExteriorX", tmp, MainPipeline); DDoorsInfo[index][ddExteriorX] = floatstr(tmp);
  4469. cache_get_field_content(rows, "ExteriorY", tmp, MainPipeline); DDoorsInfo[index][ddExteriorY] = floatstr(tmp);
  4470. cache_get_field_content(rows, "ExteriorZ", tmp, MainPipeline); DDoorsInfo[index][ddExteriorZ] = floatstr(tmp);
  4471. cache_get_field_content(rows, "ExteriorA", tmp, MainPipeline); DDoorsInfo[index][ddExteriorA] = floatstr(tmp);
  4472. cache_get_field_content(rows, "InteriorX", tmp, MainPipeline); DDoorsInfo[index][ddInteriorX] = floatstr(tmp);
  4473. cache_get_field_content(rows, "InteriorY", tmp, MainPipeline); DDoorsInfo[index][ddInteriorY] = floatstr(tmp);
  4474. cache_get_field_content(rows, "InteriorZ", tmp, MainPipeline); DDoorsInfo[index][ddInteriorZ] = floatstr(tmp);
  4475. cache_get_field_content(rows, "InteriorA", tmp, MainPipeline); DDoorsInfo[index][ddInteriorA] = floatstr(tmp);
  4476. cache_get_field_content(rows, "Type", tmp, MainPipeline); DDoorsInfo[index][ddType] = strval(tmp);
  4477. cache_get_field_content(rows, "Rank", tmp, MainPipeline); DDoorsInfo[index][ddRank] = strval(tmp);
  4478. cache_get_field_content(rows, "VIP", tmp, MainPipeline); DDoorsInfo[index][ddVIP] = strval(tmp);
  4479. cache_get_field_content(rows, "Famed", tmp, MainPipeline); DDoorsInfo[index][ddFamed] = strval(tmp);
  4480. cache_get_field_content(rows, "DPC", tmp, MainPipeline); DDoorsInfo[index][ddDPC] = strval(tmp);
  4481. cache_get_field_content(rows, "Allegiance", tmp, MainPipeline); DDoorsInfo[index][ddAllegiance] = strval(tmp);
  4482. cache_get_field_content(rows, "GroupType", tmp, MainPipeline); DDoorsInfo[index][ddGroupType] = strval(tmp);
  4483. cache_get_field_content(rows, "Family", tmp, MainPipeline); DDoorsInfo[index][ddFamily] = strval(tmp);
  4484. cache_get_field_content(rows, "Faction", tmp, MainPipeline); DDoorsInfo[index][ddFaction] = strval(tmp);
  4485. cache_get_field_content(rows, "Admin", tmp, MainPipeline); DDoorsInfo[index][ddAdmin] = strval(tmp);
  4486. cache_get_field_content(rows, "Wanted", tmp, MainPipeline); DDoorsInfo[index][ddWanted] = strval(tmp);
  4487. cache_get_field_content(rows, "VehicleAble", tmp, MainPipeline); DDoorsInfo[index][ddVehicleAble] = strval(tmp);
  4488. cache_get_field_content(rows, "Color", tmp, MainPipeline); DDoorsInfo[index][ddColor] = strval(tmp);
  4489. cache_get_field_content(rows, "PickupModel", tmp, MainPipeline); DDoorsInfo[index][ddPickupModel] = strval(tmp);
  4490. cache_get_field_content(rows, "Pass", DDoorsInfo[index][ddPass], MainPipeline, 24);
  4491. cache_get_field_content(rows, "Locked", tmp, MainPipeline); DDoorsInfo[index][ddLocked] = strval(tmp);
  4492. if(strcmp(DDoorsInfo[index][ddDescription], "None", true) != 0) CreateDynamicDoor(index);
  4493. }
  4494. return 1;
  4495. }
  4496.  
  4497.  
  4498. forward OnLoadDynamicDoors();
  4499. public OnLoadDynamicDoors()
  4500. {
  4501. new i, rows, fields, tmp[128];
  4502. cache_get_data(rows, fields, MainPipeline);
  4503.  
  4504. while(i < rows)
  4505. {
  4506. cache_get_field_content(i, "id", tmp, MainPipeline); DDoorsInfo[i][ddSQLId] = strval(tmp);
  4507. cache_get_field_content(i, "Description", DDoorsInfo[i][ddDescription], MainPipeline, 128);
  4508. cache_get_field_content(i, "Owner", tmp, MainPipeline); DDoorsInfo[i][ddOwner] = strval(tmp);
  4509. cache_get_field_content(i, "OwnerName", DDoorsInfo[i][ddOwnerName], MainPipeline, 42);
  4510. cache_get_field_content(i, "CustomExterior", tmp, MainPipeline); DDoorsInfo[i][ddCustomExterior] = strval(tmp);
  4511. cache_get_field_content(i, "CustomInterior", tmp, MainPipeline); DDoorsInfo[i][ddCustomInterior] = strval(tmp);
  4512. cache_get_field_content(i, "ExteriorVW", tmp, MainPipeline); DDoorsInfo[i][ddExteriorVW] = strval(tmp);
  4513. cache_get_field_content(i, "ExteriorInt", tmp, MainPipeline); DDoorsInfo[i][ddExteriorInt] = strval(tmp);
  4514. cache_get_field_content(i, "InteriorVW", tmp, MainPipeline); DDoorsInfo[i][ddInteriorVW] = strval(tmp);
  4515. cache_get_field_content(i, "InteriorInt", tmp, MainPipeline); DDoorsInfo[i][ddInteriorInt] = strval(tmp);
  4516. cache_get_field_content(i, "ExteriorX", tmp, MainPipeline); DDoorsInfo[i][ddExteriorX] = floatstr(tmp);
  4517. cache_get_field_content(i, "ExteriorY", tmp, MainPipeline); DDoorsInfo[i][ddExteriorY] = floatstr(tmp);
  4518. cache_get_field_content(i, "ExteriorZ", tmp, MainPipeline); DDoorsInfo[i][ddExteriorZ] = floatstr(tmp);
  4519. cache_get_field_content(i, "ExteriorA", tmp, MainPipeline); DDoorsInfo[i][ddExteriorA] = floatstr(tmp);
  4520. cache_get_field_content(i, "InteriorX", tmp, MainPipeline); DDoorsInfo[i][ddInteriorX] = floatstr(tmp);
  4521. cache_get_field_content(i, "InteriorY", tmp, MainPipeline); DDoorsInfo[i][ddInteriorY] = floatstr(tmp);
  4522. cache_get_field_content(i, "InteriorZ", tmp, MainPipeline); DDoorsInfo[i][ddInteriorZ] = floatstr(tmp);
  4523. cache_get_field_content(i, "InteriorA", tmp, MainPipeline); DDoorsInfo[i][ddInteriorA] = floatstr(tmp);
  4524. cache_get_field_content(i, "Type", tmp, MainPipeline); DDoorsInfo[i][ddType] = strval(tmp);
  4525. cache_get_field_content(i, "Rank", tmp, MainPipeline); DDoorsInfo[i][ddRank] = strval(tmp);
  4526. cache_get_field_content(i, "VIP", tmp, MainPipeline); DDoorsInfo[i][ddVIP] = strval(tmp);
  4527. cache_get_field_content(i, "Famed", tmp, MainPipeline); DDoorsInfo[i][ddFamed] = strval(tmp);
  4528. cache_get_field_content(i, "DPC", tmp, MainPipeline); DDoorsInfo[i][ddDPC] = strval(tmp);
  4529. cache_get_field_content(i, "Allegiance", tmp, MainPipeline); DDoorsInfo[i][ddAllegiance] = strval(tmp);
  4530. cache_get_field_content(i, "GroupType", tmp, MainPipeline); DDoorsInfo[i][ddGroupType] = strval(tmp);
  4531. cache_get_field_content(i, "Family", tmp, MainPipeline); DDoorsInfo[i][ddFamily] = strval(tmp);
  4532. cache_get_field_content(i, "Faction", tmp, MainPipeline); DDoorsInfo[i][ddFaction] = strval(tmp);
  4533. cache_get_field_content(i, "Admin", tmp, MainPipeline); DDoorsInfo[i][ddAdmin] = strval(tmp);
  4534. cache_get_field_content(i, "Wanted", tmp, MainPipeline); DDoorsInfo[i][ddWanted] = strval(tmp);
  4535. cache_get_field_content(i, "VehicleAble", tmp, MainPipeline); DDoorsInfo[i][ddVehicleAble] = strval(tmp);
  4536. cache_get_field_content(i, "Color", tmp, MainPipeline); DDoorsInfo[i][ddColor] = strval(tmp);
  4537. cache_get_field_content(i, "PickupModel", tmp, MainPipeline); DDoorsInfo[i][ddPickupModel] = strval(tmp);
  4538. cache_get_field_content(i, "Pass", DDoorsInfo[i][ddPass], MainPipeline, 24);
  4539. cache_get_field_content(i, "Locked", tmp, MainPipeline); DDoorsInfo[i][ddLocked] = strval(tmp);
  4540. if(strcmp(DDoorsInfo[i][ddDescription], "None", true) != 0) CreateDynamicDoor(i);
  4541. i++;
  4542. }
  4543. if(i > 0) printf("[LoadDynamicDoors] %d doors rehashed/loaded.", i);
  4544. else printf("[LoadDynamicDoors] Failed to load any doors.");
  4545. return 1;
  4546. }
  4547.  
  4548. forward OnLoadHouse(index);
  4549. public OnLoadHouse(index)
  4550. {
  4551. new rows, fields, szField[24], tmp[128];
  4552. cache_get_data(rows, fields, MainPipeline);
  4553.  
  4554. for(new row; row < rows; row++)
  4555. {
  4556. cache_get_field_content(row, "id", tmp, MainPipeline); HouseInfo[index][hSQLId] = strval(tmp);
  4557. cache_get_field_content(row, "Owned", tmp, MainPipeline); HouseInfo[index][hOwned] = strval(tmp);
  4558. cache_get_field_content(row, "Level", tmp, MainPipeline); HouseInfo[index][hLevel] = strval(tmp);
  4559. cache_get_field_content(row, "Description", HouseInfo[index][hDescription], MainPipeline, 16);
  4560. cache_get_field_content(row, "OwnerID", tmp, MainPipeline); HouseInfo[index][hOwnerID] = strval(tmp);
  4561. cache_get_field_content(row, "Username", HouseInfo[index][hOwnerName], MainPipeline, MAX_PLAYER_NAME);
  4562. cache_get_field_content(row, "ExteriorX", tmp, MainPipeline); HouseInfo[index][hExteriorX] = floatstr(tmp);
  4563. cache_get_field_content(row, "ExteriorY", tmp, MainPipeline); HouseInfo[index][hExteriorY] = floatstr(tmp);
  4564. cache_get_field_content(row, "ExteriorZ", tmp, MainPipeline); HouseInfo[index][hExteriorZ] = floatstr(tmp);
  4565. cache_get_field_content(row, "ExteriorR", tmp, MainPipeline); HouseInfo[index][hExteriorR] = floatstr(tmp);
  4566. cache_get_field_content(row, "ExteriorA", tmp, MainPipeline); HouseInfo[index][hExteriorA] = floatstr(tmp);
  4567. cache_get_field_content(row, "CustomExterior", tmp, MainPipeline); HouseInfo[index][hCustomExterior] = strval(tmp);
  4568. cache_get_field_content(row, "InteriorX", tmp, MainPipeline); HouseInfo[index][hInteriorX] = floatstr(tmp);
  4569. cache_get_field_content(row, "InteriorY", tmp, MainPipeline); HouseInfo[index][hInteriorY] = floatstr(tmp);
  4570. cache_get_field_content(row, "InteriorZ", tmp, MainPipeline); HouseInfo[index][hInteriorZ] = floatstr(tmp);
  4571. cache_get_field_content(row, "InteriorR", tmp, MainPipeline); HouseInfo[index][hInteriorR] = floatstr(tmp);
  4572. cache_get_field_content(row, "InteriorA", tmp, MainPipeline); HouseInfo[index][hInteriorA] = floatstr(tmp);
  4573. cache_get_field_content(row, "CustomInterior", tmp, MainPipeline); HouseInfo[index][hCustomInterior] = strval(tmp);
  4574. cache_get_field_content(row, "ExtIW", tmp, MainPipeline); HouseInfo[index][hExtIW] = strval(tmp);
  4575. cache_get_field_content(row, "ExtVW", tmp, MainPipeline); HouseInfo[index][hExtVW] = strval(tmp);
  4576. cache_get_field_content(row, "IntIW", tmp, MainPipeline); HouseInfo[index][hIntIW] = strval(tmp);
  4577. cache_get_field_content(row, "IntVW", tmp, MainPipeline); HouseInfo[index][hIntVW] = strval(tmp);
  4578. cache_get_field_content(row, "Lock", tmp, MainPipeline); HouseInfo[index][hLock] = strval(tmp);
  4579. cache_get_field_content(row, "Rentable", tmp, MainPipeline); HouseInfo[index][hRentable] = strval(tmp);
  4580. cache_get_field_content(row, "RentFee", tmp, MainPipeline); HouseInfo[index][hRentFee] = strval(tmp);
  4581. cache_get_field_content(row, "Value", tmp, MainPipeline); HouseInfo[index][hValue] = strval(tmp);
  4582. cache_get_field_content(row, "SafeMoney", tmp, MainPipeline); HouseInfo[index][hSafeMoney] = strval(tmp);
  4583. cache_get_field_content(row, "Pot", tmp, MainPipeline); HouseInfo[index][hPot] = strval(tmp);
  4584. cache_get_field_content(row, "Crack", tmp, MainPipeline); HouseInfo[index][hCrack] = strval(tmp);
  4585. cache_get_field_content(row, "Materials", tmp, MainPipeline); HouseInfo[index][hMaterials] = strval(tmp);
  4586. cache_get_field_content(row, "Heroin", tmp, MainPipeline); HouseInfo[index][hHeroin] = strval(tmp);
  4587. for(new i; i < 5; i++)
  4588. {
  4589. format(szField, sizeof(szField), "Weapons%d", i);
  4590. cache_get_field_content(row, szField, tmp, MainPipeline);
  4591. HouseInfo[index][hWeapons][i] = strval(tmp);
  4592. }
  4593. cache_get_field_content(row, "GLUpgrade", tmp, MainPipeline); HouseInfo[index][hGLUpgrade] = strval(tmp);
  4594. cache_get_field_content(row, "PickupID", tmp, MainPipeline); HouseInfo[index][hPickupID] = strval(tmp);
  4595. cache_get_field_content(row, "MailX", tmp, MainPipeline); HouseInfo[index][hMailX] = floatstr(tmp);
  4596. cache_get_field_content(row, "MailY", tmp, MainPipeline); HouseInfo[index][hMailY] = floatstr(tmp);
  4597. cache_get_field_content(row, "MailZ", tmp, MainPipeline); HouseInfo[index][hMailZ] = floatstr(tmp);
  4598. cache_get_field_content(row, "MailA", tmp, MainPipeline); HouseInfo[index][hMailA] = floatstr(tmp);
  4599. cache_get_field_content(row, "MailType", tmp, MainPipeline); HouseInfo[index][hMailType] = strval(tmp);
  4600. cache_get_field_content(row, "ClosetX", tmp, MainPipeline); HouseInfo[index][hClosetX] = floatstr(tmp);
  4601. cache_get_field_content(row, "ClosetY", tmp, MainPipeline); HouseInfo[index][hClosetY] = floatstr(tmp);
  4602. cache_get_field_content(row, "ClosetZ", tmp, MainPipeline); HouseInfo[index][hClosetZ] = floatstr(tmp);
  4603.  
  4604. ReloadHousePickup(index);
  4605. if(HouseInfo[index][hClosetX] != 0.0) HouseInfo[index][hClosetTextID] = CreateDynamic3DTextLabel("Closet\n/closet to use", 0xFFFFFF88, HouseInfo[index][hClosetX], HouseInfo[index][hClosetY], HouseInfo[index][hClosetZ]+0.5,10.0, .testlos = 1, .worldid = HouseInfo[index][hIntVW], .interiorid = HouseInfo[index][hIntIW], .streamdistance = 10.0);
  4606. if(HouseInfo[index][hMailX] != 0.0) RenderHouseMailbox(index);
  4607. }
  4608. return 1;
  4609. }
  4610.  
  4611. forward OnLoadHouses();
  4612. public OnLoadHouses()
  4613. {
  4614. new i, rows, fields, szField[24], tmp[128];
  4615. cache_get_data(rows, fields, MainPipeline);
  4616.  
  4617. while(i < rows)
  4618. {
  4619. cache_get_field_content(i, "id", tmp, MainPipeline); HouseInfo[i][hSQLId] = strval(tmp);
  4620. cache_get_field_content(i, "Owned", tmp, MainPipeline); HouseInfo[i][hOwned] = strval(tmp);
  4621. cache_get_field_content(i, "Level", tmp, MainPipeline); HouseInfo[i][hLevel] = strval(tmp);
  4622. cache_get_field_content(i, "Description", HouseInfo[i][hDescription], MainPipeline, 16);
  4623. cache_get_field_content(i, "OwnerID", tmp, MainPipeline); HouseInfo[i][hOwnerID] = strval(tmp);
  4624. cache_get_field_content(i, "Username", HouseInfo[i][hOwnerName], MainPipeline, MAX_PLAYER_NAME);
  4625. cache_get_field_content(i, "ExteriorX", tmp, MainPipeline); HouseInfo[i][hExteriorX] = floatstr(tmp);
  4626. cache_get_field_content(i, "ExteriorY", tmp, MainPipeline); HouseInfo[i][hExteriorY] = floatstr(tmp);
  4627. cache_get_field_content(i, "ExteriorZ", tmp, MainPipeline); HouseInfo[i][hExteriorZ] = floatstr(tmp);
  4628. cache_get_field_content(i, "ExteriorR", tmp, MainPipeline); HouseInfo[i][hExteriorR] = floatstr(tmp);
  4629. cache_get_field_content(i, "ExteriorA", tmp, MainPipeline); HouseInfo[i][hExteriorA] = floatstr(tmp);
  4630. cache_get_field_content(i, "CustomExterior", tmp, MainPipeline); HouseInfo[i][hCustomExterior] = strval(tmp);
  4631. cache_get_field_content(i, "InteriorX", tmp, MainPipeline); HouseInfo[i][hInteriorX] = floatstr(tmp);
  4632. cache_get_field_content(i, "InteriorY", tmp, MainPipeline); HouseInfo[i][hInteriorY] = floatstr(tmp);
  4633. cache_get_field_content(i, "InteriorZ", tmp, MainPipeline); HouseInfo[i][hInteriorZ] = floatstr(tmp);
  4634. cache_get_field_content(i, "InteriorR", tmp, MainPipeline); HouseInfo[i][hInteriorR] = floatstr(tmp);
  4635. cache_get_field_content(i, "InteriorA", tmp, MainPipeline); HouseInfo[i][hInteriorA] = floatstr(tmp);
  4636. cache_get_field_content(i, "CustomInterior", tmp, MainPipeline); HouseInfo[i][hCustomInterior] = strval(tmp);
  4637. cache_get_field_content(i, "ExtIW", tmp, MainPipeline); HouseInfo[i][hExtIW] = strval(tmp);
  4638. cache_get_field_content(i, "ExtVW", tmp, MainPipeline); HouseInfo[i][hExtVW] = strval(tmp);
  4639. cache_get_field_content(i, "IntIW", tmp, MainPipeline); HouseInfo[i][hIntIW] = strval(tmp);
  4640. cache_get_field_content(i, "IntVW", tmp, MainPipeline); HouseInfo[i][hIntVW] = strval(tmp);
  4641. cache_get_field_content(i, "Lock", tmp, MainPipeline); HouseInfo[i][hLock] = strval(tmp);
  4642. cache_get_field_content(i, "Rentable", tmp, MainPipeline); HouseInfo[i][hRentable] = strval(tmp);
  4643. cache_get_field_content(i, "RentFee", tmp, MainPipeline); HouseInfo[i][hRentFee] = strval(tmp);
  4644. cache_get_field_content(i, "Value", tmp, MainPipeline); HouseInfo[i][hValue] = strval(tmp);
  4645. cache_get_field_content(i, "SafeMoney", tmp, MainPipeline); HouseInfo[i][hSafeMoney] = strval(tmp);
  4646. cache_get_field_content(i, "Pot", tmp, MainPipeline); HouseInfo[i][hPot] = strval(tmp);
  4647. cache_get_field_content(i, "Crack", tmp, MainPipeline); HouseInfo[i][hCrack] = strval(tmp);
  4648. cache_get_field_content(i, "Materials", tmp, MainPipeline); HouseInfo[i][hMaterials] = strval(tmp);
  4649. cache_get_field_content(i, "Heroin", tmp, MainPipeline); HouseInfo[i][hHeroin] = strval(tmp);
  4650. for(new j; j < 5; j++)
  4651. {
  4652. format(szField, sizeof(szField), "Weapons%d", j);
  4653. cache_get_field_content(i, szField, tmp, MainPipeline);
  4654. HouseInfo[i][hWeapons][j] = strval(tmp);
  4655. }
  4656. cache_get_field_content(i, "GLUpgrade", tmp, MainPipeline); HouseInfo[i][hGLUpgrade] = strval(tmp);
  4657. cache_get_field_content(i, "PickupID", tmp, MainPipeline); HouseInfo[i][hPickupID] = strval(tmp);
  4658. cache_get_field_content(i, "MailX", tmp, MainPipeline); HouseInfo[i][hMailX] = floatstr(tmp);
  4659. cache_get_field_content(i, "MailY", tmp, MainPipeline); HouseInfo[i][hMailY] = floatstr(tmp);
  4660. cache_get_field_content(i, "MailZ", tmp, MainPipeline); HouseInfo[i][hMailZ] = floatstr(tmp);
  4661. cache_get_field_content(i, "MailA", tmp, MainPipeline); HouseInfo[i][hMailA] = floatstr(tmp);
  4662. cache_get_field_content(i, "MailType", tmp, MainPipeline); HouseInfo[i][hMailType] = strval(tmp);
  4663. cache_get_field_content(i, "ClosetX", tmp, MainPipeline); HouseInfo[i][hClosetX] = floatstr(tmp);
  4664. cache_get_field_content(i, "ClosetY", tmp, MainPipeline); HouseInfo[i][hClosetY] = floatstr(tmp);
  4665. cache_get_field_content(i, "ClosetZ", tmp, MainPipeline); HouseInfo[i][hClosetZ] = floatstr(tmp);
  4666.  
  4667. ReloadHousePickup(i);
  4668. if(HouseInfo[i][hClosetX] != 0.0) HouseInfo[i][hClosetTextID] = CreateDynamic3DTextLabel("Closet\n/closet to use", 0xFFFFFF88, HouseInfo[i][hClosetX], HouseInfo[i][hClosetY], HouseInfo[i][hClosetZ]+0.5,10.0, .testlos = 1, .worldid = HouseInfo[i][hIntVW], .interiorid = HouseInfo[i][hIntIW], .streamdistance = 10.0);
  4669. if(HouseInfo[i][hMailX] != 0.0) RenderHouseMailbox(i);
  4670. i++;
  4671. }
  4672. if(i > 0) printf("[LoadHouses] %d houses rehashed/loaded.", i);
  4673. else printf("[LoadHouses] Failed to load any houses.");
  4674. }
  4675.  
  4676. forward OnLoadMailboxes();
  4677. public OnLoadMailboxes()
  4678. {
  4679. new string[512], i;
  4680. new rows, fields;
  4681. cache_get_data(rows, fields, MainPipeline);
  4682. while(i<rows)
  4683. {
  4684. for(new field;field<fields;field++)
  4685. {
  4686. cache_get_row(i, field, string, MainPipeline);
  4687. switch(field)
  4688. {
  4689. case 1: MailBoxes[i][mbVW] = strval(string);
  4690. case 2: MailBoxes[i][mbInt] = strval(string);
  4691. case 3: MailBoxes[i][mbModel] = strval(string);
  4692. case 4: MailBoxes[i][mbPosX] = floatstr(string);
  4693. case 5: MailBoxes[i][mbPosY] = floatstr(string);
  4694. case 6: MailBoxes[i][mbPosZ] = floatstr(string);
  4695. case 7: MailBoxes[i][mbAngle] = floatstr(string);
  4696. }
  4697. }
  4698. RenderStreetMailbox(i);
  4699. i++;
  4700. }
  4701. if(i > 0) printf("[LoadMailboxes] %d mailboxes rehashed/loaded.", i);
  4702. else printf("[LoadMailboxes] Failed to load any mailboxes.");
  4703. return 1;
  4704. }
  4705.  
  4706. forward OnLoadSpeedCameras();
  4707. public OnLoadSpeedCameras()
  4708. {
  4709. new fields, rows, index, result[128];
  4710. cache_get_data(rows, fields, MainPipeline);
  4711.  
  4712. while ((index < rows))
  4713. {
  4714. cache_get_field_content(index, "id", result, MainPipeline); SpeedCameras[index][_scDatabase] = strval(result);
  4715. cache_get_field_content(index, "pos_x", result, MainPipeline); SpeedCameras[index][_scPosX] = floatstr(result);
  4716. cache_get_field_content(index, "pos_y", result, MainPipeline); SpeedCameras[index][_scPosY] = floatstr(result);
  4717. cache_get_field_content(index, "pos_z", result, MainPipeline); SpeedCameras[index][_scPosZ] = floatstr(result);
  4718. cache_get_field_content(index, "rotation", result, MainPipeline); SpeedCameras[index][_scRotation] = floatstr(result);
  4719. cache_get_field_content(index, "range", result, MainPipeline); SpeedCameras[index][_scRange] = floatstr(result);
  4720. cache_get_field_content(index, "speed_limit", result, MainPipeline); SpeedCameras[index][_scLimit] = floatstr(result);
  4721.  
  4722. SpeedCameras[index][_scActive] = true;
  4723. SpeedCameras[index][_scObjectId] = -1;
  4724. SpawnSpeedCamera(index);
  4725.  
  4726. index++;
  4727. }
  4728.  
  4729. if (index == 0)
  4730. printf("[SpeedCameras] No Speed Cameras loaded.");
  4731. else
  4732. printf("[SpeedCameras] Loaded %i Speed Cameras.", index);
  4733.  
  4734. return 1;
  4735. }
  4736.  
  4737. forward OnNewSpeedCamera(index);
  4738. public OnNewSpeedCamera(index)
  4739. {
  4740. new db = mysql_insert_id(MainPipeline);
  4741. SpeedCameras[index][_scDatabase] = db;
  4742. }
  4743.  
  4744. // @returns
  4745. // ID of new speed cam on success, or -1 on failure
  4746.  
  4747. forward OnLoadTxtLabel(index);
  4748. public OnLoadTxtLabel(index)
  4749. {
  4750. new rows, fields, tmp[128];
  4751. cache_get_data(rows, fields, MainPipeline);
  4752.  
  4753. for(new row; row < rows; row++)
  4754. {
  4755. cache_get_field_content(row, "id", tmp, MainPipeline); TxtLabels[index][tlSQLId] = strval(tmp);
  4756. cache_get_field_content(row, "Text", TxtLabels[index][tlText], MainPipeline, 128);
  4757. cache_get_field_content(row, "PosX", tmp, MainPipeline); TxtLabels[index][tlPosX] = floatstr(tmp);
  4758. cache_get_field_content(row, "PosY", tmp, MainPipeline); TxtLabels[index][tlPosY] = floatstr(tmp);
  4759. cache_get_field_content(row, "PosZ", tmp, MainPipeline); TxtLabels[index][tlPosZ] = floatstr(tmp);
  4760. cache_get_field_content(row, "VW", tmp, MainPipeline); TxtLabels[index][tlVW] = strval(tmp);
  4761. cache_get_field_content(row, "Int", tmp, MainPipeline); TxtLabels[index][tlInt] = strval(tmp);
  4762. cache_get_field_content(row, "Color", tmp, MainPipeline); TxtLabels[index][tlColor] = strval(tmp);
  4763. cache_get_field_content(row, "PickupModel", tmp, MainPipeline); TxtLabels[index][tlPickupModel] = strval(tmp);
  4764. if(strcmp(TxtLabels[index][tlText], "None", true) != 0) CreateTxtLabel(index);
  4765. }
  4766. return 1;
  4767. }
  4768.  
  4769. forward OnLoadTxtLabels();
  4770. public OnLoadTxtLabels()
  4771. {
  4772. new i, rows, fields, tmp[128];
  4773. cache_get_data(rows, fields, MainPipeline);
  4774.  
  4775. while(i < rows)
  4776. {
  4777. cache_get_field_content(i, "id", tmp, MainPipeline); TxtLabels[i][tlSQLId] = strval(tmp);
  4778. cache_get_field_content(i, "Text", TxtLabels[i][tlText], MainPipeline, 128);
  4779. cache_get_field_content(i, "PosX", tmp, MainPipeline); TxtLabels[i][tlPosX] = floatstr(tmp);
  4780. cache_get_field_content(i, "PosY", tmp, MainPipeline); TxtLabels[i][tlPosY] = floatstr(tmp);
  4781. cache_get_field_content(i, "PosZ", tmp, MainPipeline); TxtLabels[i][tlPosZ] = floatstr(tmp);
  4782. cache_get_field_content(i, "VW", tmp, MainPipeline); TxtLabels[i][tlVW] = strval(tmp);
  4783. cache_get_field_content(i, "Int", tmp, MainPipeline); TxtLabels[i][tlInt] = strval(tmp);
  4784. cache_get_field_content(i, "Color", tmp, MainPipeline); TxtLabels[i][tlColor] = strval(tmp);
  4785. cache_get_field_content(i, "PickupModel", tmp, MainPipeline); TxtLabels[i][tlPickupModel] = strval(tmp);
  4786. if(strcmp(TxtLabels[i][tlText], "None", true) != 0) CreateTxtLabel(i);
  4787. i++;
  4788. }
  4789. }
  4790.  
  4791. forward OnLoadPayNSprays();
  4792. public OnLoadPayNSprays()
  4793. {
  4794. new i, rows, fields, tmp[128], string[128];
  4795. cache_get_data(rows, fields, MainPipeline);
  4796.  
  4797. while(i < rows)
  4798. {
  4799. cache_get_field_content(i, "id", tmp, MainPipeline); PayNSprays[i][pnsSQLId] = strval(tmp);
  4800. cache_get_field_content(i, "Status", tmp, MainPipeline); PayNSprays[i][pnsStatus] = strval(tmp);
  4801. cache_get_field_content(i, "PosX", tmp, MainPipeline); PayNSprays[i][pnsPosX] = floatstr(tmp);
  4802. cache_get_field_content(i, "PosY", tmp, MainPipeline); PayNSprays[i][pnsPosY] = floatstr(tmp);
  4803. cache_get_field_content(i, "PosZ", tmp, MainPipeline); PayNSprays[i][pnsPosZ] = floatstr(tmp);
  4804. cache_get_field_content(i, "VW", tmp, MainPipeline); PayNSprays[i][pnsVW] = strval(tmp);
  4805. cache_get_field_content(i, "Int", tmp, MainPipeline); PayNSprays[i][pnsInt] = strval(tmp);
  4806. cache_get_field_content(i, "GroupCost", tmp, MainPipeline); PayNSprays[i][pnsGroupCost] = strval(tmp);
  4807. cache_get_field_content(i, "RegCost", tmp, MainPipeline); PayNSprays[i][pnsRegCost] = strval(tmp);
  4808. if(PayNSprays[i][pnsStatus] > 0)
  4809. {
  4810. format(string, sizeof(string), "/repaircar\nRepair Cost -- Regular: $%s | Faction: $%s\nID: %d", number_format(PayNSprays[i][pnsRegCost]), number_format(PayNSprays[i][pnsGroupCost]), i);
  4811. PayNSprays[i][pnsTextID] = CreateDynamic3DTextLabel(string, COLOR_RED, PayNSprays[i][pnsPosX], PayNSprays[i][pnsPosY], PayNSprays[i][pnsPosZ]+0.5,10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, PayNSprays[i][pnsVW], PayNSprays[i][pnsInt], -1);
  4812. PayNSprays[i][pnsPickupID] = CreateDynamicPickup(1239, 23, PayNSprays[i][pnsPosX], PayNSprays[i][pnsPosY], PayNSprays[i][pnsPosZ], PayNSprays[i][pnsVW]);
  4813. PayNSprays[i][pnsMapIconID] = CreateDynamicMapIcon(PayNSprays[i][pnsPosX], PayNSprays[i][pnsPosY], PayNSprays[i][pnsPosZ], 63, 0, PayNSprays[i][pnsVW], PayNSprays[i][pnsInt], -1, 500.0);
  4814. }
  4815. i++;
  4816. }
  4817. }
  4818.  
  4819. forward OnLoadArrestPoint(index);
  4820. public OnLoadArrestPoint(index)
  4821. {
  4822. new rows, fields, tmp[128], string[128];
  4823. cache_get_data(rows, fields, MainPipeline);
  4824.  
  4825. for(new row; row < rows; row++)
  4826. {
  4827. cache_get_field_content(row, "id", tmp, MainPipeline); ArrestPoints[index][arrestSQLId] = strval(tmp);
  4828. cache_get_field_content(row, "PosX", tmp, MainPipeline); ArrestPoints[index][arrestPosX] = floatstr(tmp);
  4829. cache_get_field_content(row, "PosY", tmp, MainPipeline); ArrestPoints[index][arrestPosY] = floatstr(tmp);
  4830. cache_get_field_content(row, "PosZ", tmp, MainPipeline); ArrestPoints[index][arrestPosZ] = floatstr(tmp);
  4831. cache_get_field_content(row, "VW", tmp, MainPipeline); ArrestPoints[index][arrestVW] = strval(tmp);
  4832. cache_get_field_content(row, "Int", tmp, MainPipeline); ArrestPoints[index][arrestInt] = strval(tmp);
  4833. cache_get_field_content(row, "Type", tmp, MainPipeline); ArrestPoints[index][arrestType] = strval(tmp);
  4834. if(ArrestPoints[index][arrestPosX] != 0)
  4835. {
  4836. switch(ArrestPoints[index][arrestType])
  4837. {
  4838. case 0:
  4839. {
  4840. format(string, sizeof(string), "/arrest\nArrest Point #%d", index);
  4841. ArrestPoints[index][arrestTextID] = CreateDynamic3DTextLabel(string, COLOR_DBLUE, ArrestPoints[index][arrestPosX], ArrestPoints[index][arrestPosY], ArrestPoints[index][arrestPosZ]+0.6, 4.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, ArrestPoints[index][arrestVW], ArrestPoints[index][arrestInt], -1);
  4842. ArrestPoints[index][arrestPickupID] = CreateDynamicPickup(1247, 23, ArrestPoints[index][arrestPosX], ArrestPoints[index][arrestPosY], ArrestPoints[index][arrestPosZ], ArrestPoints[index][arrestVW]);
  4843. }
  4844. case 2:
  4845. {
  4846. format(string, sizeof(string), "/docarrest\nArrest Point #%d", index);
  4847. ArrestPoints[index][arrestTextID] = CreateDynamic3DTextLabel(string, COLOR_DBLUE, ArrestPoints[index][arrestPosX], ArrestPoints[index][arrestPosY], ArrestPoints[index][arrestPosZ]+0.6, 4.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, ArrestPoints[index][arrestVW], ArrestPoints[index][arrestInt], -1);
  4848. ArrestPoints[index][arrestPickupID] = CreateDynamicPickup(1247, 23, ArrestPoints[index][arrestPosX], ArrestPoints[index][arrestPosY], ArrestPoints[index][arrestPosZ], ArrestPoints[index][arrestVW]);
  4849. }
  4850. case 3:
  4851. {
  4852. format(string, sizeof(string), "/warrantarrest\nArrest Point #%d", index);
  4853. ArrestPoints[index][arrestTextID] = CreateDynamic3DTextLabel(string, COLOR_DBLUE, ArrestPoints[index][arrestPosX], ArrestPoints[index][arrestPosY], ArrestPoints[index][arrestPosZ]+0.6, 4.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, ArrestPoints[index][arrestVW], ArrestPoints[index][arrestInt], -1);
  4854. ArrestPoints[index][arrestPickupID] = CreateDynamicPickup(1247, 23, ArrestPoints[index][arrestPosX], ArrestPoints[index][arrestPosY], ArrestPoints[index][arrestPosZ], ArrestPoints[index][arrestVW]);
  4855. }
  4856. case 4:
  4857. {
  4858. format(string, sizeof(string), "/jarrest\nArrest Point #%d", index);
  4859. ArrestPoints[index][arrestTextID] = CreateDynamic3DTextLabel(string, COLOR_DBLUE, ArrestPoints[index][arrestPosX], ArrestPoints[index][arrestPosY], ArrestPoints[index][arrestPosZ]+0.6, 4.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, ArrestPoints[index][arrestVW], ArrestPoints[index][arrestInt], -1);
  4860. ArrestPoints[index][arrestPickupID] = CreateDynamicPickup(1247, 23, ArrestPoints[index][arrestPosX], ArrestPoints[index][arrestPosY], ArrestPoints[index][arrestPosZ], ArrestPoints[index][arrestVW]);
  4861. }
  4862. }
  4863. }
  4864. }
  4865. return 1;
  4866. }
  4867.  
  4868. forward OnLoadArrestPoints();
  4869. public OnLoadArrestPoints()
  4870. {
  4871. new i, rows, fields, tmp[128], string[128];
  4872. cache_get_data(rows, fields, MainPipeline);
  4873.  
  4874. while(i < rows)
  4875. {
  4876. cache_get_field_content(i, "id", tmp, MainPipeline); ArrestPoints[i][arrestSQLId] = strval(tmp);
  4877. cache_get_field_content(i, "PosX", tmp, MainPipeline); ArrestPoints[i][arrestPosX] = floatstr(tmp);
  4878. cache_get_field_content(i, "PosY", tmp, MainPipeline); ArrestPoints[i][arrestPosY] = floatstr(tmp);
  4879. cache_get_field_content(i, "PosZ", tmp, MainPipeline); ArrestPoints[i][arrestPosZ] = floatstr(tmp);
  4880. cache_get_field_content(i, "VW", tmp, MainPipeline); ArrestPoints[i][arrestVW] = strval(tmp);
  4881. cache_get_field_content(i, "Int", tmp, MainPipeline); ArrestPoints[i][arrestInt] = strval(tmp);
  4882. cache_get_field_content(i, "Type", tmp, MainPipeline); ArrestPoints[i][arrestType] = strval(tmp);
  4883. if(ArrestPoints[i][arrestPosX] != 0)
  4884. {
  4885. switch(ArrestPoints[i][arrestType])
  4886. {
  4887. case 0:
  4888. {
  4889. format(string, sizeof(string), "/arrest\nArrest Point #%d", i);
  4890. ArrestPoints[i][arrestTextID] = CreateDynamic3DTextLabel(string, COLOR_DBLUE, ArrestPoints[i][arrestPosX], ArrestPoints[i][arrestPosY], ArrestPoints[i][arrestPosZ]+0.6, 4.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, ArrestPoints[i][arrestVW], ArrestPoints[i][arrestInt], -1);
  4891. ArrestPoints[i][arrestPickupID] = CreateDynamicPickup(1247, 23, ArrestPoints[i][arrestPosX], ArrestPoints[i][arrestPosY], ArrestPoints[i][arrestPosZ], ArrestPoints[i][arrestVW]);
  4892. }
  4893. case 2:
  4894. {
  4895. format(string, sizeof(string), "/docarrest\nArrest Point #%d", i);
  4896. ArrestPoints[i][arrestTextID] = CreateDynamic3DTextLabel(string, COLOR_DBLUE, ArrestPoints[i][arrestPosX], ArrestPoints[i][arrestPosY], ArrestPoints[i][arrestPosZ]+0.6, 4.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, ArrestPoints[i][arrestVW], ArrestPoints[i][arrestInt], -1);
  4897. ArrestPoints[i][arrestPickupID] = CreateDynamicPickup(1247, 23, ArrestPoints[i][arrestPosX], ArrestPoints[i][arrestPosY], ArrestPoints[i][arrestPosZ], ArrestPoints[i][arrestVW]);
  4898. }
  4899. case 3:
  4900. {
  4901. format(string, sizeof(string), "/warrantarrest\nArrest Point #%d", i);
  4902. ArrestPoints[i][arrestTextID] = CreateDynamic3DTextLabel(string, COLOR_DBLUE, ArrestPoints[i][arrestPosX], ArrestPoints[i][arrestPosY], ArrestPoints[i][arrestPosZ]+0.6, 4.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, ArrestPoints[i][arrestVW], ArrestPoints[i][arrestInt], -1);
  4903. ArrestPoints[i][arrestPickupID] = CreateDynamicPickup(1247, 23, ArrestPoints[i][arrestPosX], ArrestPoints[i][arrestPosY], ArrestPoints[i][arrestPosZ], ArrestPoints[i][arrestVW]);
  4904. }
  4905. case 4:
  4906. {
  4907. format(string, sizeof(string), "/jarrest\nArrest Point #%d", i);
  4908. ArrestPoints[i][arrestTextID] = CreateDynamic3DTextLabel(string, COLOR_DBLUE, ArrestPoints[i][arrestPosX], ArrestPoints[i][arrestPosY], ArrestPoints[i][arrestPosZ]+0.6, 4.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, ArrestPoints[i][arrestVW], ArrestPoints[i][arrestInt], -1);
  4909. ArrestPoints[i][arrestPickupID] = CreateDynamicPickup(1247, 23, ArrestPoints[i][arrestPosX], ArrestPoints[i][arrestPosY], ArrestPoints[i][arrestPosZ], ArrestPoints[i][arrestVW]);
  4910. }
  4911. }
  4912. }
  4913. i++;
  4914. }
  4915. }
  4916.  
  4917. forward OnLoadImpoundPoint(index);
  4918. public OnLoadImpoundPoint(index)
  4919. {
  4920. new rows, fields, tmp[128], string[128];
  4921. cache_get_data(rows, fields, MainPipeline);
  4922.  
  4923. for(new row; row < rows; row++)
  4924. {
  4925. cache_get_field_content(row, "id", tmp, MainPipeline); ImpoundPoints[index][impoundSQLId] = strval(tmp);
  4926. cache_get_field_content(row, "PosX", tmp, MainPipeline); ImpoundPoints[index][impoundPosX] = floatstr(tmp);
  4927. cache_get_field_content(row, "PosY", tmp, MainPipeline); ImpoundPoints[index][impoundPosY] = floatstr(tmp);
  4928. cache_get_field_content(row, "PosZ", tmp, MainPipeline); ImpoundPoints[index][impoundPosZ] = floatstr(tmp);
  4929. cache_get_field_content(row, "VW", tmp, MainPipeline); ImpoundPoints[index][impoundVW] = strval(tmp);
  4930. cache_get_field_content(row, "Int", tmp, MainPipeline); ImpoundPoints[index][impoundInt] = strval(tmp);
  4931. if(ImpoundPoints[index][impoundPosX] != 0)
  4932. {
  4933. format(string, sizeof(string), "Impound Yard #%d\nType /impound to impound a vehicle", index);
  4934. ImpoundPoints[index][impoundTextID] = CreateDynamic3DTextLabel(string, COLOR_YELLOW, ImpoundPoints[index][impoundPosX], ImpoundPoints[index][impoundPosY], ImpoundPoints[index][impoundPosZ]+0.6, 5.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, ImpoundPoints[index][impoundVW], ImpoundPoints[index][impoundInt], -1);
  4935. }
  4936. }
  4937. return 1;
  4938. }
  4939.  
  4940. forward OnLoadImpoundPoints();
  4941. public OnLoadImpoundPoints()
  4942. {
  4943. new i, rows, fields, tmp[128], string[128];
  4944. cache_get_data(rows, fields, MainPipeline);
  4945.  
  4946. while(i < rows)
  4947. {
  4948. cache_get_field_content(i, "id", tmp, MainPipeline); ImpoundPoints[i][impoundSQLId] = strval(tmp);
  4949. cache_get_field_content(i, "PosX", tmp, MainPipeline); ImpoundPoints[i][impoundPosX] = floatstr(tmp);
  4950. cache_get_field_content(i, "PosY", tmp, MainPipeline); ImpoundPoints[i][impoundPosY] = floatstr(tmp);
  4951. cache_get_field_content(i, "PosZ", tmp, MainPipeline); ImpoundPoints[i][impoundPosZ] = floatstr(tmp);
  4952. cache_get_field_content(i, "VW", tmp, MainPipeline); ImpoundPoints[i][impoundVW] = strval(tmp);
  4953. cache_get_field_content(i, "Int", tmp, MainPipeline); ImpoundPoints[i][impoundInt] = strval(tmp);
  4954. if(ImpoundPoints[i][impoundPosX] != 0)
  4955. {
  4956. format(string, sizeof(string), "Impound Yard #%d\nType /impound to impound a vehicle", i);
  4957. ImpoundPoints[i][impoundTextID] = CreateDynamic3DTextLabel(string, COLOR_YELLOW, ImpoundPoints[i][impoundPosX], ImpoundPoints[i][impoundPosY], ImpoundPoints[i][impoundPosZ]+0.6, 5.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, ImpoundPoints[i][impoundVW], ImpoundPoints[i][impoundInt], -1);
  4958. }
  4959. i++;
  4960. }
  4961. }
  4962.  
  4963. forward LoadDynamicGroups();
  4964. public LoadDynamicGroups()
  4965. {
  4966. mysql_function_query(MainPipeline, "SELECT * FROM `groups`", true, "Group_QueryFinish", "ii", GROUP_QUERY_LOAD, 0);
  4967. mysql_function_query(MainPipeline, "SELECT * FROM `lockers`", true, "Group_QueryFinish", "ii", GROUP_QUERY_LOCKERS, 0);
  4968. mysql_function_query(MainPipeline, "SELECT * FROM `jurisdictions`", true, "Group_QueryFinish", "ii", GROUP_QUERY_JURISDICTIONS, 0);
  4969. return ;
  4970. }
  4971.  
  4972. forward LoadDynamicGroupVehicles();
  4973. public LoadDynamicGroupVehicles()
  4974. {
  4975. mysql_function_query(MainPipeline, "SELECT * FROM `groupvehs`", true, "DynVeh_QueryFinish", "ii", GV_QUERY_LOAD, 0);
  4976. return 1;
  4977. }
  4978.  
  4979. forward ParkRentedVehicle(playerid, vehicleid, modelid, Float:X, Float:Y, Float:Z);
  4980. public ParkRentedVehicle(playerid, vehicleid, modelid, Float:X, Float:Y, Float:Z)
  4981. {
  4982. if(IsPlayerInRangeOfPoint(playerid, 1.0, X, Y, Z))
  4983. {
  4984. new Float:x, Float:y, Float:z, Float:angle, Float:health, string[180], Float: oldfuel, arrDamage[4];
  4985. GetVehicleHealth(vehicleid, health);
  4986. if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessageEx(playerid, COLOR_GREY, "You must be in the driver seat.");
  4987. if(health < 800) return SendClientMessageEx(playerid, COLOR_GREY, " Your vehicle is too damaged to park it.");
  4988.  
  4989. GetVehiclePos(vehicleid, x, y, z);
  4990. GetVehicleZAngle(vehicleid, angle);
  4991. SurfingCheck(vehicleid);
  4992. oldfuel = VehicleFuel[vehicleid];
  4993.  
  4994. GetVehicleDamageStatus(vehicleid, arrDamage[0], arrDamage[1], arrDamage[2], arrDamage[3]);
  4995. DestroyVehicle(GetPVarInt(playerid, "RentedVehicle"));
  4996. SetPVarInt(playerid, "RentedVehicle", CreateVehicle(modelid, x, y, z, angle, random(128), random(128), 2000000));
  4997. Vehicle_ResetData(GetPVarInt(playerid, "RentedVehicle"));
  4998. VehicleFuel[GetPVarInt(playerid, "RentedVehicle")] = oldfuel;
  4999. SetVehicleHealth(GetPVarInt(playerid, "RentedVehicle"), health);
  5000. UpdateVehicleDamageStatus(vehicleid, arrDamage[0], arrDamage[1], arrDamage[2], arrDamage[3]);
  5001.  
  5002. format(string, sizeof(string), "UPDATE `rentedcars` SET `posx` = '%f', `posy` = '%f', `posz` = '%f', `posa` = '%f' WHERE `sqlid` = '%d'", x, y, z, angle, GetPlayerSQLId(playerid));
  5003. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "ii", SENDDATA_THREAD, playerid);
  5004.  
  5005. IsPlayerEntering{playerid} = true;
  5006. PutPlayerInVehicle(playerid, vehicleid, 0);
  5007. SetPlayerArmedWeapon(playerid, 0);
  5008. format(string, sizeof(string), "* %s has parked their vehicle.", GetPlayerNameEx(playerid));
  5009. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  5010.  
  5011. }
  5012. else
  5013. {
  5014. SendClientMessage(playerid, COLOR_WHITE, "Vehicle did not park because you moved!");
  5015. }
  5016. return 1;
  5017. }
  5018.  
  5019. forward OnPlayerChangePass(index);
  5020. public OnPlayerChangePass(index)
  5021. {
  5022. if(mysql_affected_rows(MainPipeline)) {
  5023.  
  5024. new
  5025. szBuffer[129],
  5026. szMessage[103];
  5027.  
  5028. GetPVarString(index, "PassChange", szBuffer, sizeof(szBuffer));
  5029. format(szMessage, sizeof(szMessage), "You have changed your password to '%s'.", szBuffer);
  5030. SendClientMessageEx(index, COLOR_YELLOW, szMessage);
  5031.  
  5032. format(szMessage, sizeof(szMessage), "%s (IP: %s) has changed their password.", GetPlayerNameEx(index), PlayerInfo[index][pIP]);
  5033. Log("logs/password.log", szMessage);
  5034. DeletePVar(index, "PassChange");
  5035.  
  5036. if(PlayerInfo[index][pForcePasswordChange] == 1)
  5037. {
  5038. PlayerInfo[index][pForcePasswordChange] = 0;
  5039. format(szMessage, sizeof(szMessage), "UPDATE `accounts` SET `ForcePasswordChange` = '0' WHERE `id` = '%i'", PlayerInfo[index][pId]);
  5040. mysql_function_query(MainPipeline, szMessage, false, "OnQueryFinish", "ii", SENDDATA_THREAD, index);
  5041. }
  5042. }
  5043. else SendClientMessageEx(index, COLOR_RED, "There was an issue with processing your request. Your password will remain as it is.");
  5044. return 1;
  5045. }
  5046.  
  5047. forward OnChangeUserPassword(index);
  5048. public OnChangeUserPassword(index)
  5049. {
  5050. if(GetPVarType(index, "ChangePin"))
  5051. {
  5052. new string[128], name[24];
  5053. GetPVarString(index, "OnChangeUserPassword", name, 24);
  5054.  
  5055. if(mysql_affected_rows(MainPipeline)) {
  5056. format(string, sizeof(string), "You have successfully changed %s's pin.", name);
  5057. SendClientMessageEx(index, COLOR_WHITE, string);
  5058. }
  5059. else {
  5060. format(string, sizeof(string), "There was an issue with changing %s's pin.", name);
  5061. SendClientMessageEx(index, COLOR_WHITE, string);
  5062. }
  5063. DeletePVar(index, "ChangePin");
  5064. DeletePVar(index, "OnChangeUserPassword");
  5065. }
  5066. else
  5067. {
  5068. new string[128], name[24];
  5069. GetPVarString(index, "OnChangeUserPassword", name, 24);
  5070.  
  5071. if(mysql_affected_rows(MainPipeline)) {
  5072. format(string, sizeof(string), "You have successfully changed %s's password.", name);
  5073. SendClientMessageEx(index, COLOR_WHITE, string);
  5074. }
  5075. else {
  5076. format(string, sizeof(string), "There was an issue with changing %s's password.", name);
  5077. SendClientMessageEx(index, COLOR_WHITE, string);
  5078. }
  5079. DeletePVar(index, "OnChangeUserPassword");
  5080. }
  5081. return 1;
  5082. }
  5083.  
  5084. forward QueryCheckCountFinish(playerid, giveplayername[], tdate[], type);
  5085. public QueryCheckCountFinish(playerid, giveplayername[], tdate[], type)
  5086. {
  5087. new string[128], rows, fields, sResult[24], tcount, hhour[9], chour;
  5088. cache_get_data(rows, fields, MainPipeline);
  5089.  
  5090. switch(type)
  5091. {
  5092. case 0:
  5093. {
  5094. cache_get_field_content(0, "SUM(count)", sResult, MainPipeline); tcount = strval(sResult);
  5095. if(tcount > 0)
  5096. {
  5097. format(string, sizeof(string), "%s accepted {%06x}%d {%06x}reports on %s.", giveplayername, COLOR_GREEN >>> 8, tcount, COLOR_WHITE >>> 8, tdate);
  5098. SendClientMessageEx(playerid, COLOR_WHITE, string);
  5099. }
  5100. else
  5101. {
  5102. format(string, sizeof(string), "%s did not accept any reports on %s.", giveplayername, tdate);
  5103. return SendClientMessageEx(playerid, COLOR_GRAD1, string);
  5104. }
  5105. }
  5106. case 1:
  5107. {
  5108. if(rows > 0)
  5109. {
  5110. SendClientMessageEx(playerid, COLOR_GRAD1, "By hour:");
  5111. for(new i; i < rows; i++)
  5112. {
  5113. cache_get_field_content(i, "count", sResult, MainPipeline); new hcount = strval(sResult);
  5114. cache_get_field_content(i, "hour", hhour, MainPipeline, sizeof(hhour));
  5115. format(hhour, sizeof(hhour), "%s", str_replace(":00:00", "", hhour));
  5116. chour = strval(hhour);
  5117. format(string, sizeof(string), "%s: {%06x}%d", ConvertToTwelveHour(chour), COLOR_GREEN >>> 8, hcount);
  5118. SendClientMessageEx(playerid, COLOR_WHITE, string);
  5119. }
  5120. }
  5121. }
  5122. case 2:
  5123. {
  5124. cache_get_field_content(0, "SUM(count)", sResult, MainPipeline); tcount = strval(sResult);
  5125. if(tcount > 0)
  5126. {
  5127. format(string, sizeof(string), "%s accepted {%06x}%d {%06x}help requests on %s.", giveplayername, COLOR_GREEN >>> 8, tcount, COLOR_WHITE >>> 8, tdate);
  5128. SendClientMessageEx(playerid, COLOR_WHITE, string);
  5129. }
  5130. else
  5131. {
  5132. format(string, sizeof(string), "%s did not accept any help requests on %s.", giveplayername, tdate);
  5133. return SendClientMessageEx(playerid, COLOR_GRAD1, string);
  5134. }
  5135. }
  5136. case 3:
  5137. {
  5138. if(rows > 0)
  5139. {
  5140. SendClientMessageEx(playerid, COLOR_GRAD1, "By hour:");
  5141. for(new i; i < rows; i++)
  5142. {
  5143. cache_get_field_content(i, "count", sResult, MainPipeline); new hcount = strval(sResult);
  5144. cache_get_field_content(i, "hour", hhour, MainPipeline, sizeof(hhour));
  5145. format(hhour, sizeof(hhour), "%s", str_replace(":00:00", "", hhour));
  5146. chour = strval(hhour);
  5147. format(string, sizeof(string), "%s: {%06x}%d", ConvertToTwelveHour(chour), COLOR_GREEN >>> 8, hcount);
  5148. SendClientMessageEx(playerid, COLOR_WHITE, string);
  5149. }
  5150. }
  5151. }
  5152. }
  5153. return 1;
  5154. }
  5155.  
  5156. forward QueryUsernameCheck(playerid, tdate[], type);
  5157. public QueryUsernameCheck(playerid, tdate[], type)
  5158. {
  5159. new string[128], rows, fields, giveplayerid, sResult[MAX_PLAYER_NAME];
  5160. cache_get_data(rows, fields, MainPipeline);
  5161.  
  5162. if(rows > 0)
  5163. {
  5164. switch(type)
  5165. {
  5166. case 0:
  5167. {
  5168. cache_get_field_content(0, "id", sResult, MainPipeline); giveplayerid = strval(sResult);
  5169. cache_get_field_content(0, "Username", sResult, MainPipeline, sizeof(sResult));
  5170. format(string, sizeof(string), "SELECT SUM(count) FROM `tokens_report` WHERE `playerid` = %d AND `date` = '%s'", giveplayerid, tdate);
  5171. mysql_function_query(MainPipeline, string, true, "QueryCheckCountFinish", "issi", playerid, sResult, tdate, 0);
  5172. format(string, sizeof(string), "SELECT `count`, `hour` FROM `tokens_report` WHERE `playerid` = %d AND `date` = '%s' ORDER BY `hour` ASC", giveplayerid, tdate);
  5173. mysql_function_query(MainPipeline, string, true, "QueryCheckCountFinish", "issi", playerid, sResult, tdate, 1);
  5174. }
  5175. case 1:
  5176. {
  5177. cache_get_field_content(0, "id", sResult, MainPipeline); giveplayerid = strval(sResult);
  5178. cache_get_field_content(0, "Username", sResult, MainPipeline, sizeof(sResult));
  5179. format(string, sizeof(string), "SELECT SUM(count) FROM `tokens_request` WHERE `playerid` = %d AND `date` = '%s'", giveplayerid, tdate);
  5180. mysql_function_query(MainPipeline, string, true, "QueryCheckCountFinish", "issi", playerid, sResult, tdate, 2);
  5181. format(string, sizeof(string), "SELECT `count`, `hour` FROM `tokens_request` WHERE `playerid` = %d AND `date` = '%s' ORDER BY `hour` ASC", giveplayerid, tdate);
  5182. mysql_function_query(MainPipeline, string, true, "QueryCheckCountFinish", "issi", playerid, sResult, tdate, 3);
  5183. }
  5184. }
  5185. }
  5186. else return SendClientMessageEx(playerid, COLOR_GRAD1, "That account doesn't exist!");
  5187. return 1;
  5188. }
  5189.  
  5190. forward OnBanPlayer(index);
  5191. public OnBanPlayer(index)
  5192. {
  5193. new string[128], name[24], reason[64];
  5194. GetPVarString(index, "OnBanPlayer", name, 24);
  5195. GetPVarString(index, "OnBanPlayerReason", reason, 64);
  5196.  
  5197. if(IsPlayerConnected(index))
  5198. {
  5199. if(mysql_affected_rows(MainPipeline)) {
  5200. format(string, sizeof(string), "You have successfully banned %s's account.", name);
  5201. SendClientMessageEx(index, COLOR_WHITE, string);
  5202.  
  5203. format(string, sizeof(string), "AdmCmd: %s was offline banned by %s, reason: %s", name, GetPlayerNameEx(index), reason);
  5204. Log("logs/ban.log", string);
  5205. format(string, 128, "AdmCmd: %s was offline banned by %s, reason: %s", name, GetPlayerNameEx(index), reason);
  5206. ABroadCast(COLOR_LIGHTRED,string,2);
  5207. print(string);
  5208. }
  5209. else {
  5210. format(string, sizeof(string), "There was an issue with banning %s's account.", name);
  5211. SendClientMessageEx(index, COLOR_WHITE, string);
  5212. }
  5213. DeletePVar(index, "OnBanPlayer");
  5214. DeletePVar(index, "OnBanPlayerReason");
  5215. }
  5216. return 1;
  5217. }
  5218.  
  5219. forward OnBanIP(index);
  5220. public OnBanIP(index)
  5221. {
  5222. if(IsPlayerConnected(index))
  5223. {
  5224. new rows, fields;
  5225. new string[128], ip[32], sqlid[5], id;
  5226. cache_get_data(rows, fields, MainPipeline);
  5227.  
  5228. if(rows)
  5229. {
  5230. cache_get_field_content(0, "id", sqlid, MainPipeline); id = strval(sqlid);
  5231. cache_get_field_content(0, "IP", ip, MainPipeline, 16);
  5232.  
  5233. MySQLBan(id, ip, "Offline Banned (/banaccount)", 1, GetPlayerNameEx(index));
  5234.  
  5235. format(string, sizeof(string), "INSERT INTO `ip_bans` (`ip`, `date`, `reason`, `admin`) VALUES ('%s', NOW(), '%s', '%s')", ip, "Offline Banned", GetPlayerNameEx(index));
  5236. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  5237. }
  5238. }
  5239. return 1;
  5240. }
  5241.  
  5242. forward OnUnbanPlayer(index);
  5243. public OnUnbanPlayer(index)
  5244. {
  5245. new string[128], name[24];
  5246. GetPVarString(index, "OnUnbanPlayer", name, 24);
  5247.  
  5248. if(mysql_affected_rows(MainPipeline)) {
  5249. format(string, sizeof(string), "You have successfully unbanned %s's account.", name);
  5250. SendClientMessageEx(index, COLOR_WHITE, string);
  5251.  
  5252. format(string, 128, "AdmCmd: %s was unbanned by %s.", name, GetPlayerNameEx(index));
  5253. ABroadCast(COLOR_LIGHTRED,string,2);
  5254. format(string, sizeof(string), "AdmCmd: %s was unbanned by %s.", name, GetPlayerNameEx(index));
  5255. Log("logs/ban.log", string);
  5256. print(string);
  5257. }
  5258. else {
  5259. format(string, sizeof(string), "There was an issue with unbanning %s's account.", name);
  5260. SendClientMessageEx(index, COLOR_WHITE, string);
  5261. }
  5262. DeletePVar(index, "OnUnbanPlayer");
  5263.  
  5264. return 1;
  5265. }
  5266.  
  5267. forward OnUnbanIP(index);
  5268. public OnUnbanIP(index)
  5269. {
  5270. if(IsPlayerConnected(index))
  5271. {
  5272. new string[128], ip[16];
  5273. new rows, fields;
  5274. cache_get_data(rows, fields, MainPipeline);
  5275. if(rows) {
  5276. cache_get_field_content(0, "IP", ip, MainPipeline, 16);
  5277. RemoveBan(index, ip);
  5278.  
  5279. format(string, sizeof(string), "UPDATE `bans` SET `status` = 4, `date_unban` = NOW() WHERE `ip_address` = '%s'", ip);
  5280. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  5281. }
  5282. }
  5283. return 1;
  5284. }
  5285.  
  5286. // Use this for generic "You have successfully altered X's account" messages... no need for 578947 public functions!
  5287. forward Query_OnExecution(iTargetID);
  5288. public Query_OnExecution(iTargetID) {
  5289.  
  5290. new
  5291. szName[MAX_PLAYER_NAME],
  5292. szMessage[64];
  5293.  
  5294. GetPVarString(iTargetID, "QueryEx_Name", szName, sizeof szName);
  5295. if(mysql_affected_rows(MainPipeline)) {
  5296. format(szMessage, sizeof szMessage, "The query on %s's account was successful.", szName);
  5297. SendClientMessageEx(iTargetID, COLOR_WHITE, szMessage);
  5298. }
  5299. else {
  5300. format(szMessage, sizeof szMessage, "The query on %s's account was unsuccessful.", szName);
  5301. SendClientMessageEx(iTargetID, COLOR_WHITE, szMessage);
  5302. }
  5303. return DeletePVar(iTargetID, "QueryEx_Name");
  5304. }
  5305.  
  5306. forward OnSetSuspended(index, value);
  5307. public OnSetSuspended(index, value)
  5308. {
  5309. new string[128], name[24];
  5310. GetPVarString(index, "OnSetSuspended", name, 24);
  5311.  
  5312. if(mysql_affected_rows(MainPipeline)) {
  5313. format(string, sizeof(string), "You have successfully %s %s's account.", ((value) ? ("suspended") : ("unsuspended")), name);
  5314. SendClientMessageEx(index, COLOR_WHITE, string);
  5315.  
  5316. format(string, sizeof(string), "AdmCmd: %s was offline %s by %s.", name, ((value) ? ("suspended") : ("unsuspended")), GetPlayerNameEx(index));
  5317. Log("logs/admin.log", string);
  5318. }
  5319. else {
  5320. format(string, sizeof(string), "There was an issue with %s %s's account.", ((value) ? ("suspending") : ("unsuspending")), name);
  5321. SendClientMessageEx(index, COLOR_WHITE, string);
  5322. }
  5323. DeletePVar(index, "OnSetSuspended");
  5324.  
  5325. return 1;
  5326. }
  5327. /*#if defined SHOPAUTOMATED
  5328. forward OnShopOrder(index);
  5329. public OnShopOrder(index)
  5330. {
  5331. if(IsPlayerConnected(index))
  5332. {
  5333. HideNoticeGUIFrame(index);
  5334. new rows, fields;
  5335. cache_get_data(rows, fields, ShopPipeline);
  5336. if(rows > 0)
  5337. {
  5338. new string[512];
  5339. new ipsql[16], ip[16];
  5340. GetPlayerIp(index, ip, sizeof(ip));
  5341. mysql_fetch_field_row(ipsql, "ip", MainPipeline);
  5342. cache_get_field_content(0, "ip", ipsql, ShopPipeline);
  5343. if(!isnull(ipsql) && strcmp(ipsql, ip, true) == 0)
  5344. {
  5345. new status[2], name[64], quantity[8], delivered[8], product_id[8];
  5346. for(new i;i<rows;i++)
  5347. {
  5348. cache_get_field_content(i, "order_status_id", status, ShopPipeline);
  5349. if(strval(status) == 2)
  5350. {
  5351. cache_get_field_content(i, "name", name, ShopPipeline);
  5352. cache_get_field_content(i, "quantity", quantity, ShopPipeline);
  5353. cache_get_field_content(i, "delivered", delivered, ShopPipeline);
  5354. cache_get_field_content(i, "order_product_id", product_id, ShopPipeline);
  5355. if(strval(quantity)-strval(delivered) <= 0)
  5356. {
  5357. if(i<rows) format(string, sizeof(string), "%s%s (Delivered)\n", string, name);
  5358. else format(string, sizeof(string), "%s%s (Delivered)", string, name);
  5359. }
  5360. else
  5361. {
  5362. if(i<rows) format(string, sizeof(string), "%s%s (%d)\n", string, name, strval(quantity)-strval(delivered));
  5363. else format(string, sizeof(string), "%s%s (%d)", string, name, strval(quantity)-strval(delivered));
  5364. }
  5365. }
  5366. else
  5367. {
  5368. new reason[27];
  5369. switch(strval(status))
  5370. {
  5371. case 0: format(reason, sizeof(reason), "{FF0000}No Payment");
  5372. case 1: format(reason, sizeof(reason), "{FF0000}Pending");
  5373. case 3: format(reason, sizeof(reason), "{00FF00}Shipped");
  5374. case 5:
  5375. {
  5376. ShowPlayerDialog(index, 0, DIALOG_STYLE_MSGBOX, "Shop Order Error", "This order has already been delivered", "OK", "");
  5377. return 1;
  5378. }
  5379. case 7: format(reason, sizeof(reason), "{FF0000}Cancelled");
  5380. case 8: format(reason, sizeof(reason), "{FF0000}Denied");
  5381. case 9: format(reason, sizeof(reason), "{FF0000}Cancelled Reversal");
  5382. case 10: format(reason, sizeof(reason), "{FF0000}Failed");
  5383. case 11: format(reason, sizeof(reason), "{00FF00}Refundend");
  5384. case 12: format(reason, sizeof(reason), "{FF0000}Reversed");
  5385. case 13: format(reason, sizeof(reason), "{FF0000}Chargeback");
  5386. default: format(reason, sizeof(reason), "{FF0000}Unknown");
  5387. }
  5388. format(string, sizeof(string), "We are unable to process that order at this time,\nbecause the payment is currently marked as: %s", reason);
  5389. ShowPlayerDialog(index, 0, DIALOG_STYLE_MSGBOX, "Shop Order Error", string, "OK", "");
  5390. return 1;
  5391. }
  5392. }
  5393. }
  5394. else
  5395. {
  5396. new email[256];
  5397. cache_get_field_content(0, "email", email, ShopPipeline);
  5398. SetPVarString(index, "ShopEmailVerify", email);
  5399. ShowPlayerDialog(index, DIALOG_SHOPORDEREMAIL, DIALOG_STYLE_INPUT, "Shop Order Error", "We were unable to link your order to your IP,\nfor further verification of your identity please input your shop e-mail address:", "Submit", "Cancel");
  5400. return 1;
  5401. }
  5402. ShowPlayerDialog(index, DIALOG_SHOPORDER2, DIALOG_STYLE_LIST, "Shop Order List", string, "Select", "Cancel");
  5403. }
  5404. else
  5405. {
  5406. ShowPlayerDialog(index, 0, DIALOG_STYLE_MSGBOX, "Shop Order Error", "Error: No orders were found by that Order ID\nIf you are sure that is the correct Order ID, please try again or input '1' for your order ID.", "OK", "");
  5407. }
  5408. }
  5409. return 1;
  5410. }
  5411.  
  5412. forward OnShopOrderEmailVer(index);
  5413. public OnShopOrderEmailVer(index)
  5414. {
  5415. if(IsPlayerConnected(index))
  5416. {
  5417. HideNoticeGUIFrame(index);
  5418. new rows, fields;
  5419. cache_get_data(rows, fields, ShopPipeline);
  5420. if(rows > 0)
  5421. {
  5422. new string[512];
  5423. new status[2], name[64], quantity[8], delivered[8], product_id[8];
  5424. for(new i;i<rows;i++)
  5425. {
  5426. cache_get_field_content(i, "order_status_id", status, ShopPipeline);
  5427. if(strval(status) == 2)
  5428. {
  5429. cache_get_field_content(i, "name", name, ShopPipeline);
  5430. cache_get_field_content(i, "quantity", quantity, ShopPipeline);
  5431. cache_get_field_content(i, "delivered", delivered, ShopPipeline);
  5432. cache_get_field_content(i, "order_product_id", product_id, ShopPipeline);
  5433. if(strval(quantity)-strval(delivered) <= 0)
  5434. {
  5435. if(i<rows) format(string, sizeof(string), "%s%s (Delivered)\n", string, name);
  5436. else format(string, sizeof(string), "%s%s (Delivered)", string, name);
  5437. }
  5438. else
  5439. {
  5440. if(i<rows) format(string, sizeof(string), "%s%s (%d)\n", string, name, strval(quantity)-strval(delivered));
  5441. else format(string, sizeof(string), "%s%s (%d)", string, name, strval(quantity)-strval(delivered));
  5442. }
  5443. }
  5444. else
  5445. {
  5446. new reason[27];
  5447. switch(strval(status))
  5448. {
  5449. case 0: format(reason, sizeof(reason), "{FF0000}No Payment");
  5450. case 1: format(reason, sizeof(reason), "{FF0000}Pending");
  5451. case 3: format(reason, sizeof(reason), "{00FF00}Shipped");
  5452. case 5:
  5453. {
  5454. ShowPlayerDialog(index, 0, DIALOG_STYLE_MSGBOX, "Shop Order Error", "This order has already been delivered", "OK", "");
  5455. return 1;
  5456. }
  5457. case 7: format(reason, sizeof(reason), "{FF0000}Cancelled");
  5458. case 8: format(reason, sizeof(reason), "{FF0000}Denied");
  5459. case 9: format(reason, sizeof(reason), "{FF0000}Cancelled Reversal");
  5460. case 10: format(reason, sizeof(reason), "{FF0000}Failed");
  5461. case 11: format(reason, sizeof(reason), "{00FF00}Refundend");
  5462. case 12: format(reason, sizeof(reason), "{FF0000}Reversed");
  5463. case 13: format(reason, sizeof(reason), "{FF0000}Chargeback");
  5464. default: format(reason, sizeof(reason), "{FF0000}Unknown");
  5465. }
  5466. format(string, sizeof(string), "We are unable to process that order at this time,\nbecause the payment is currently marked as: %s", reason);
  5467. ShowPlayerDialog(index, 0, DIALOG_STYLE_MSGBOX, "Shop Order Error", string, "OK", "");
  5468. return 1;
  5469. }
  5470. }
  5471. ShowPlayerDialog(index, DIALOG_SHOPORDER2, DIALOG_STYLE_LIST, "Shop Order List", string, "Select", "Cancel");
  5472. }
  5473. else
  5474. {
  5475. ShowPlayerDialog(index, 0, DIALOG_STYLE_MSGBOX, "Shop Order Error", "Error: No orders were found by that Order ID\nIf you are sure that is the correct Order ID, please try again or input '1' for your order ID.", "OK", "");
  5476. }
  5477. }
  5478. return 1;
  5479. }
  5480.  
  5481. forward OnShopOrder2(index, extraid);
  5482. public OnShopOrder2(index, extraid)
  5483. {
  5484. if(IsPlayerConnected(index))
  5485. {
  5486. HideNoticeGUIFrame(index);
  5487. new string[256];
  5488. new rows, fields;
  5489. cache_get_data(rows, fields, ShopPipeline);
  5490. if(rows > 0)
  5491. {
  5492. for(new i;i<rows;i++)
  5493. {
  5494. if(i == extraid)
  5495. {
  5496. new status[2];
  5497. cache_get_field_content(i, "status", status, ShopPipeline);
  5498. if(strval(status) == 2)
  5499. {
  5500. new order_id[8], order_product_id[8], product_id[8], name[64], price[8], user[32], quantity[8], delivered[8];
  5501. cache_get_field_content(i, "order_id", order_id, ShopPipeline);
  5502. cache_get_field_content(i, "order_product_id", order_product_id, ShopPipeline);
  5503. cache_get_field_content(i, "product_id", product_id, ShopPipeline);
  5504. cache_get_field_content(i, "name", name, ShopPipeline);
  5505. cache_get_field_content(i, "price", price, ShopPipeline);
  5506. cache_get_field_content(i, "deliveruser", user, ShopPipeline);
  5507. cache_get_field_content(i, "quantity", quantity, ShopPipeline);
  5508. cache_get_field_content(i, "delivered", delivered, ShopPipeline);
  5509.  
  5510. format(string, sizeof(string), "Order ID: %d\nProduct ID: %d\nProduct: %s\nPrice: %s\nName: %s\nQuantity: %d", \
  5511. strval(order_id), strval(order_product_id), name, price, user, strval(quantity)-strval(delivered));
  5512.  
  5513. SetPVarInt(index, "DShop_order_id", strval(order_id));
  5514. SetPVarInt(index, "DShop_product_id", strval(product_id));
  5515. SetPVarString(index, "DShop_name", name);
  5516. SetPVarInt(index, "DShop_quantity", strval(quantity)-strval(delivered));
  5517.  
  5518. ShowPlayerDialog(index, DIALOG_SHOPDELIVER, DIALOG_STYLE_LIST, "Shop Order Info", string, "Deliver", "Cancel");
  5519. return 1;
  5520. }
  5521. else
  5522. {
  5523. new reason[27];
  5524. switch(strval(status))
  5525. {
  5526. case 0: format(reason, sizeof(reason), "{FF0000}No Payment");
  5527. case 1: format(reason, sizeof(reason), "{FF0000}Pending");
  5528. case 3: format(reason, sizeof(reason), "{00FF00}Shipped");
  5529. case 5:
  5530. {
  5531. ShowPlayerDialog(index, 0, DIALOG_STYLE_MSGBOX, "Shop Order Error", "This order has already been delivered", "OK", "");
  5532. return 1;
  5533. }
  5534. case 7: format(reason, sizeof(reason), "{FF0000}Cancelled");
  5535. case 8: format(reason, sizeof(reason), "{FF0000}Denied");
  5536. case 9: format(reason, sizeof(reason), "{FF0000}Cancelled Reversal");
  5537. case 10: format(reason, sizeof(reason), "{FF0000}Failed");
  5538. case 11: format(reason, sizeof(reason), "{00FF00}Refundend");
  5539. case 12: format(reason, sizeof(reason), "{FF0000}Reversed");
  5540. case 13: format(reason, sizeof(reason), "{FF0000}Chargeback");
  5541. default: format(reason, sizeof(reason), "{FF0000}Unknown");
  5542. }
  5543. format(string, sizeof(string), "We are unable to process that order at this time,\nbecause the payment is currently marked as: %s", reason);
  5544. ShowPlayerDialog(index, 0, DIALOG_STYLE_MSGBOX, "Shop Order Error", string, "OK", "");
  5545. return 1;
  5546. }
  5547. }
  5548. }
  5549. }
  5550. else
  5551. {
  5552. ShowPlayerDialog(index, 0, DIALOG_STYLE_MSGBOX, "Shop Order Error", "Error: No orders were found by that Order ID\nIf you are sure that is the correct Order ID, please try again or input '1' for your order ID.", "OK", "");
  5553. }
  5554. }
  5555. return 1;
  5556. }
  5557. #endif*/
  5558.  
  5559. forward OnSetMyName(index);
  5560. public OnSetMyName(index)
  5561. {
  5562. if(IsPlayerConnected(index))
  5563. {
  5564. new rows, fields;
  5565. cache_get_data(rows, fields, MainPipeline);
  5566. if(!rows)
  5567. {
  5568. new string[128], tmpName[24];
  5569. GetPVarString(index, "OnSetMyName", tmpName, 24);
  5570.  
  5571. new name[MAX_PLAYER_NAME];
  5572. GetPlayerName(index, name, sizeof(name));
  5573. SetPVarString(index, "TempNameName", name);
  5574. if(strlen(tmpName) > 0)
  5575. {
  5576. SetPlayerName(index, tmpName);
  5577. format(string, sizeof(string), "%s has changed their name to %s.", name, tmpName);
  5578. Log("logs/undercover.log", string);
  5579. DeletePVar(index, "OnSetMyName");
  5580.  
  5581. format(string, sizeof(string), "You have temporarily set your name to %s.", tmpName);
  5582. SendClientMessageEx(index, COLOR_YELLOW, string);
  5583. SendClientMessageEx(index, COLOR_GRAD2, "NOTE: None of your stats will save until you type this command again.");
  5584. SetPVarInt(index, "TempName", 1);
  5585. }
  5586. }
  5587. else
  5588. {
  5589. SendClientMessageEx(index, COLOR_WHITE, "This name is already registered.");
  5590. }
  5591. }
  5592. else
  5593. {
  5594. DeletePVar(index, "OnSetMyName");
  5595. }
  5596. return 1;
  5597. }
  5598.  
  5599. forward OnSetName(index, extraid);
  5600. public OnSetName(index, extraid)
  5601. {
  5602. if(IsPlayerConnected(index))
  5603. {
  5604. if(IsPlayerConnected(extraid))
  5605. {
  5606. new rows, fields;
  5607. cache_get_data(rows, fields, MainPipeline);
  5608. if(rows < 1)
  5609. {
  5610. new string[128], tmpName[24], playername[24];
  5611. GetPVarString(index, "OnSetName", tmpName, 24);
  5612.  
  5613. GetPlayerName(extraid, playername, sizeof(playername));
  5614.  
  5615. UpdateCitizenApp(extraid, PlayerInfo[extraid][pNation]);
  5616.  
  5617. if(PlayerInfo[extraid][pMarriedID] != -1)
  5618. {
  5619. foreach(new i: Player)
  5620. {
  5621. if(PlayerInfo[extraid][pMarriedID] == GetPlayerSQLId(i)) format(PlayerInfo[i][pMarriedName], MAX_PLAYER_NAME, "%s", tmpName);
  5622. }
  5623. }
  5624.  
  5625. for(new i; i < MAX_DDOORS; i++)
  5626. {
  5627. if(DDoorsInfo[i][ddType] == 1 && DDoorsInfo[i][ddOwner] == GetPlayerSQLId(extraid))
  5628. {
  5629. strcat((DDoorsInfo[i][ddOwnerName][0] = 0, DDoorsInfo[i][ddOwnerName]), tmpName, 42);
  5630. DestroyDynamicPickup(DDoorsInfo[i][ddPickupID]);
  5631. if(IsValidDynamic3DTextLabel(DDoorsInfo[i][ddTextID])) DestroyDynamic3DTextLabel(DDoorsInfo[i][ddTextID]);
  5632. CreateDynamicDoor(i);
  5633. SaveDynamicDoor(i);
  5634. }
  5635. }
  5636.  
  5637. if(Homes[extraid] > 0)
  5638. {
  5639. for(new i; i < MAX_HOUSES; i++)
  5640. {
  5641. if(GetPlayerSQLId(extraid) == HouseInfo[i][hOwnerID])
  5642. {
  5643. format(HouseInfo[i][hOwnerName], MAX_PLAYER_NAME, "%s", tmpName);
  5644. SaveHouse(i);
  5645. ReloadHouseText(i);
  5646. }
  5647. }
  5648. }
  5649.  
  5650. if(PlayerInfo[extraid][pDonateRank] >= 1)
  5651. {
  5652. new string2[128];
  5653. format(string2, sizeof(string2), "[VIP NAMECHANGES] %s has changed their name to %s.", GetPlayerNameEx(extraid), tmpName);
  5654. Log("logs/vipnamechanges.log", string2);
  5655. }
  5656.  
  5657. if(strlen(tmpName) > 0)
  5658. {
  5659. format(string, sizeof(string), " Your name has been changed from %s to %s.", GetPlayerNameEx(extraid), tmpName);
  5660. SendClientMessageEx(extraid,COLOR_YELLOW,string);
  5661. format(string, sizeof(string), " You have changed %s's name to %s.", GetPlayerNameEx(extraid), tmpName);
  5662. SendClientMessageEx(index,COLOR_YELLOW,string);
  5663. format(string, sizeof(string), "%s changed %s's name to %s",GetPlayerNameEx(index),GetPlayerNameExt(extraid),tmpName);
  5664. Log("logs/stats.log", string);
  5665. if(SetPlayerName(extraid, tmpName) == 1)
  5666. {
  5667. format(string, sizeof(string), "UPDATE `accounts` SET `Username`='%s' WHERE `Username`='%s'", tmpName, playername);
  5668. mysql_function_query(MainPipeline, string, true, "OnSetNameTwo", "ii", index, extraid);
  5669. }
  5670. else
  5671. {
  5672. SendClientMessage(extraid, COLOR_REALRED, "There was an issue with your name change.");
  5673. format(string, sizeof(string), "%s's name change has failed due to incorrect size or characters.", GetPlayerNameExt(extraid));
  5674. SendClientMessage(extraid, COLOR_REALRED, string);
  5675. format(string, sizeof(string), "Error changing %s's name to %s", GetPlayerNameExt(extraid), tmpName);
  5676. Log("logs/stats.log", string);
  5677. return 1;
  5678. }
  5679. OnPlayerStatsUpdate(extraid);
  5680. }
  5681. }
  5682. }
  5683. }
  5684. DeletePVar(index, "OnSetName");
  5685. return 1;
  5686. }
  5687.  
  5688. forward OnSetNameTwo(index, extraid);
  5689. public OnSetNameTwo(index, extraid)
  5690. {
  5691. return 1;
  5692. }
  5693.  
  5694. forward OnApproveName(index, extraid);
  5695. public OnApproveName(index, extraid)
  5696. {
  5697. if(IsPlayerConnected(extraid))
  5698. {
  5699. new string[128];
  5700. new rows, fields;
  5701. cache_get_data(rows, fields, MainPipeline);
  5702. if(rows < 1)
  5703. {
  5704. new newname[24], oldname[24];
  5705. GetPVarString(extraid, "NewNameRequest", newname, 24);
  5706. GetPlayerName(extraid, oldname, sizeof(oldname));
  5707.  
  5708. UpdateCitizenApp(extraid, PlayerInfo[extraid][pNation]);
  5709.  
  5710. if(PlayerInfo[extraid][pMarriedID] != -1)
  5711. {
  5712. foreach(new i: Player)
  5713. {
  5714. if(PlayerInfo[extraid][pMarriedID] == GetPlayerSQLId(i)) format(PlayerInfo[i][pMarriedName], MAX_PLAYER_NAME, "%s", newname);
  5715. }
  5716. }
  5717.  
  5718. for(new i; i < MAX_DDOORS; i++)
  5719. {
  5720. if(DDoorsInfo[i][ddType] == 1 && DDoorsInfo[i][ddOwner] == GetPlayerSQLId(extraid))
  5721. {
  5722. strcat((DDoorsInfo[i][ddOwnerName][0] = 0, DDoorsInfo[i][ddOwnerName]), newname, 42);
  5723. DestroyDynamicPickup(DDoorsInfo[i][ddPickupID]);
  5724. if(IsValidDynamic3DTextLabel(DDoorsInfo[i][ddTextID])) DestroyDynamic3DTextLabel(DDoorsInfo[i][ddTextID]);
  5725. CreateDynamicDoor(i);
  5726. SaveDynamicDoor(i);
  5727. }
  5728. }
  5729.  
  5730. if(Homes[extraid] > 0)
  5731. {
  5732. for(new i; i < MAX_HOUSES; i++)
  5733. {
  5734. if(GetPlayerSQLId(extraid) == HouseInfo[i][hOwnerID])
  5735. {
  5736. format(HouseInfo[i][hOwnerName], MAX_PLAYER_NAME, "%s", newname);
  5737. SaveHouse(i);
  5738. ReloadHouseText(i);
  5739. }
  5740. }
  5741. }
  5742.  
  5743. if(PlayerInfo[extraid][pBusiness] != INVALID_BUSINESS_ID && Businesses[PlayerInfo[extraid][pBusiness]][bOwner] == GetPlayerSQLId(extraid))
  5744. {
  5745. strcpy(Businesses[PlayerInfo[extraid][pBusiness]][bOwnerName], newname, MAX_PLAYER_NAME);
  5746. SaveBusiness(PlayerInfo[extraid][pBusiness]);
  5747. RefreshBusinessPickup(PlayerInfo[extraid][pBusiness]);
  5748. }
  5749.  
  5750. if(PlayerInfo[extraid][pDonateRank] >= 1)
  5751. {
  5752. format(string, sizeof(string), "[VIP NAMECHANGES] %s has changed their name to %s.", GetPlayerNameEx(extraid), newname);
  5753. Log("logs/vipnamechanges.log", string);
  5754. }
  5755.  
  5756. if((0 <= PlayerInfo[extraid][pMember] < MAX_GROUPS) && PlayerInfo[extraid][pRank] >= arrGroupData[PlayerInfo[extraid][pMember]][g_iFreeNameChange])
  5757. {
  5758. if(strlen(newname) > 0)
  5759. {
  5760. format(string, sizeof(string), " Your name has been changed from %s to %s for free.", GetPlayerNameEx(extraid), newname);
  5761. SendClientMessageEx(extraid,COLOR_YELLOW,string);
  5762. format(string, sizeof(string), " You have changed %s's name to %s at no cost.", GetPlayerNameEx(extraid), newname);
  5763. SendClientMessageEx(index,COLOR_YELLOW,string);
  5764. format(string, sizeof(string), "%s changed \"%s\"s name to \"%s\" (id: %i) for free.",GetPlayerNameEx(index),GetPlayerNameEx(extraid),newname, GetPlayerSQLId(extraid));
  5765. Log("logs/stats.log", string);
  5766. format(string, sizeof(string), "%s has approved %s's name change to %s at no cost.",GetPlayerNameEx(index),GetPlayerNameEx(extraid), newname);
  5767. ABroadCast(COLOR_YELLOW, string, 3);
  5768.  
  5769.  
  5770. if(SetPlayerName(extraid, newname) == 1)
  5771. {
  5772. format(string, sizeof(string), "UPDATE `accounts` SET `Username`='%s' WHERE `Username`='%s'", newname, oldname);
  5773. mysql_function_query(MainPipeline, string, true, "OnApproveSetName", "ii", index, extraid);
  5774. }
  5775. else
  5776. {
  5777. SendClientMessage(extraid, COLOR_REALRED, "There was an issue with your name change.");
  5778. format(string, sizeof(string), "%s's name change has failed due to incorrect size or characters.", GetPlayerNameExt(extraid));
  5779. SendClientMessage(index, COLOR_REALRED, string);
  5780. format(string, sizeof(string), "Error changing %s's name to %s", GetPlayerNameExt(extraid), newname);
  5781. Log("logs/stats.log", string);
  5782. return 1;
  5783. }
  5784. DeletePVar(extraid, "RequestingNameChange");
  5785. }
  5786. }
  5787.  
  5788. else if(PlayerInfo[extraid][pAdmin] == 1 && PlayerInfo[extraid][pSMod] > 0)
  5789. {
  5790. if(strlen(newname) > 0)
  5791. {
  5792. format(string, sizeof(string), " Your name has been changed from %s to %s for free (Senior Mod).", GetPlayerNameEx(extraid), newname);
  5793. SendClientMessageEx(extraid,COLOR_YELLOW,string);
  5794. format(string, sizeof(string), " You have changed %s's name to %s at no cost.", GetPlayerNameEx(extraid), newname);
  5795. SendClientMessageEx(index,COLOR_YELLOW,string);
  5796. format(string, sizeof(string), "%s changed \"%s\"s name to \"%s\" (id: %i) for free (Senior Mod).",GetPlayerNameEx(index),GetPlayerNameEx(extraid),newname, GetPlayerSQLId(extraid));
  5797. Log("logs/stats.log", string);
  5798. format(string, sizeof(string), "%s has approved %s's name change to %s at no cost (Senior Mod).",GetPlayerNameEx(index),GetPlayerNameEx(extraid), newname);
  5799. ABroadCast(COLOR_YELLOW, string, 3);
  5800.  
  5801. if(SetPlayerName(extraid, newname) == 1)
  5802. {
  5803. format(string, sizeof(string), "UPDATE `accounts` SET `Username`='%s' WHERE `Username`='%s'", newname, oldname);
  5804. mysql_function_query(MainPipeline, string, true, "OnApproveSetName", "ii", index, extraid);
  5805. }
  5806. else
  5807. {
  5808. SendClientMessage(extraid, COLOR_REALRED, "There was an issue with your name change.");
  5809. format(string, sizeof(string), "%s's name change has failed due to incorrect size or characters.", GetPlayerNameExt(extraid));
  5810. SendClientMessage(index, COLOR_REALRED, string);
  5811. format(string, sizeof(string), "Error changing %s's name to %s", GetPlayerNameExt(extraid), newname);
  5812. Log("logs/stats.log", string);
  5813. return 1;
  5814. }
  5815. DeletePVar(extraid, "RequestingNameChange");
  5816. }
  5817. }
  5818.  
  5819. else
  5820. {
  5821. if(GetPVarInt(extraid, "NameChangeCost") == 0)
  5822. {
  5823. if(strlen(newname) > 0)
  5824. {
  5825. format(string, sizeof(string), " Your name has been changed from %s to %s for free (non-RP name).", GetPlayerNameEx(extraid), newname);
  5826. SendClientMessageEx(extraid,COLOR_YELLOW,string);
  5827. format(string, sizeof(string), " You have changed %s's name to %s for free (non-RP name).", GetPlayerNameEx(extraid), newname);
  5828. SendClientMessageEx(index,COLOR_YELLOW,string);
  5829. format(string, sizeof(string), "%s changed \"%s\"s name to \"%s\" (id: %i) for free (non-RP name).",GetPlayerNameEx(index),GetPlayerNameEx(extraid),newname, GetPlayerSQLId(extraid));
  5830. Log("logs/stats.log", string);
  5831. format(string, sizeof(string), "%s has approved %s's name change to %s for free (non-RP name).",GetPlayerNameEx(index),GetPlayerNameEx(extraid), newname);
  5832. ABroadCast(COLOR_YELLOW, string, 3);
  5833.  
  5834. if(SetPlayerName(extraid, newname) == 1)
  5835. {
  5836. format(string, sizeof(string), "UPDATE `accounts` SET `Username`='%s' WHERE `Username`='%s'", newname, oldname);
  5837. mysql_function_query(MainPipeline, string, true, "OnApproveSetName", "ii", index, extraid);
  5838. }
  5839. else
  5840. {
  5841. SendClientMessage(extraid, COLOR_REALRED, "There was an issue with your name change.");
  5842. format(string, sizeof(string), "%s's name change has failed due to incorrect size or characters.", GetPlayerNameExt(extraid));
  5843. SendClientMessage(index, COLOR_REALRED, string);
  5844. format(string, sizeof(string), "Error changing %s's name to %s", GetPlayerNameExt(extraid), newname);
  5845. Log("logs/stats.log", string);
  5846. return 1;
  5847. }
  5848. DeletePVar(extraid, "RequestingNameChange");
  5849. }
  5850. }
  5851. else
  5852. {
  5853. if(strlen(newname) > 0)
  5854. {
  5855. GivePlayerCash(extraid, -GetPVarInt(extraid, "NameChangeCost"));
  5856. format(string, sizeof(string), " Your name has been changed from %s to %s for $%d.", GetPlayerNameEx(extraid), newname, GetPVarInt(extraid, "NameChangeCost"));
  5857. SendClientMessageEx(extraid,COLOR_YELLOW,string);
  5858. format(string, sizeof(string), " You have changed %s's name to %s for $%d.", GetPlayerNameEx(extraid), newname, GetPVarInt(extraid, "NameChangeCost"));
  5859. SendClientMessageEx(index,COLOR_YELLOW,string);
  5860. format(string, sizeof(string), "%s changed \"%s\"s name to \"%s\" (id: %i) for $%d",GetPlayerNameEx(index),GetPlayerNameEx(extraid),newname, GetPlayerSQLId(extraid), GetPVarInt(extraid, "NameChangeCost"));
  5861. Log("logs/stats.log", string);
  5862. format(string, sizeof(string), "%s has approved %s's name change to %s for $%d",GetPlayerNameEx(index),GetPlayerNameEx(extraid), newname, GetPVarInt(extraid, "NameChangeCost"));
  5863. ABroadCast(COLOR_YELLOW, string, 3);
  5864.  
  5865. if(SetPlayerName(extraid, newname) == 1)
  5866. {
  5867. format(string, sizeof(string), "UPDATE `accounts` SET `Username`='%s' WHERE `Username`='%s'", newname, oldname);
  5868. mysql_function_query(MainPipeline, string, true, "OnApproveSetName", "ii", index, extraid);
  5869. }
  5870. else
  5871. {
  5872. SendClientMessage(extraid, COLOR_REALRED, "There was an issue with your name change.");
  5873. format(string, sizeof(string), "%s's name change has failed due to incorrect size or characters.", GetPlayerNameExt(extraid));
  5874. SendClientMessage(index, COLOR_REALRED, string);
  5875. format(string, sizeof(string), "Error changing %s's name to %s", GetPlayerNameExt(extraid), newname);
  5876. Log("logs/stats.log", string);
  5877. return 1;
  5878. }
  5879.  
  5880. DeletePVar(extraid, "RequestingNameChange");
  5881. }
  5882. }
  5883. }
  5884. }
  5885. else
  5886. {
  5887. SendClientMessageEx(extraid, COLOR_GRAD2, "That name already exists, please choose a different one.");
  5888. SendClientMessageEx(index, COLOR_GRAD2, "That name already exists.");
  5889. DeletePVar(extraid, "RequestingNameChange");
  5890. return 1;
  5891. }
  5892. }
  5893. return 1;
  5894. }
  5895.  
  5896. forward OnIPWhitelist(index);
  5897. public OnIPWhitelist(index)
  5898. {
  5899. new string[128], name[24];
  5900. GetPVarString(index, "OnIPWhitelist", name, 24);
  5901.  
  5902. if(mysql_affected_rows(MainPipeline)) {
  5903. format(string, sizeof(string), "You have successfully whitelisted %s's account.", name);
  5904. SendClientMessageEx(index, COLOR_WHITE, string);
  5905. format(string, sizeof(string), "%s has IP Whitelisted %s", GetPlayerNameEx(index), name);
  5906. Log("logs/whitelist.log", string);
  5907. }
  5908. else {
  5909. format(string, sizeof(string), "There was a issue with whitelisting %s's account.", name);
  5910. SendClientMessageEx(index, COLOR_WHITE, string);
  5911. }
  5912. DeletePVar(index, "OnIPWhitelist");
  5913.  
  5914. return 1;
  5915. }
  5916.  
  5917. forward OnIPCheck(index);
  5918. public OnIPCheck(index)
  5919. {
  5920. if(IsPlayerConnected(index))
  5921. {
  5922. new string[128], ip[16], name[24];
  5923. new rows, fields;
  5924. cache_get_data(rows, fields, MainPipeline);
  5925. if(rows)
  5926. {
  5927. cache_get_field_content(0, "IP", ip, MainPipeline, 16);
  5928. cache_get_field_content(0, "Username", name, MainPipeline, MAX_PLAYER_NAME);
  5929. format(string, sizeof(string), "%s's IP: %s", name, ip);
  5930. SendClientMessageEx(index, COLOR_WHITE, string);
  5931. format(string, sizeof(string), "%s has IP Checked %s", GetPlayerNameEx(index), name);
  5932. Log("logs/ipcheck.log", string);
  5933. }
  5934. else
  5935. {
  5936. SendClientMessageEx(index, COLOR_WHITE, "There was an issue with checking the account's IP.");
  5937. }
  5938. }
  5939. return 1;
  5940. }
  5941.  
  5942. forward OnProcessOrderCheck(index, extraid);
  5943. public OnProcessOrderCheck(index, extraid)
  5944. {
  5945. if(IsPlayerConnected(index))
  5946. {
  5947. new string[164],playerip[32], giveplayerip[32];
  5948. GetPlayerIp(index, playerip, sizeof(playerip));
  5949. GetPlayerIp(extraid, giveplayerip, sizeof(giveplayerip));
  5950.  
  5951. new rows, fields;
  5952. cache_get_data(rows, fields, MainPipeline);
  5953. if(rows)
  5954. {
  5955. SendClientMessageEx(index, COLOR_WHITE, "This order has previously been processed, therefore it did not count toward your pay.");
  5956. format(string, sizeof(string), "%s(IP: %s) has processed shop order ID %d from %s(IP: %s).", GetPlayerNameEx(index), playerip, GetPVarInt(index, "processorder"), GetPlayerNameEx(extraid), giveplayerip);
  5957. Log("logs/shoporders.log", string);
  5958. }
  5959. else
  5960. {
  5961. format(string, sizeof(string), "%s(IP: %s) has processed shop order ID %d from %s(IP: %s).", GetPlayerNameEx(index), playerip, GetPVarInt(index, "processorder"), GetPlayerNameEx(extraid), giveplayerip);
  5962. Log("logs/shopconfirmedorders.log", string);
  5963. PlayerInfo[index][pShopTechOrders]++;
  5964.  
  5965. format(string, sizeof(string), "INSERT INTO shoptech (id,total,dtotal) VALUES (%d,1,%f) ON DUPLICATE KEY UPDATE total = total + 1, dtotal = dtotal + %f", GetPlayerSQLId(index), ShopTechPay, ShopTechPay);
  5966. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "ii", SENDDATA_THREAD, index);
  5967.  
  5968. format(string, sizeof(string), "INSERT INTO `orders` (`id`) VALUES ('%d')", GetPVarInt(index, "processorder"));
  5969. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "ii", SENDDATA_THREAD, index);
  5970. }
  5971. DeletePVar(index, "processorder");
  5972. }
  5973. return 1;
  5974. }
  5975.  
  5976. forward OnFine(index);
  5977. public OnFine(index)
  5978. {
  5979. new string[128], name[24], amount, reason[64];
  5980. GetPVarString(index, "OnFine", name, 24);
  5981. amount = GetPVarInt(index, "OnFineAmount");
  5982. GetPVarString(index, "OnFineReason", reason, 64);
  5983.  
  5984. if(mysql_affected_rows(MainPipeline)) {
  5985. format(string, sizeof(string), "You have successfully fined %s's account.", name);
  5986. SendClientMessageEx(index, COLOR_WHITE, string);
  5987.  
  5988. format(string, sizeof(string), "AdmCmd: %s was offline fined $%d by %s, reason: %s", name, amount, GetPlayerNameEx(index), reason);
  5989. Log("logs/admin.log", string);
  5990. }
  5991. else {
  5992. format(string, sizeof(string), "There was an issue with fining %s's account.", name);
  5993. SendClientMessageEx(index, COLOR_WHITE, string);
  5994. }
  5995. DeletePVar(index, "OnFine");
  5996. DeletePVar(index, "OnFineAmount");
  5997. DeletePVar(index, "OnFineReason");
  5998.  
  5999. return 1;
  6000. }
  6001.  
  6002. forward OnSetDDOwner(playerid, doorid);
  6003. public OnSetDDOwner(playerid, doorid)
  6004. {
  6005. if(IsPlayerConnected(playerid))
  6006. {
  6007. new rows, fields;
  6008. new string[128], sqlid[5], playername[MAX_PLAYER_NAME], id;
  6009. cache_get_data(rows, fields, MainPipeline);
  6010.  
  6011. if(rows)
  6012. {
  6013. cache_get_field_content(0, "id", sqlid, MainPipeline); id = strval(sqlid);
  6014. cache_get_field_content(0, "Username", playername, MainPipeline, MAX_PLAYER_NAME);
  6015. strcat((DDoorsInfo[doorid][ddOwnerName][0] = 0, DDoorsInfo[doorid][ddOwnerName]), playername, MAX_PLAYER_NAME);
  6016. DDoorsInfo[doorid][ddOwner] = id;
  6017.  
  6018. format(string, sizeof(string), "Successfully set the owner to %s.", playername);
  6019. SendClientMessageEx(playerid, COLOR_WHITE, string);
  6020.  
  6021. DestroyDynamicPickup(DDoorsInfo[doorid][ddPickupID]);
  6022. if(IsValidDynamic3DTextLabel(DDoorsInfo[doorid][ddTextID])) DestroyDynamic3DTextLabel(DDoorsInfo[doorid][ddTextID]);
  6023. CreateDynamicDoor(doorid);
  6024. SaveDynamicDoor(doorid);
  6025. format(string, sizeof(string), "%s has edited door ID %d's owner to %s (SQL ID: %d).", GetPlayerNameEx(playerid), doorid, playername, id);
  6026. Log("logs/ddedit.log", string);
  6027. }
  6028. else SendClientMessageEx(playerid, COLOR_GREY, "That account name does not appear to exist.");
  6029. }
  6030. return 1;
  6031. }
  6032.  
  6033. forward OnPrisonAccount(index);
  6034. public OnPrisonAccount(index)
  6035. {
  6036. new string[128], name[24], reason[64];
  6037. GetPVarString(index, "OnPrisonAccount", name, 24);
  6038. GetPVarString(index, "OnPrisonAccountReason", reason, 64);
  6039.  
  6040. if(mysql_affected_rows(MainPipeline)) {
  6041. format(string, sizeof(string), "You have successfully prisoned %s's account.", name);
  6042. SendClientMessageEx(index, COLOR_WHITE, string);
  6043.  
  6044. format(string, sizeof(string), "AdmCmd: %s was offline prisoned by %s, reason: %s ", name, GetPlayerNameEx(index), reason);
  6045. Log("logs/admin.log", string);
  6046. }
  6047. else {
  6048. format(string, sizeof(string), "There was an issue with prisoning %s's account.");
  6049. SendClientMessageEx(index, COLOR_WHITE, string);
  6050. }
  6051. DeletePVar(index, "OnPrisonAccount");
  6052. DeletePVar(index, "OnPrisonAccountReason");
  6053.  
  6054. return 1;
  6055. }
  6056.  
  6057. forward OnJailAccount(index);
  6058. public OnJailAccount(index)
  6059. {
  6060. new string[128], name[24], reason[64];
  6061. GetPVarString(index, "OnJailAccount", name, 24);
  6062. GetPVarString(index, "OnJailAccountReason", reason, 64);
  6063.  
  6064. if(mysql_affected_rows(MainPipeline)) {
  6065. format(string, sizeof(string), "You have successfully jailed %s's account.", name);
  6066. SendClientMessageEx(index, COLOR_WHITE, string);
  6067.  
  6068. format(string, sizeof(string), "AdmCmd: %s was offline jailed by %s, reason: %s", name, GetPlayerNameEx(index), reason);
  6069. Log("logs/admin.log", string);
  6070. }
  6071. else {
  6072. format(string, sizeof(string), "There was an issue with jailing %s's account.", name);
  6073. SendClientMessageEx(index, COLOR_WHITE, string);
  6074. }
  6075.  
  6076. DeletePVar(index, "OnJailAccount");
  6077. DeletePVar(index, "OnJailAccountReason");
  6078.  
  6079. return 1;
  6080. }
  6081.  
  6082. forward OnGetLatestKills(playerid, giveplayerid);
  6083. public OnGetLatestKills(playerid, giveplayerid)
  6084. {
  6085. new string[128], killername[MAX_PLAYER_NAME], killedname[MAX_PLAYER_NAME], kDate[20], weapon[56], rows, fields;
  6086. cache_get_data(rows, fields, MainPipeline);
  6087. if(rows)
  6088. {
  6089. for(new i; i < rows; i++)
  6090. {
  6091. cache_get_row(i, 0, killername, MainPipeline, MAX_PLAYER_NAME);
  6092. cache_get_row(i, 1, killedname, MainPipeline, MAX_PLAYER_NAME);
  6093. cache_get_field_content(i, "killerid", string, MainPipeline); new killer = strval(string);
  6094. cache_get_field_content(i, "killedid", string, MainPipeline); new killed = strval(string);
  6095. cache_get_field_content(i, "date", kDate, MainPipeline, sizeof(kDate));
  6096. cache_get_field_content(i, "weapon", weapon, MainPipeline, sizeof(weapon));
  6097. if(GetPlayerSQLId(giveplayerid) == killer && GetPlayerSQLId(giveplayerid) == killed) format(string, sizeof(string), "[%s] %s killed themselves (%s)", kDate, StripUnderscore(killedname), weapon);
  6098. else if(GetPlayerSQLId(giveplayerid) == killer && GetPlayerSQLId(giveplayerid) != killed) format(string, sizeof(string), "[%s] %s killed %s with %s", kDate, StripUnderscore(killername), StripUnderscore(killedname), weapon);
  6099. else if(GetPlayerSQLId(giveplayerid) != killer && GetPlayerSQLId(giveplayerid) == killed) format(string, sizeof(string), "[%s] %s was killed by %s with %s", kDate, StripUnderscore(killedname), StripUnderscore(killername), weapon);
  6100. SendClientMessageEx(playerid, COLOR_YELLOW, string);
  6101. }
  6102. }
  6103. else SendClientMessageEx(playerid, COLOR_YELLOW, "No kills recorded on this player.");
  6104. return 1;
  6105. }
  6106.  
  6107. forward OnGetOKills(playerid);
  6108. public OnGetOKills(playerid)
  6109. {
  6110. if(IsPlayerConnected(playerid))
  6111. {
  6112. new string[256], giveplayername[MAX_PLAYER_NAME], giveplayerid;
  6113.  
  6114. new rows, fields;
  6115. cache_get_data(rows, fields, MainPipeline);
  6116.  
  6117. if(rows)
  6118. {
  6119. cache_get_field_content(0, "id", string, MainPipeline); giveplayerid = strval(string);
  6120. cache_get_field_content(0, "Username", giveplayername, MainPipeline, MAX_PLAYER_NAME);
  6121. format(string, sizeof(string), "SELECT Killer.Username, Killed.Username, k.* FROM Kills k LEFT JOIN accounts Killed ON k.killedid = Killed.id LEFT JOIN accounts Killer ON Killer.id = k.killerid WHERE k.killerid = %d OR k.killedid = %d ORDER BY `date` DESC LIMIT 10", giveplayerid, giveplayerid);
  6122. mysql_function_query(MainPipeline, string, true, "OnGetLatestOKills", "iis", playerid, giveplayerid, giveplayername);
  6123. }
  6124. else return SendClientMessageEx(playerid, COLOR_GREY, "This account does not exist.");
  6125. }
  6126. return 1;
  6127. }
  6128.  
  6129. forward OnGetLatestOKills(playerid, giveplayerid, giveplayername[]);
  6130. public OnGetLatestOKills(playerid, giveplayerid, giveplayername[])
  6131. {
  6132. new string[128], killername[MAX_PLAYER_NAME], killedname[MAX_PLAYER_NAME], kDate[20], weapon[56], rows, fields;
  6133. cache_get_data(rows, fields, MainPipeline);
  6134. if(rows)
  6135. {
  6136. SendClientMessageEx(playerid, COLOR_GREEN, "________________________________________________");
  6137. format(string, sizeof(string), "<< Last 10 Kills/Deaths of %s >>", StripUnderscore(giveplayername));
  6138. SendClientMessageEx(playerid, COLOR_YELLOW, string);
  6139. for(new i; i < rows; i++)
  6140. {
  6141. cache_get_row(i, 0, killername, MainPipeline, MAX_PLAYER_NAME);
  6142. cache_get_row(i, 1, killedname, MainPipeline, MAX_PLAYER_NAME);
  6143. cache_get_field_content(i, "killerid", string, MainPipeline); new killer = strval(string);
  6144. cache_get_field_content(i, "killedid", string, MainPipeline); new killed = strval(string);
  6145. cache_get_field_content(i, "date", kDate, MainPipeline, sizeof(kDate));
  6146. cache_get_field_content(i, "weapon", weapon, MainPipeline, sizeof(weapon));
  6147. if(giveplayerid == killer && giveplayerid == killed) format(string, sizeof(string), "[%s] %s killed themselves (%s)", kDate, StripUnderscore(killedname), weapon);
  6148. else if(giveplayerid == killer && giveplayerid != killed) format(string, sizeof(string), "[%s] %s killed %s with %s", kDate, StripUnderscore(killername), StripUnderscore(killedname), weapon);
  6149. else if(giveplayerid != killer && giveplayerid == killed) format(string, sizeof(string), "[%s] %s was killed by %s with %s", kDate, StripUnderscore(killedname), StripUnderscore(killername), weapon);
  6150. SendClientMessageEx(playerid, COLOR_YELLOW, string);
  6151. }
  6152. }
  6153. else return SendClientMessageEx(playerid, COLOR_YELLOW, "No kills recorded on this player.");
  6154. return 1;
  6155. }
  6156.  
  6157. forward OnDMStrikeReset(playerid, giveplayerid);
  6158. public OnDMStrikeReset(playerid, giveplayerid)
  6159. {
  6160. new string[128];
  6161. format(string, sizeof(string), "Deleted %d strikes against %s", mysql_affected_rows(MainPipeline), GetPlayerNameEx(giveplayerid));
  6162. SendClientMessage(playerid, COLOR_WHITE, string);
  6163. return 1;
  6164. }
  6165.  
  6166. forward OnDMRLookup(playerid, giveplayerid);
  6167. public OnDMRLookup(playerid, giveplayerid)
  6168. {
  6169. new string[128], rows, fields;
  6170. cache_get_data(rows, fields, MainPipeline);
  6171. format(string, sizeof(string), "Showing the last %d /dmreports by %s", rows, GetPlayerNameEx(giveplayerid));
  6172. SendClientMessage(playerid, COLOR_WHITE, string);
  6173. SendClientMessage(playerid, COLOR_WHITE, "| Reported | Time |");
  6174. for(new i;i < rows;i++)
  6175. {
  6176. new szResult[32], name[MAX_PLAYER_NAME], timestamp;
  6177. cache_get_row(i, 0, szResult, MainPipeline); timestamp = strval(szResult);
  6178. cache_get_row(i, 1, name, MainPipeline, MAX_PLAYER_NAME);
  6179. format(string, sizeof(string), "%s - %s", name, date(timestamp, 1));
  6180. SendClientMessage(playerid, COLOR_WHITE, string);
  6181. }
  6182. return 1;
  6183. }
  6184.  
  6185. forward OnDMTokenLookup(playerid, giveplayerid);
  6186. public OnDMTokenLookup(playerid, giveplayerid)
  6187. {
  6188. new string[128], rows, fields;
  6189. cache_get_data(rows, fields, MainPipeline);
  6190. format(string, sizeof(string), "Showing the %d active /dmreports on %s", rows, GetPlayerNameEx(giveplayerid));
  6191. SendClientMessage(playerid, COLOR_WHITE, string);
  6192. SendClientMessage(playerid, COLOR_WHITE, "| Reporter | Time |");
  6193. for(new i;i < rows;i++)
  6194. {
  6195. new szResult[32], name[MAX_PLAYER_NAME], timestamp;
  6196. cache_get_row(i, 0, szResult, MainPipeline); timestamp = strval(szResult);
  6197. cache_get_row(i, 1, name, MainPipeline);
  6198. format(string, sizeof(string), "%s - %s", name, date(timestamp, 1));
  6199. SendClientMessage(playerid, COLOR_WHITE, string);
  6200. }
  6201. return 1;
  6202. }
  6203.  
  6204. forward OnDMWatchListLookup(playerid);
  6205. public OnDMWatchListLookup(playerid)
  6206. {
  6207. new string[128], rows, fields;
  6208. cache_get_data(rows, fields, MainPipeline);
  6209. format(string, sizeof(string), "Showing %d active people to watch", rows);
  6210. SendClientMessage(playerid, COLOR_WHITE, string);
  6211. for(new i;i < rows;i++)
  6212. {
  6213. new name[MAX_PLAYER_NAME], watchid;
  6214. cache_get_row(i, 0, name, MainPipeline);
  6215. sscanf(name, "u", watchid);
  6216. format(string, sizeof(string), "(ID: %d) %s", watchid, name);
  6217. SendClientMessage(playerid, COLOR_WHITE, string);
  6218. }
  6219. return 1;
  6220. }
  6221.  
  6222. forward OnDMWatch(playerid);
  6223. public OnDMWatch(playerid)
  6224. {
  6225. new rows, fields;
  6226. cache_get_data(rows, fields, MainPipeline);
  6227. if(rows)
  6228. {
  6229. new string[128], namesql[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
  6230. cache_get_row(0, 0, namesql, MainPipeline);
  6231. foreach(new i: Player)
  6232. {
  6233. if(!PlayerInfo[i][pJailTime])
  6234. {
  6235. GetPlayerName(i, name, sizeof(name));
  6236. if(strcmp(name, namesql, true) == 0)
  6237. {
  6238. foreach(new x: Player)
  6239. {
  6240. if(GetPVarInt(x, "pWatchdogWatching") == i)
  6241. {
  6242. return SendClientMessage(playerid, COLOR_WHITE, "The random person selected for you is already being watched, please try again!");
  6243. }
  6244. }
  6245. format(string, sizeof(string), "You now have access to /spec %s (ID: %i). Use /dmalert if this person deathmatches.", name, i);
  6246. SendClientMessage(playerid, COLOR_WHITE, string);
  6247. return SetPVarInt(playerid, "pWatchdogWatching", i);
  6248. }
  6249. }
  6250. }
  6251. }
  6252. return SendClientMessageEx(playerid, COLOR_WHITE, "There is no one online to DM Watch!");
  6253. }
  6254.  
  6255. forward OnWarnPlayer(index);
  6256. public OnWarnPlayer(index)
  6257. {
  6258. new string[128], name[24], reason[64];
  6259. GetPVarString(index, "OnWarnPlayer", name, 24);
  6260. GetPVarString(index, "OnWarnPlayerReason", reason, 64);
  6261.  
  6262. if(mysql_affected_rows(MainPipeline)) {
  6263. format(string, sizeof(string), "You have successfully warned %s's account.", name);
  6264. SendClientMessageEx(index, COLOR_WHITE, string);
  6265.  
  6266. format(string, sizeof(string), "AdmCmd: %s was offline warned by %s, reason: %s", name, GetPlayerNameEx(index), reason);
  6267. Log("logs/admin.log", string);
  6268. }
  6269. else {
  6270. format(string, sizeof(string), "There was an issue with warning %s's account.", name);
  6271. SendClientMessageEx(index, COLOR_WHITE, string);
  6272. }
  6273. DeletePVar(index, "OnWarnPlayer");
  6274. DeletePVar(index, "OnWarnPlayerReason");
  6275.  
  6276. return 1;
  6277. }
  6278.  
  6279. forward OnPinCheck2(index);
  6280. public OnPinCheck2(index)
  6281. {
  6282. if(IsPlayerConnected(index))
  6283. {
  6284. new rows, fields;
  6285. cache_get_data(rows, fields, MainPipeline);
  6286. if(rows)
  6287. {
  6288. new Pin[256];
  6289. cache_get_field_content(0, "Pin", Pin, MainPipeline, 256);
  6290. if(isnull(Pin)) {
  6291. ShowPlayerDialog(index, DIALOG_CREATEPIN, DIALOG_STYLE_INPUT, "Pin Number", "Create a pin number so you can secure your account credits.", "Create", "Exit");
  6292. }
  6293. else
  6294. {
  6295. new passbuffer[256], passbuffer2[64];
  6296. GetPVarString(index, "PinNumber", passbuffer2, sizeof(passbuffer2));
  6297. WP_Hash(passbuffer, sizeof(passbuffer), passbuffer2);
  6298. if (strcmp(passbuffer, Pin) == 0)
  6299. {
  6300. SetPVarInt(index, "PinConfirmed", 1);
  6301. SendClientMessageEx(index, COLOR_CYAN, "Pin confirmed, you will now be able to spend credits.");
  6302. switch(GetPVarInt(index, "OpenShop"))
  6303. {
  6304. case 1:
  6305. {
  6306. new szDialog[512];
  6307. format(szDialog, sizeof(szDialog), "Poker Table (Credits: {FFD700}%s{A9C4E4})\nBoombox (Credits: {FFD700}%s{A9C4E4})\n100 Paintball Tokens (Credits: {FFD700}%s{A9C4E4})\nEXP Token (Credits: {FFD700}%s{A9C4E4})\nFireworks x5 (Credits: {FFD700}%s{A9C4E4})\nCustom License Plate (Credits: {FFD700}%s{A9C4E4})" \
  6308. "\nHunger Games Voucher(Credits: {FFD700}%s{A9C4E4})",
  6309. number_format(ShopItems[6][sItemPrice]), number_format(ShopItems[7][sItemPrice]), number_format(ShopItems[8][sItemPrice]), number_format(ShopItems[9][sItemPrice]),
  6310. number_format(ShopItems[10][sItemPrice]), number_format(ShopItems[22][sItemPrice]), number_format(ShopItems[29][sItemPrice]));
  6311. ShowPlayerDialog(index, DIALOG_MISCSHOP, DIALOG_STYLE_LIST, "Misc Shop", szDialog, "Select", "Cancel");
  6312. }
  6313. case 2: SetPVarInt(index, "RentaCar", 1), ShowModelSelectionMenu(index, CarList2, "Rent a Car!");
  6314. case 3: ShowModelSelectionMenu(index, CarList2, "Car Shop");
  6315. case 4: ShowPlayerDialog( index, DIALOG_HOUSESHOP, DIALOG_STYLE_LIST, "House Shop", "Purchase House\nHouse Interior Change\nHouse Move\nGarage - Small\nGarage - Medium\nGarage - Large\nGarage - Extra Large","Select", "Exit" );
  6316. case 5: ShowPlayerDialog( index, DIALOG_VIPSHOP, DIALOG_STYLE_LIST, "VIP Shop", "Purchase VIP\nRenew Gold VIP","Continue", "Exit" );
  6317. case 6: ShowPlayerDialog(index, DIALOG_SHOPBUSINESS, DIALOG_STYLE_LIST, "Businesses Shop", "Purchase Business\nRenew Business", "Select", "Exit");
  6318. case 7: ShowModelSelectionMenu(index, PlaneList, "Plane Shop");
  6319. case 8: ShowModelSelectionMenu(index, BoatList, "Boat Shop");
  6320. case 9: ShowModelSelectionMenu(index, CarList3, "Restricted Car Shop");
  6321. }
  6322. DeletePVar(index, "OpenShop");
  6323. }
  6324. else
  6325. {
  6326. ShowPlayerDialog(index, DIALOG_ENTERPIN, DIALOG_STYLE_INPUT, "Pin Number", "(INVALID PIN)\n\nEnter your pin number to access credit shops.", "Confirm", "Exit");
  6327. }
  6328. DeletePVar(index, "PinNumber");
  6329. }
  6330. }
  6331. else
  6332. {
  6333. SendClientMessageEx(index, COLOR_WHITE, "There was an issue, please try again.");
  6334. }
  6335. }
  6336. return 1;
  6337. }
  6338.  
  6339. forward OnPinCheck(index);
  6340. public OnPinCheck(index)
  6341. {
  6342. if(IsPlayerConnected(index))
  6343. {
  6344. new rows, fields;
  6345. cache_get_data(rows, fields, MainPipeline);
  6346. if(rows)
  6347. {
  6348. new Pin[128];
  6349. cache_get_field_content(0, "Pin", Pin, MainPipeline, 128);
  6350. if(isnull(Pin)) {
  6351. ShowPlayerDialog(index, DIALOG_CREATEPIN, DIALOG_STYLE_INPUT, "Pin Number", "Create a pin number so you can secure your account credits.", "Create", "Exit");
  6352. }
  6353. else
  6354. {
  6355. ShowPlayerDialog(index, DIALOG_ENTERPIN, DIALOG_STYLE_INPUT, "Pin Number", "Enter your pin number to access credit shops.", "Confirm", "Exit");
  6356. }
  6357. }
  6358. else
  6359. {
  6360. SendClientMessageEx(index, COLOR_WHITE, "There was an issue, please try again.");
  6361. }
  6362. }
  6363. return 1;
  6364. }
  6365.  
  6366. forward OnGetSMSLog(playerid);
  6367. public OnGetSMSLog(playerid)
  6368. {
  6369. new string[128], sender[MAX_PLAYER_NAME], message[256], sDate[20], rows, fields;
  6370. cache_get_data(rows, fields, MainPipeline);
  6371. if(rows)
  6372. {
  6373. SendClientMessageEx(playerid, COLOR_GREEN, "________________________________________________");
  6374. SendClientMessageEx(playerid, COLOR_YELLOW, "<< Last 10 SMS Received >>");
  6375. for(new i; i < rows; i++)
  6376. {
  6377. cache_get_field_content(i, "sender", sender, MainPipeline, MAX_PLAYER_NAME);
  6378. cache_get_field_content(i, "sendernumber", string, MainPipeline); new sendernumber = strval(string);
  6379. cache_get_field_content(i, "message", message, MainPipeline, sizeof(message));
  6380. cache_get_field_content(i, "date", sDate, MainPipeline, sizeof(sDate));
  6381. if(sendernumber != 0) format(string, sizeof(string), "[%s] SMS: %s, Sender: %s (%d)", sDate, message, StripUnderscore(sender), sendernumber);
  6382. else format(string, sizeof(string), "[%s] SMS: %s, Sender: Unknown", sDate, message);
  6383. SendClientMessageEx(playerid, COLOR_YELLOW, string);
  6384. }
  6385. }
  6386. else SendClientMessageEx(playerid, COLOR_GREY, "You have not received any SMS messages.");
  6387. return 1;
  6388. }
  6389.  
  6390. forward Group_QueryFinish(iType, iExtraID);
  6391. public Group_QueryFinish(iType, iExtraID) {
  6392.  
  6393. /*
  6394. Internally, every group array/subarray starts from zero (divisions, group ids etc)
  6395. When displaying to the clients or saving to the db, we add 1 to them!
  6396. The only exception is ranks which already start from zero.
  6397. */
  6398.  
  6399. new
  6400. iFields,
  6401. iRows,
  6402. iIndex,
  6403. i = 0,
  6404. szResult[128];
  6405.  
  6406. cache_get_data(iRows, iFields, MainPipeline);
  6407.  
  6408. switch(iType) {
  6409. case GROUP_QUERY_JURISDICTIONS:
  6410. {
  6411. for(new iG = 0; iG < MAX_GROUPS; iG++)
  6412. {
  6413. arrGroupData[iG][g_iJCount] = 0;
  6414. }
  6415. while(iIndex < iRows) {
  6416.  
  6417. cache_get_field_content(iIndex, "GroupID", szResult, MainPipeline, 24);
  6418. new iGroup = strval(szResult);
  6419.  
  6420. if(arrGroupData[iGroup][g_iJCount] > MAX_GROUP_JURISDICTIONS) arrGroupData[iGroup][g_iJCount] = MAX_GROUP_JURISDICTIONS;
  6421. if (!(0 <= iGroup < MAX_GROUPS)) break;
  6422. cache_get_field_content(iIndex, "id", szResult, MainPipeline, 24);
  6423. arrGroupJurisdictions[iGroup][arrGroupData[iGroup][g_iJCount]][g_iJurisdictionSQLId] = strval(szResult);
  6424. cache_get_field_content(iIndex, "AreaName", arrGroupJurisdictions[iGroup][arrGroupData[iGroup][g_iJCount]][g_iAreaName], MainPipeline, 64);
  6425. arrGroupData[iGroup][g_iJCount]++;
  6426. iIndex++;
  6427. }
  6428. }
  6429. case GROUP_QUERY_LOCKERS: while(iIndex < iRows) {
  6430.  
  6431. cache_get_field_content(iIndex, "Group_ID", szResult, MainPipeline);
  6432. new iGroup = strval(szResult)-1;
  6433.  
  6434. cache_get_field_content(iIndex, "Locker_ID", szResult, MainPipeline);
  6435. new iLocker = strval(szResult)-1;
  6436.  
  6437. if (!(0 <= iGroup < MAX_GROUPS)) break;
  6438. if (!(0 <= iLocker < MAX_GROUP_LOCKERS)) break;
  6439.  
  6440. cache_get_field_content(iIndex, "Id", szResult, MainPipeline);
  6441. arrGroupLockers[iGroup][iLocker][g_iLockerSQLId] = strval(szResult);
  6442.  
  6443. cache_get_field_content(iIndex, "LockerX", szResult, MainPipeline);
  6444. arrGroupLockers[iGroup][iLocker][g_fLockerPos][0] = floatstr(szResult);
  6445.  
  6446. cache_get_field_content(iIndex, "LockerY", szResult, MainPipeline);
  6447. arrGroupLockers[iGroup][iLocker][g_fLockerPos][1] = floatstr(szResult);
  6448.  
  6449. cache_get_field_content(iIndex, "LockerZ", szResult, MainPipeline);
  6450. arrGroupLockers[iGroup][iLocker][g_fLockerPos][2] = floatstr(szResult);
  6451.  
  6452. cache_get_field_content(iIndex, "LockerVW", szResult, MainPipeline);
  6453. arrGroupLockers[iGroup][iLocker][g_iLockerVW] = strval(szResult);
  6454.  
  6455. cache_get_field_content(iIndex, "LockerShare", szResult, MainPipeline);
  6456. arrGroupLockers[iGroup][iLocker][g_iLockerShare] = strval(szResult);
  6457.  
  6458. format(szResult, sizeof szResult, "%s Locker\n{1FBDFF}/locker{FFFF00} to use\n ID: %i", arrGroupData[iGroup][g_szGroupName], arrGroupLockers[iGroup][iLocker]);
  6459. arrGroupLockers[iGroup][iLocker][g_tLocker3DLabel] = CreateDynamic3DTextLabel(szResult, arrGroupData[iGroup][g_hDutyColour] * 256 + 0xFF, arrGroupLockers[iGroup][iLocker][g_fLockerPos][0], arrGroupLockers[iGroup][iLocker][g_fLockerPos][1], arrGroupLockers[iGroup][iLocker][g_fLockerPos][2], 15.0, .testlos = 1, .worldid = arrGroupLockers[iGroup][iLocker][g_iLockerVW]);
  6460. iIndex++;
  6461.  
  6462. }
  6463. case GROUP_QUERY_LOAD: while(iIndex < iRows) {
  6464. cache_get_field_content(iIndex, "Name", arrGroupData[iIndex][g_szGroupName], MainPipeline, GROUP_MAX_NAME_LEN);
  6465.  
  6466. cache_get_field_content(iIndex, "MOTD", arrGroupData[iIndex][g_szGroupMOTD], MainPipeline, GROUP_MAX_MOTD_LEN);
  6467.  
  6468. cache_get_field_content(iIndex, "Type", szResult, MainPipeline);
  6469. arrGroupData[iIndex][g_iGroupType] = strval(szResult);
  6470.  
  6471. cache_get_field_content(iIndex, "Allegiance", szResult, MainPipeline);
  6472. arrGroupData[iIndex][g_iAllegiance] = strval(szResult);
  6473.  
  6474. cache_get_field_content(iIndex, "Bug", szResult, MainPipeline);
  6475. arrGroupData[iIndex][g_iBugAccess] = strval(szResult);
  6476.  
  6477. cache_get_field_content(iIndex, "RadioColour", szResult, MainPipeline);
  6478. arrGroupData[iIndex][g_hRadioColour] = strval(szResult);
  6479.  
  6480. cache_get_field_content(iIndex, "Radio", szResult, MainPipeline);
  6481. arrGroupData[iIndex][g_iRadioAccess] = strval(szResult);
  6482.  
  6483. cache_get_field_content(iIndex, "DeptRadio", szResult, MainPipeline);
  6484. arrGroupData[iIndex][g_iDeptRadioAccess] = strval(szResult);
  6485.  
  6486. cache_get_field_content(iIndex, "IntRadio", szResult, MainPipeline);
  6487. arrGroupData[iIndex][g_iIntRadioAccess] = strval(szResult);
  6488.  
  6489. cache_get_field_content(iIndex, "GovAnnouncement", szResult, MainPipeline);
  6490. arrGroupData[iIndex][g_iGovAccess] = strval(szResult);
  6491.  
  6492. cache_get_field_content(iIndex, "FreeNameChange", szResult, MainPipeline);
  6493. arrGroupData[iIndex][g_iFreeNameChange] = strval(szResult);
  6494.  
  6495. cache_get_field_content(iIndex, "Budget", szResult, MainPipeline);
  6496. arrGroupData[iIndex][g_iBudget] = strval(szResult);
  6497.  
  6498. cache_get_field_content(iIndex, "BudgetPayment", szResult, MainPipeline);
  6499. arrGroupData[iIndex][g_iBudgetPayment] = strval(szResult);
  6500.  
  6501. cache_get_field_content(iIndex, "SpikeStrips", szResult, MainPipeline);
  6502. arrGroupData[iIndex][g_iSpikeStrips] = strval(szResult);
  6503.  
  6504. cache_get_field_content(iIndex, "Barricades", szResult, MainPipeline);
  6505. arrGroupData[iIndex][g_iBarricades] = strval(szResult);
  6506.  
  6507. cache_get_field_content(iIndex, "Cones", szResult, MainPipeline);
  6508. arrGroupData[iIndex][g_iCones] = strval(szResult);
  6509.  
  6510. cache_get_field_content(iIndex, "Flares", szResult, MainPipeline);
  6511. arrGroupData[iIndex][g_iFlares] = strval(szResult);
  6512.  
  6513. cache_get_field_content(iIndex, "Barrels", szResult, MainPipeline);
  6514. arrGroupData[iIndex][g_iBarrels] = strval(szResult);
  6515.  
  6516. cache_get_field_content(iIndex, "DutyColour", szResult, MainPipeline);
  6517. arrGroupData[iIndex][g_hDutyColour] = strval(szResult);
  6518.  
  6519. cache_get_field_content(iIndex, "Stock", szResult, MainPipeline);
  6520. arrGroupData[iIndex][g_iLockerStock] = strval(szResult);
  6521.  
  6522. cache_get_field_content(iIndex, "CrateX", szResult, MainPipeline);
  6523. arrGroupData[iIndex][g_fCratePos][0] = floatstr(szResult);
  6524.  
  6525. cache_get_field_content(iIndex, "CrateY", szResult, MainPipeline);
  6526. arrGroupData[iIndex][g_fCratePos][1] = floatstr(szResult);
  6527.  
  6528. cache_get_field_content(iIndex, "CrateZ", szResult, MainPipeline);
  6529. arrGroupData[iIndex][g_fCratePos][2] = floatstr(szResult);
  6530.  
  6531. cache_get_field_content(iIndex, "LockerCostType", szResult, MainPipeline);
  6532. arrGroupData[iIndex][g_iLockerCostType] = strval(szResult);
  6533.  
  6534. cache_get_field_content(iIndex, "CratesOrder", szResult, MainPipeline);
  6535. arrGroupData[iIndex][g_iCratesOrder] = strval(szResult);
  6536.  
  6537. cache_get_field_content(iIndex, "CrateIsland", szResult, MainPipeline);
  6538. arrGroupData[iIndex][g_iCrateIsland] = strval(szResult);
  6539.  
  6540. cache_get_field_content(iIndex, "GarageX", szResult, MainPipeline);
  6541. arrGroupData[iIndex][g_fGaragePos][0] = floatstr(szResult);
  6542.  
  6543. cache_get_field_content(iIndex, "GarageY", szResult, MainPipeline);
  6544. arrGroupData[iIndex][g_fGaragePos][1] = floatstr(szResult);
  6545.  
  6546. cache_get_field_content(iIndex, "GarageZ", szResult, MainPipeline);
  6547. arrGroupData[iIndex][g_fGaragePos][2] = floatstr(szResult);
  6548.  
  6549. while(i < MAX_GROUP_RANKS) {
  6550. format(szResult, sizeof szResult, "Rank%i", i);
  6551. cache_get_field_content(iIndex, szResult, arrGroupRanks[iIndex][i], MainPipeline, GROUP_MAX_RANK_LEN);
  6552. format(szResult, sizeof szResult, "Rank%iPay", i);
  6553. cache_get_field_content(iIndex, szResult, szResult, MainPipeline);
  6554. arrGroupData[iIndex][g_iPaycheck][i] = strval(szResult);
  6555. i++;
  6556. }
  6557. i = 0;
  6558.  
  6559. while(i < MAX_GROUP_DIVS) {
  6560. format(szResult, sizeof szResult, "Div%i", i + 1);
  6561. cache_get_field_content(iIndex, szResult, arrGroupDivisions[iIndex][i], MainPipeline, GROUP_MAX_DIV_LEN);
  6562. i++;
  6563. }
  6564. i = 0;
  6565.  
  6566. while(i < MAX_GROUP_WEAPONS) {
  6567. format(szResult, sizeof szResult, "Gun%i", i + 1);
  6568. cache_get_field_content(iIndex, szResult, szResult, MainPipeline);
  6569. arrGroupData[iIndex][g_iLockerGuns][i] = strval(szResult);
  6570. format(szResult, sizeof szResult, "Cost%i", i + 1);
  6571. cache_get_field_content(iIndex, szResult, szResult, MainPipeline);
  6572. arrGroupData[iIndex][g_iLockerCost][i] = strval(szResult);
  6573. i++;
  6574. }
  6575. i = 0;
  6576.  
  6577. if (arrGroupData[iIndex][g_szGroupName][0] && arrGroupData[iIndex][g_fCratePos][0] != 0.0)
  6578. {
  6579. format(szResult, sizeof szResult, "%s Crate Delivery Point\n{1FBDFF}/delivercrate", arrGroupData[iIndex][g_szGroupName]);
  6580. arrGroupData[iIndex][g_tCrate3DLabel] = CreateDynamic3DTextLabel(szResult, arrGroupData[iIndex][g_hDutyColour] * 256 + 0xFF, arrGroupData[iIndex][g_fCratePos][0], arrGroupData[iIndex][g_fCratePos][1], arrGroupData[iIndex][g_fCratePos][2], 10.0, .testlos = 1, .streamdistance = 20.0);
  6581. }
  6582. iIndex++;
  6583. }
  6584.  
  6585. case GROUP_QUERY_INVITE: if(GetPVarType(iExtraID, "Group_Invited")) {
  6586. if(!iRows) {
  6587.  
  6588. i = GetPVarInt(iExtraID, "Group_Invited");
  6589. iIndex = PlayerInfo[iExtraID][pMember];
  6590.  
  6591. format(szResult, sizeof szResult, "%s %s has offered you an invite to %s (type /accept group to join).", arrGroupRanks[iIndex][PlayerInfo[iExtraID][pRank]], GetPlayerNameEx(iExtraID), arrGroupData[iIndex][g_szGroupName]);
  6592. SendClientMessageEx(i, COLOR_LIGHTBLUE, szResult);
  6593.  
  6594. format(szResult, sizeof szResult, "You have offered %s to join %s.", GetPlayerNameEx(i), arrGroupData[iIndex][g_szGroupName]);
  6595. SendClientMessageEx(iExtraID, COLOR_LIGHTBLUE, szResult);
  6596. SetPVarInt(i, "Group_Inviter", iExtraID);
  6597. }
  6598. else {
  6599. SendClientMessage(iExtraID, COLOR_GREY, "That person is banned from joining this group.");
  6600. DeletePVar(iExtraID, "Group_Invited");
  6601. }
  6602. }
  6603. case GROUP_QUERY_ADDBAN: {
  6604. new string[128];
  6605. new otherplayer = GetPVarInt(iExtraID, "GroupBanningPlayer");
  6606. new group = GetPVarInt(iExtraID, "GroupBanningGroup");
  6607. format(string, sizeof(string), "You have group-banned %s from group %d.", GetPlayerNameEx(otherplayer), group);
  6608. SendClientMessageEx(iExtraID, COLOR_WHITE, string);
  6609. format(string, sizeof(string), "You have been group-banned, by %s.", GetPlayerNameEx(iExtraID));
  6610. SendClientMessageEx(otherplayer, COLOR_LIGHTBLUE, string);
  6611. format(string, sizeof(string), "Administrator %s has group-banned %s from %s (%d)", GetPlayerNameEx(iExtraID), GetPlayerNameEx(otherplayer), arrGroupData[PlayerInfo[otherplayer][pMember]][g_szGroupName], PlayerInfo[otherplayer][pMember]);
  6612. Log("logs/group.log", string);
  6613. PlayerInfo[otherplayer][pMember] = INVALID_GROUP_ID;
  6614. PlayerInfo[otherplayer][pLeader] = INVALID_GROUP_ID;
  6615. PlayerInfo[otherplayer][pRank] = INVALID_RANK;
  6616. PlayerInfo[otherplayer][pDuty] = 0;
  6617. PlayerInfo[otherplayer][pDivision] = INVALID_DIVISION;
  6618. new rand = random(sizeof(CIV));
  6619. PlayerInfo[otherplayer][pModel] = CIV[rand];
  6620. SetPlayerToTeamColor(otherplayer);
  6621. SetPlayerSkin(otherplayer, CIV[rand]);
  6622. OnPlayerStatsUpdate(otherplayer);
  6623. DeletePVar(iExtraID, "GroupBanningPlayer");
  6624. DeletePVar(iExtraID, "GroupBanningGroup");
  6625. }
  6626.  
  6627. case GROUP_QUERY_UNBAN: {
  6628. new string[128];
  6629. new otherplayer = GetPVarInt(iExtraID, "GroupUnBanningPlayer");
  6630. new group = GetPVarInt(iExtraID, "GroupUnBanningGroup");
  6631. if(mysql_affected_rows(MainPipeline))
  6632. {
  6633. format(string, sizeof(string), "You have group-unbanned %s from group %s (%d).", GetPlayerNameEx(otherplayer), arrGroupData[group][g_szGroupName], group);
  6634. SendClientMessageEx(iExtraID, COLOR_WHITE, string);
  6635. format(string, sizeof(string), "You have been group-unbanned from %s, by %s.", arrGroupData[group][g_szGroupName], GetPlayerNameEx(iExtraID));
  6636. SendClientMessageEx(otherplayer, COLOR_LIGHTBLUE, string);
  6637. format(string, sizeof(string), "Administrator %s has group-unbanned %s from %s (%d)", GetPlayerNameEx(iExtraID), GetPlayerNameEx(otherplayer), arrGroupData[group][g_szGroupName], group);
  6638. Log("logs/group.log", string);
  6639. }
  6640. else
  6641. {
  6642. format(string, sizeof(string), "There was an issue group-unbanning %s from %s (%d)", GetPlayerNameEx(otherplayer), arrGroupData[group][g_szGroupName], group);
  6643. SendClientMessageEx(iExtraID, COLOR_WHITE, string);
  6644. }
  6645. DeletePVar(iExtraID, "GroupUnBanningPlayer");
  6646. DeletePVar(iExtraID, "GroupUnBanningGroup");
  6647. }
  6648. case GROUP_QUERY_UNCHECK: if(GetPVarType(iExtraID, "Group_Uninv")) {
  6649. if(iRows) {
  6650. cache_get_field_content(0, "Member", szResult, MainPipeline, MAX_PLAYER_NAME);
  6651. if(strval(szResult) == PlayerInfo[iExtraID][pMember]) {
  6652. cache_get_field_content(0, "Rank", szResult, MainPipeline);
  6653. if(PlayerInfo[iExtraID][pRank] > strval(szResult) || PlayerInfo[iExtraID][pRank] >= Group_GetMaxRank(PlayerInfo[iExtraID][pMember])) {
  6654. cache_get_field_content(0, "ID", szResult, MainPipeline);
  6655. format(szResult, sizeof szResult, "UPDATE `accounts` SET `Model` = "#NOOB_SKIN", `Member` = "#INVALID_GROUP_ID", `Rank` = "#INVALID_RANK", `Leader` = "#INVALID_GROUP_ID", `Division` = -1 WHERE `id` = %i", strval(szResult));
  6656. mysql_function_query(MainPipeline, szResult, true, "Group_QueryFinish", "ii", GROUP_QUERY_UNINVITE, iExtraID);
  6657. }
  6658. else SendClientMessage(iExtraID, COLOR_GREY, "You can't do this to a person of equal or higher rank.");
  6659. }
  6660. else SendClientMessage(iExtraID, COLOR_GREY, "That person is not in your group.");
  6661.  
  6662. }
  6663. else {
  6664. SendClientMessage(iExtraID, COLOR_GREY, "That account does not exist.");
  6665. DeletePVar(iExtraID, "Group_Uninv");
  6666. }
  6667. }
  6668. case GROUP_QUERY_UNINVITE: if(GetPVarType(iExtraID, "Group_Uninv")) {
  6669.  
  6670. new
  6671. szName[MAX_PLAYER_NAME],
  6672. iGroupID = PlayerInfo[iExtraID][pMember];
  6673.  
  6674. GetPVarString(iExtraID, "Group_Uninv", szName, sizeof szName);
  6675. if(mysql_affected_rows(MainPipeline)) {
  6676.  
  6677. i = PlayerInfo[iExtraID][pRank];
  6678. format(szResult, sizeof szResult, "You have successfully removed %s from your group.", szName);
  6679. SendClientMessage(iExtraID, COLOR_GREY, szResult);
  6680.  
  6681. format(szResult, sizeof szResult, "%s %s (rank %i) has offline uninvited %s from %s (%i).", arrGroupRanks[iGroupID][i], GetPlayerNameEx(iExtraID), i + 1, szName, arrGroupData[iGroupID][g_szGroupName], iGroupID + 1);
  6682. Log("logs/group.log", szResult);
  6683. }
  6684. else {
  6685. format(szResult, sizeof szResult, "An error was encountered while attempting to remove %s from your group.", szName);
  6686. SendClientMessage(iExtraID, COLOR_GREY, szResult);
  6687. }
  6688. DeletePVar(iExtraID, "Group_Uninv");
  6689. }
  6690. }
  6691. }
  6692.  
  6693. forward Jurisdiction_RehashFinish(iGroup);
  6694. public Jurisdiction_RehashFinish(iGroup) {
  6695.  
  6696. new
  6697. iFields,
  6698. iRows,
  6699. iIndex,
  6700. szResult[128];
  6701.  
  6702. cache_get_data(iRows, iFields, MainPipeline);
  6703.  
  6704. while(iIndex < iRows)
  6705. {
  6706. new iGroupID;
  6707. arrGroupData[iGroup][g_iJCount] = iRows;
  6708. if(arrGroupData[iGroup][g_iJCount] > MAX_GROUP_JURISDICTIONS) {
  6709. arrGroupData[iGroup][g_iJCount] = MAX_GROUP_JURISDICTIONS;
  6710. }
  6711. cache_get_field_content(iIndex, "GroupID", szResult, MainPipeline, 24);
  6712. iGroupID = strval(szResult);
  6713. if(iGroupID == iGroup)
  6714. {
  6715. cache_get_field_content(iIndex, "id", szResult, MainPipeline, 64);
  6716. arrGroupJurisdictions[iGroup][iIndex][g_iJurisdictionSQLId] = strval(szResult);
  6717. cache_get_field_content(iIndex, "AreaName", arrGroupJurisdictions[iGroup][iIndex][g_iAreaName], MainPipeline, 64);
  6718. }
  6719. iIndex++;
  6720. }
  6721. }
  6722.  
  6723. forward DynVeh_QueryFinish(iType, iExtraID);
  6724. public DynVeh_QueryFinish(iType, iExtraID) {
  6725.  
  6726. new
  6727. iFields,
  6728. iRows,
  6729. iIndex,
  6730. i = 0,
  6731. sqlid,
  6732. szResult[128];
  6733.  
  6734. cache_get_data(iRows, iFields, MainPipeline);
  6735. switch(iType) {
  6736. case GV_QUERY_LOAD:
  6737. {
  6738. format(szResult, sizeof(szResult), "UPDATE `groupvehs` SET `SpawnedID` = %d", INVALID_VEHICLE_ID);
  6739. mysql_function_query(MainPipeline, szResult, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  6740. while((iIndex < iRows) && (iIndex < MAX_DYNAMIC_VEHICLES)) {
  6741. cache_get_field_content(iIndex, "id", szResult, MainPipeline); sqlid = strval(szResult);
  6742. if((sqlid >= MAX_DYNAMIC_VEHICLES)) {// Array bounds check. Use it.
  6743. format(szResult, sizeof(szResult), "DELETE FROM `groupvehs` WHERE `id` = %d", sqlid);
  6744. mysql_function_query(MainPipeline, szResult, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  6745. return printf("SQL ID %d exceeds Max Dynamic Vehicles", sqlid);
  6746. }
  6747. cache_get_field_content(iIndex, "gID", szResult, MainPipeline); DynVehicleInfo[sqlid][gv_igID] = strval(szResult);
  6748. cache_get_field_content(iIndex, "gDivID", szResult, MainPipeline); DynVehicleInfo[sqlid][gv_igDivID] = strval(szResult);
  6749. cache_get_field_content(iIndex, "fID", szResult, MainPipeline); DynVehicleInfo[sqlid][gv_ifID] = strval(szResult);
  6750. cache_get_field_content(iIndex, "rID", szResult, MainPipeline); DynVehicleInfo[sqlid][gv_irID] = strval(szResult);
  6751. cache_get_field_content(iIndex, "vModel", szResult, MainPipeline); DynVehicleInfo[sqlid][gv_iModel] = strval(szResult);
  6752. switch(DynVehicleInfo[sqlid][gv_iModel]) {
  6753. case 538, 537, 449, 590, 569, 570: {
  6754. DynVehicleInfo[sqlid][gv_iModel] = 0;
  6755. }
  6756. }
  6757. cache_get_field_content(iIndex, "vPlate", DynVehicleInfo[sqlid][gv_iPlate], MainPipeline, 32);
  6758. cache_get_field_content(iIndex, "vMaxHealth", szResult, MainPipeline); DynVehicleInfo[sqlid][gv_fMaxHealth] = floatstr(szResult);
  6759. cache_get_field_content(iIndex, "vType", szResult, MainPipeline); DynVehicleInfo[sqlid][gv_iType] = strval(szResult);
  6760. cache_get_field_content(iIndex, "vLoadMax", szResult, MainPipeline); DynVehicleInfo[sqlid][gv_iLoadMax] = strval(szResult);
  6761. if(DynVehicleInfo[sqlid][gv_iLoadMax] > 6) {
  6762. DynVehicleInfo[sqlid][gv_iLoadMax] = 6;
  6763. }
  6764. cache_get_field_content(iIndex, "vCol1", szResult, MainPipeline); DynVehicleInfo[sqlid][gv_iCol1] = strval(szResult);
  6765. cache_get_field_content(iIndex, "vCol2", szResult, MainPipeline); DynVehicleInfo[sqlid][gv_iCol2] = strval(szResult);
  6766. cache_get_field_content(iIndex, "vX", szResult, MainPipeline); DynVehicleInfo[sqlid][gv_fX] = floatstr(szResult);
  6767. cache_get_field_content(iIndex, "vY", szResult, MainPipeline); DynVehicleInfo[sqlid][gv_fY] = floatstr(szResult);
  6768. cache_get_field_content(iIndex, "vZ", szResult, MainPipeline); DynVehicleInfo[sqlid][gv_fZ] = floatstr(szResult);
  6769. cache_get_field_content(iIndex, "vVW", szResult, MainPipeline); DynVehicleInfo[sqlid][gv_iVW] = strval(szResult);
  6770. cache_get_field_content(iIndex, "vInt", szResult, MainPipeline); DynVehicleInfo[sqlid][gv_iInt] = strval(szResult);
  6771. cache_get_field_content(iIndex, "vDisabled", szResult, MainPipeline); DynVehicleInfo[sqlid][gv_iDisabled] = strval(szResult);
  6772. cache_get_field_content(iIndex, "vRotZ", szResult, MainPipeline); DynVehicleInfo[sqlid][gv_fRotZ] = floatstr(szResult);
  6773. cache_get_field_content(iIndex, "vUpkeep", szResult, MainPipeline); DynVehicleInfo[sqlid][gv_iUpkeep] = strval(szResult);
  6774. i = 1;
  6775. while(i <= MAX_DV_OBJECTS) {
  6776. format(szResult, sizeof szResult, "vAttachedObjectModel%i", i);
  6777. cache_get_field_content(iIndex, szResult, szResult, MainPipeline); DynVehicleInfo[sqlid][gv_iAttachedObjectModel][i-1] = strval(szResult);
  6778. format(szResult, sizeof szResult, "vObjectX%i", i);
  6779. cache_get_field_content(iIndex, szResult, szResult, MainPipeline); DynVehicleInfo[sqlid][gv_fObjectX][i-1] = floatstr(szResult);
  6780. format(szResult, sizeof szResult, "vObjectY%i", i);
  6781. cache_get_field_content(iIndex, szResult, szResult, MainPipeline); DynVehicleInfo[sqlid][gv_fObjectY][i-1] = floatstr(szResult);
  6782. format(szResult, sizeof szResult, "vObjectZ%i", i);
  6783. cache_get_field_content(iIndex, szResult, szResult, MainPipeline); DynVehicleInfo[sqlid][gv_fObjectZ][i-1] = floatstr(szResult);
  6784. format(szResult, sizeof szResult, "vObjectRX%i", i);
  6785. cache_get_field_content(iIndex, szResult, szResult, MainPipeline); DynVehicleInfo[sqlid][gv_fObjectRX][i-1] = floatstr(szResult);
  6786. format(szResult, sizeof szResult, "vObjectRY%i", i);
  6787. cache_get_field_content(iIndex, szResult, szResult, MainPipeline); DynVehicleInfo[sqlid][gv_fObjectRY][i-1] = floatstr(szResult);
  6788. format(szResult, sizeof szResult, "vObjectRZ%i", i);
  6789. cache_get_field_content(iIndex, szResult, szResult, MainPipeline); DynVehicleInfo[sqlid][gv_fObjectRZ][i-1] = floatstr(szResult);
  6790. i++;
  6791. }
  6792. i = 0;
  6793. while(i < MAX_DV_MODS) {
  6794. format(szResult, sizeof szResult, "vMod%i", i);
  6795. cache_get_field_content(iIndex, szResult, szResult, MainPipeline); DynVehicleInfo[sqlid][gv_iMod][i++] = strval(szResult);
  6796. }
  6797.  
  6798. if(400 < DynVehicleInfo[sqlid][gv_iModel] < 612) {
  6799. if(!IsWeaponizedVehicle(DynVehicleInfo[sqlid][gv_iModel])) {
  6800. DynVeh_Spawn(iIndex);
  6801. //printf("[DynVeh] Loaded Dynamic Vehicle %i.", iIndex);
  6802. for(i = 0; i != MAX_DV_OBJECTS; i++)
  6803. {
  6804. if(DynVehicleInfo[sqlid][gv_iAttachedObjectModel][i] == 0 || DynVehicleInfo[sqlid][gv_iAttachedObjectModel][i] == INVALID_OBJECT_ID) {
  6805. DynVehicleInfo[sqlid][gv_iAttachedObjectID][i] = INVALID_OBJECT_ID;
  6806. DynVehicleInfo[sqlid][gv_iAttachedObjectModel][i] = INVALID_OBJECT_ID;
  6807. }
  6808. }
  6809. } else {
  6810. DynVehicleInfo[sqlid][gv_iSpawnedID] = INVALID_VEHICLE_ID;
  6811. }
  6812. }
  6813. iIndex++;
  6814. }
  6815. }
  6816. }
  6817. return 1;
  6818. }
  6819.  
  6820. forward LoadBusinessesSaless();
  6821. public LoadBusinessesSaless() {
  6822.  
  6823. new
  6824. iFields,
  6825. iRows,
  6826. iIndex,
  6827. szResult[128];
  6828.  
  6829. cache_get_data(iRows, iFields, MainPipeline);
  6830.  
  6831. while((iIndex < iRows)) {
  6832. cache_get_field_content(iIndex, "bID", szResult, MainPipeline); BusinessSales[iIndex][bID] = strval(szResult);
  6833. cache_get_field_content(iIndex, "BusinessID", szResult, MainPipeline); BusinessSales[iIndex][bBusinessID] = strval(szResult);
  6834. cache_get_field_content(iIndex, "Text", BusinessSales[iIndex][bText], MainPipeline, 128);
  6835. cache_get_field_content(iIndex, "Price", szResult, MainPipeline); BusinessSales[iIndex][bPrice] = strval(szResult);
  6836. cache_get_field_content(iIndex, "Available", szResult, MainPipeline); BusinessSales[iIndex][bAvailable] = strval(szResult);
  6837. cache_get_field_content(iIndex, "Purchased", szResult, MainPipeline); BusinessSales[iIndex][bPurchased] = strval(szResult);
  6838. cache_get_field_content(iIndex, "Type", szResult, MainPipeline); BusinessSales[iIndex][bType] = strval(szResult);
  6839. iIndex++;
  6840. }
  6841. return 1;
  6842. }
  6843.  
  6844. forward AuctionLoadQuery();
  6845. public AuctionLoadQuery() {
  6846.  
  6847. new
  6848. iFields,
  6849. iRows,
  6850. iIndex,
  6851. szResult[128];
  6852.  
  6853. cache_get_data(iRows, iFields, MainPipeline);
  6854.  
  6855. while((iIndex < iRows)) {
  6856. cache_get_field_content(iIndex, "BiddingFor", Auctions[iIndex][BiddingFor], MainPipeline, 64);
  6857. cache_get_field_content(iIndex, "InProgress", szResult, MainPipeline); Auctions[iIndex][InProgress] = strval(szResult);
  6858. cache_get_field_content(iIndex, "Bid", szResult, MainPipeline); Auctions[iIndex][Bid] = strval(szResult);
  6859. cache_get_field_content(iIndex, "Bidder", szResult, MainPipeline); Auctions[iIndex][Bidder] = strval(szResult);
  6860. cache_get_field_content(iIndex, "Expires", szResult, MainPipeline); Auctions[iIndex][Expires] = strval(szResult);
  6861. cache_get_field_content(iIndex, "Wining", Auctions[iIndex][Wining], MainPipeline, MAX_PLAYER_NAME);
  6862. cache_get_field_content(iIndex, "Increment", szResult, MainPipeline); Auctions[iIndex][Increment] = strval(szResult);
  6863. if(Auctions[iIndex][InProgress] == 1 && Auctions[iIndex][Expires] != 0)
  6864. {
  6865. Auctions[iIndex][Timer] = SetTimerEx("EndAuction", 60000, true, "i", iIndex);
  6866. printf("[auction - %i - started] %s, %d, %d, %d, %d, %s, %d",iIndex, Auctions[iIndex][BiddingFor],Auctions[iIndex][InProgress],Auctions[iIndex][Bid],Auctions[iIndex][Bidder],Auctions[iIndex][Expires],Auctions[iIndex][Wining],Auctions[iIndex][Increment]);
  6867. }
  6868. iIndex++;
  6869. }
  6870. return 1;
  6871. }
  6872.  
  6873. forward PlantsLoadQuery();
  6874. public PlantsLoadQuery() {
  6875.  
  6876. new
  6877. iFields,
  6878. iRows,
  6879. iIndex,
  6880. szResult[128];
  6881.  
  6882. cache_get_data(iRows, iFields, MainPipeline);
  6883.  
  6884. while((iIndex < iRows)) {
  6885. cache_get_field_content(iIndex, "Owner", szResult, MainPipeline); Plants[iIndex][pOwner] = strval(szResult);
  6886. cache_get_field_content(iIndex, "Object", szResult, MainPipeline); Plants[iIndex][pObject] = strval(szResult);
  6887. cache_get_field_content(iIndex, "PlantType", szResult, MainPipeline); Plants[iIndex][pPlantType] = strval(szResult);
  6888. cache_get_field_content(iIndex, "PositionX", szResult, MainPipeline); Plants[iIndex][pPos][0] = floatstr(szResult);
  6889. cache_get_field_content(iIndex, "PositionY", szResult, MainPipeline); Plants[iIndex][pPos][1] = floatstr(szResult);
  6890. cache_get_field_content(iIndex, "PositionZ", szResult, MainPipeline); Plants[iIndex][pPos][2] = floatstr(szResult);
  6891. cache_get_field_content(iIndex, "Virtual", szResult, MainPipeline); Plants[iIndex][pVirtual] = strval(szResult);
  6892. cache_get_field_content(iIndex, "Interior", szResult, MainPipeline); Plants[iIndex][pInterior] = strval(szResult);
  6893. cache_get_field_content(iIndex, "Growth", szResult, MainPipeline); Plants[iIndex][pGrowth] = strval(szResult);
  6894. cache_get_field_content(iIndex, "Expires", szResult, MainPipeline); Plants[iIndex][pExpires] = strval(szResult);
  6895. cache_get_field_content(iIndex, "DrugsSkill", szResult, MainPipeline); Plants[iIndex][pDrugsSkill] = strval(szResult);
  6896.  
  6897. if(Plants[iIndex][pOwner] != 0) {
  6898. Plants[iIndex][pObjectSpawned] = CreateDynamicObject(Plants[iIndex][pObject], Plants[iIndex][pPos][0], Plants[iIndex][pPos][1], Plants[iIndex][pPos][2], 0.0, 0.0, 0.0, Plants[iIndex][pVirtual], Plants[iIndex][pInterior]);
  6899. }
  6900. iIndex++;
  6901. }
  6902. if(iIndex > 0) printf("[LoadPlants] Successfully loaded %d plants", iIndex);
  6903. else printf("[LoadPlants] Error: Failed to load any plants!");
  6904. return 1;
  6905. }
  6906.  
  6907. forward BusinessesLoadQueryFinish();
  6908. public BusinessesLoadQueryFinish()
  6909. {
  6910.  
  6911. new i, rows, fields, tmp[128];
  6912. cache_get_data(rows, fields, MainPipeline);
  6913. while(i < rows)
  6914. {
  6915. cache_get_field_content(i, "Name", Businesses[i][bName], MainPipeline, MAX_BUSINESS_NAME);
  6916. cache_get_field_content(i, "OwnerID", tmp, MainPipeline); Businesses[i][bOwner] = strval(tmp);
  6917. cache_get_field_content(i, "Username", Businesses[i][bOwnerName], MainPipeline, MAX_PLAYER_NAME);
  6918. cache_get_field_content(i, "Type", tmp, MainPipeline); Businesses[i][bType] = strval(tmp);
  6919. cache_get_field_content(i, "Value", tmp, MainPipeline); Businesses[i][bValue] = strval(tmp);
  6920. cache_get_field_content(i, "Status", tmp, MainPipeline); Businesses[i][bStatus] = strval(tmp);
  6921. cache_get_field_content(i, "Level", tmp, MainPipeline); Businesses[i][bLevel] = strval(tmp);
  6922. cache_get_field_content(i, "LevelProgress", tmp, MainPipeline); Businesses[i][bLevelProgress] = strval(tmp);
  6923. cache_get_field_content(i, "SafeBalance", tmp, MainPipeline); Businesses[i][bSafeBalance] = strval(tmp);
  6924. cache_get_field_content(i, "Inventory", tmp, MainPipeline); Businesses[i][bInventory] = strval(tmp);
  6925. cache_get_field_content(i, "InventoryCapacity", tmp, MainPipeline); Businesses[i][bInventoryCapacity] = strval(tmp);
  6926. cache_get_field_content(i, "AutoSale", tmp, MainPipeline); Businesses[i][bAutoSale] = strval(tmp);
  6927. cache_get_field_content(i, "TotalSales", tmp, MainPipeline); Businesses[i][bTotalSales] = strval(tmp);
  6928. cache_get_field_content(i, "ExteriorX", tmp, MainPipeline); Businesses[i][bExtPos][0] = floatstr(tmp);
  6929. cache_get_field_content(i, "ExteriorY", tmp, MainPipeline); Businesses[i][bExtPos][1] = floatstr(tmp);
  6930. cache_get_field_content(i, "ExteriorZ", tmp, MainPipeline); Businesses[i][bExtPos][2] = floatstr(tmp);
  6931. cache_get_field_content(i, "ExteriorA", tmp, MainPipeline); Businesses[i][bExtPos][3] = floatstr(tmp);
  6932. cache_get_field_content(i, "InteriorX", tmp, MainPipeline); Businesses[i][bIntPos][0] = floatstr(tmp);
  6933. cache_get_field_content(i, "InteriorY", tmp, MainPipeline); Businesses[i][bIntPos][1] = floatstr(tmp);
  6934. cache_get_field_content(i, "InteriorZ", tmp, MainPipeline); Businesses[i][bIntPos][2] = floatstr(tmp);
  6935. cache_get_field_content(i, "InteriorA", tmp, MainPipeline); Businesses[i][bIntPos][3] = floatstr(tmp);
  6936. cache_get_field_content(i, "Interior", tmp, MainPipeline); Businesses[i][bInt] = strval(tmp);
  6937. cache_get_field_content(i, "SupplyPointX", tmp, MainPipeline); Businesses[i][bSupplyPos][0] = floatstr(tmp);
  6938. cache_get_field_content(i, "SupplyPointY", tmp, MainPipeline); Businesses[i][bSupplyPos][1] = floatstr(tmp);
  6939. cache_get_field_content(i, "SupplyPointZ", tmp, MainPipeline); Businesses[i][bSupplyPos][2] = floatstr(tmp);
  6940. cache_get_field_content(i, "GasPrice", tmp, MainPipeline); Businesses[i][bGasPrice] = floatstr(tmp);
  6941. cache_get_field_content(i, "OrderBy", Businesses[i][bOrderBy], MainPipeline, MAX_PLAYER_NAME);
  6942. cache_get_field_content(i, "OrderState", tmp, MainPipeline); Businesses[i][bOrderState] = strval(tmp);
  6943. cache_get_field_content(i, "OrderAmount", tmp, MainPipeline); Businesses[i][bOrderAmount] = strval(tmp);
  6944. cache_get_field_content(i, "OrderDate", Businesses[i][bOrderDate], MainPipeline, 30);
  6945. cache_get_field_content(i, "CustomExterior", tmp, MainPipeline); Businesses[i][bCustomExterior] = strval(tmp);
  6946. cache_get_field_content(i, "CustomInterior", tmp, MainPipeline); Businesses[i][bCustomInterior] = strval(tmp);
  6947. cache_get_field_content(i, "Grade", tmp, MainPipeline); Businesses[i][bGrade] = strval(tmp);
  6948. cache_get_field_content(i, "CustomVW", tmp, MainPipeline); Businesses[i][bVW] = strval(tmp);
  6949. cache_get_field_content(i, "Pay", tmp, MainPipeline); Businesses[i][bAutoPay] = strval(tmp);
  6950. cache_get_field_content(i, "MinInviteRank", tmp, MainPipeline); Businesses[i][bMinInviteRank] = strval(tmp);
  6951. cache_get_field_content(i, "MinSupplyRank", tmp, MainPipeline); Businesses[i][bMinSupplyRank] = strval(tmp);
  6952. cache_get_field_content(i, "MinGiveRankRank", tmp, MainPipeline); Businesses[i][bMinGiveRankRank] = strval(tmp);
  6953. cache_get_field_content(i, "MinSafeRank", tmp, MainPipeline); Businesses[i][bMinSafeRank] = strval(tmp);
  6954. cache_get_field_content(i, "Months", tmp, MainPipeline); Businesses[i][bMonths] = strval(tmp);
  6955. cache_get_field_content(i, "GymEntryFee", tmp, MainPipeline); Businesses[i][bGymEntryFee] = strval(tmp);
  6956. cache_get_field_content(i, "GymType", tmp, MainPipeline); Businesses[i][bGymType] = strval(tmp);
  6957.  
  6958. if (Businesses[i][bOrderState] == 2) {
  6959. Businesses[i][bOrderState] = 1;
  6960. }
  6961.  
  6962. RefreshBusinessPickup(i);
  6963.  
  6964. for (new j; j <= 5; j++)
  6965. {
  6966. new col[9];
  6967. format(col, sizeof(col), "Rank%dPay", j);
  6968. cache_get_field_content(i, col, tmp, MainPipeline);
  6969. Businesses[i][bRankPay][j] = strval(tmp);
  6970. }
  6971.  
  6972. if (Businesses[i][bType] == BUSINESS_TYPE_GASSTATION)
  6973. {
  6974. for (new j, column[17]; j < MAX_BUSINESS_GAS_PUMPS; j++)
  6975. {
  6976. format(column, sizeof(column), "GasPump%dPosX", j + 1);
  6977. cache_get_field_content(i, column, tmp, MainPipeline); Businesses[i][GasPumpPosX][j] = floatstr(tmp);
  6978. format(column, sizeof(column), "GasPump%dPosY", j + 1);
  6979. cache_get_field_content(i, column, tmp, MainPipeline); Businesses[i][GasPumpPosY][j] = floatstr(tmp);
  6980. format(column, sizeof(column), "GasPump%dPosZ", j + 1);
  6981. cache_get_field_content(i, column, tmp, MainPipeline); Businesses[i][GasPumpPosZ][j] = floatstr(tmp);
  6982. format(column, sizeof(column), "GasPump%dAngle", j + 1);
  6983. cache_get_field_content(i, column, tmp, MainPipeline); Businesses[i][GasPumpAngle][j] = floatstr(tmp);
  6984. format(column, sizeof(column), "GasPump%dCapacity", j + 1);
  6985. cache_get_field_content(i, column, tmp, MainPipeline); Businesses[i][GasPumpCapacity][j] = floatstr(tmp);
  6986. format(column, sizeof(column), "GasPump%dGas", j + 1);
  6987. cache_get_field_content(i, column, tmp, MainPipeline); Businesses[i][GasPumpGallons][j] = floatstr(tmp);
  6988. CreateDynamicGasPump(_, i, j);
  6989.  
  6990. for (new z; z <= 17; z++)
  6991. {
  6992. new col[12];
  6993. format(col, sizeof(col), "Item%dPrice", z + 1);
  6994. cache_get_field_content(i, col, tmp, MainPipeline);
  6995. Businesses[i][bItemPrices][z] = strval(tmp);
  6996. }
  6997. }
  6998. }
  6999. else if (Businesses[i][bType] == BUSINESS_TYPE_NEWCARDEALERSHIP || Businesses[i][bType] == BUSINESS_TYPE_OLDCARDEALERSHIP)
  7000. {
  7001. for (new j, column[16], label[50]; j < MAX_BUSINESS_DEALERSHIP_VEHICLES; j++)
  7002. {
  7003.  
  7004. format(column, sizeof(column), "Car%dModelId", j);
  7005. cache_get_field_content(i, column, tmp, MainPipeline); Businesses[i][bModel][j] = strval(tmp);
  7006. format(column, sizeof(column), "Car%dPosX", j);
  7007. cache_get_field_content(i, column, tmp, MainPipeline); Businesses[i][bParkPosX][j] = floatstr(tmp);
  7008. format(column, sizeof(column), "Car%dPosY", j);
  7009. cache_get_field_content(i, column, tmp, MainPipeline); Businesses[i][bParkPosY][j] = floatstr(tmp);
  7010. format(column, sizeof(column), "Car%dPosZ", j);
  7011. cache_get_field_content(i, column, tmp, MainPipeline); Businesses[i][bParkPosZ][j] = floatstr(tmp);
  7012. format(column, sizeof(column), "Car%dPosAngle", j);
  7013. cache_get_field_content(i, column, tmp, MainPipeline); Businesses[i][bParkAngle][j] = floatstr(tmp);
  7014. format(column, sizeof(column), "Car%dPrice", j);
  7015. cache_get_field_content(i, column, tmp, MainPipeline); Businesses[i][bPrice][j] = strval(tmp);
  7016.  
  7017. cache_get_field_content(i, "PurchaseX", tmp, MainPipeline); Businesses[i][bPurchaseX][j] = strval(tmp);
  7018. cache_get_field_content(i, "PurchaseY", tmp, MainPipeline); Businesses[i][bPurchaseY][j] = strval(tmp);
  7019. cache_get_field_content(i, "PurchaseZ", tmp, MainPipeline); Businesses[i][bPurchaseZ][j] = strval(tmp);
  7020. cache_get_field_content(i, "PurchaseAngle", tmp, MainPipeline); Businesses[i][bPurchaseAngle][j] = strval(tmp);
  7021.  
  7022. if(400 < Businesses[i][bModel][j] < 612) {
  7023. Businesses[i][bVehID][j] = CreateVehicle(Businesses[i][bModel][j], Businesses[i][bParkPosX][j], Businesses[i][bParkPosY][j], Businesses[i][bParkPosZ][j], Businesses[i][bParkAngle][j], Businesses[i][bColor1][j], Businesses[i][bColor2][j], 10);
  7024. format(label, sizeof(label), "%s For Sale | Price: $%s", GetVehicleName(Businesses[i][bVehID][j]), number_format(Businesses[i][bPrice][j]));
  7025. Businesses[i][bVehicleLabel][j] = CreateDynamic3DTextLabel(label,COLOR_LIGHTBLUE,Businesses[i][bParkPosX][j], Businesses[i][bParkPosY][j], Businesses[i][bParkPosZ][j],8.0,INVALID_PLAYER_ID, Businesses[i][bVehID][j]);
  7026. }
  7027. }
  7028. }
  7029. else
  7030. {
  7031. for (new j; j <= 17; j++)
  7032. {
  7033. new col[12];
  7034. format(col, sizeof(col), "Item%dPrice", j + 1);
  7035. cache_get_field_content(i, col, tmp, MainPipeline);
  7036. Businesses[i][bItemPrices][j] = strval(tmp);
  7037. }
  7038. }
  7039.  
  7040. Businesses[i][bGymBoxingArena1][0] = INVALID_PLAYER_ID;
  7041. Businesses[i][bGymBoxingArena1][1] = INVALID_PLAYER_ID;
  7042. Businesses[i][bGymBoxingArena2][0] = INVALID_PLAYER_ID;
  7043. Businesses[i][bGymBoxingArena2][1] = INVALID_PLAYER_ID;
  7044.  
  7045. for (new it = 0; it < 10; ++it)
  7046. {
  7047. Businesses[i][bGymBikePlayers][it] = INVALID_PLAYER_ID;
  7048. Businesses[i][bGymBikeVehicles][it] = INVALID_VEHICLE_ID;
  7049. }
  7050.  
  7051. i++;
  7052. }
  7053. if(i > 0) printf("[LoadBusinesses] %d businesses rehashed/loaded.", i);
  7054. else printf("[LoadBusinesses] Failed to load any businesses.");
  7055. }
  7056.  
  7057. forward ReturnMoney(index);
  7058. public ReturnMoney(index)
  7059. {
  7060. if(IsPlayerConnected(index))
  7061. {
  7062. new
  7063. AuctionItem = GetPVarInt(index, "AuctionItem");
  7064.  
  7065. new money[15], money2, string[128];
  7066. new rows, fields;
  7067. cache_get_data(rows, fields, MainPipeline);
  7068. if(rows)
  7069. {
  7070. cache_get_field_content(0, "Money", money, MainPipeline); money2 = strval(money);
  7071.  
  7072. format(string, sizeof(string), "UPDATE `accounts` SET `Money` = %d WHERE `id` = '%d'", money2+Auctions[AuctionItem][Bid], Auctions[AuctionItem][Bidder]);
  7073. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  7074.  
  7075. format(string, sizeof(string), "Amount of $%d (Before: %i | After: %i) has been returned to (id: %i) for being outbid", Auctions[AuctionItem][Bid], money2,Auctions[AuctionItem][Bid]+money2, Auctions[AuctionItem][Bidder]);
  7076. Log("logs/auction.log", string);
  7077.  
  7078. GivePlayerCash(index, -GetPVarInt(index, "BidPlaced"));
  7079. Auctions[AuctionItem][Bid] = GetPVarInt(index, "BidPlaced");
  7080. Auctions[AuctionItem][Bidder] = GetPlayerSQLId(index);
  7081. strcpy(Auctions[AuctionItem][Wining], GetPlayerNameExt(index), MAX_PLAYER_NAME);
  7082.  
  7083. format(string, sizeof(string), "You have placed a bid of %i on %s.", GetPVarInt(index, "BidPlaced"), Auctions[AuctionItem][BiddingFor]);
  7084. SendClientMessageEx(index, COLOR_WHITE, string);
  7085.  
  7086. format(string, sizeof(string), "%s (IP:%s) has placed a bid of %i on %s(%i)", GetPlayerNameEx(index), GetPlayerIpEx(index), GetPVarInt(index, "BidPlaced"), Auctions[AuctionItem][BiddingFor], AuctionItem);
  7087. Log("logs/auction.log", string);
  7088.  
  7089. SaveAuction(AuctionItem);
  7090.  
  7091. DeletePVar(index, "BidPlaced");
  7092. DeletePVar(index, "AuctionItem");
  7093. }
  7094. else
  7095. {
  7096. printf("[AuctionError] id: %i | money %i", Auctions[AuctionItem][Bidder], Auctions[AuctionItem][Bid]);
  7097. }
  7098. }
  7099. return 1;
  7100. }
  7101.  
  7102. forward OnQueryCreateVehicle(playerid, playervehicleid);
  7103. public OnQueryCreateVehicle(playerid, playervehicleid)
  7104. {
  7105. PlayerVehicleInfo[playerid][playervehicleid][pvSlotId] = mysql_insert_id(MainPipeline);
  7106. printf("VNumber: %d", PlayerVehicleInfo[playerid][playervehicleid][pvSlotId]);
  7107.  
  7108. new string[128];
  7109. format(string, sizeof(string), "UPDATE `vehicles` SET `pvModelId` = %d WHERE `id` = %d", PlayerVehicleInfo[playerid][playervehicleid][pvModelId], PlayerVehicleInfo[playerid][playervehicleid][pvSlotId]);
  7110. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  7111.  
  7112. g_mysql_SaveVehicle(playerid, playervehicleid);
  7113. }
  7114.  
  7115. forward CheckAccounts(playerid);
  7116. public CheckAccounts(playerid)
  7117. {
  7118. if(IsPlayerConnected(playerid))
  7119. {
  7120. new szString[128];
  7121. new rows, fields;
  7122. cache_get_data(rows, fields, MainPipeline);
  7123. if(rows)
  7124. {
  7125. format(szString, sizeof(szString), "{AA3333}AdmWarning{FFFF00}: Moderator %s has logged into the server with s0beit installed.", GetPlayerNameEx(playerid));
  7126. ABroadCast(COLOR_YELLOW, szString, 2);
  7127.  
  7128. format(szString, sizeof(szString), "Admin %s (IP: %s) has logged into the server with s0beit installed.", GetPlayerNameEx(playerid), GetPlayerIpEx(playerid));
  7129. Log("logs/sobeit.log", szString);
  7130. sobeitCheckvar[playerid] = 1;
  7131. sobeitCheckIsDone[playerid] = 1;
  7132. IsPlayerFrozen[playerid] = 0;
  7133. }
  7134. else
  7135. {
  7136. format(szString, sizeof(szString), "INSERT INTO `sobeitkicks` (sqlID, Kicks) VALUES (%d, 1) ON DUPLICATE KEY UPDATE Kicks = Kicks + 1", GetPlayerSQLId(playerid));
  7137. mysql_function_query(MainPipeline, szString, false, "OnQueryFinish", "ii", SENDDATA_THREAD, playerid);
  7138.  
  7139. SendClientMessageEx(playerid, COLOR_RED, "The hacking tool 's0beit' is not allowed on this server, please uninstall it.");
  7140. format(szString, sizeof(szString), "%s (IP: %s) has logged into the server with s0beit installed.", GetPlayerNameEx(playerid), GetPlayerIpEx(playerid));
  7141. Log("logs/sobeit.log", szString);
  7142. sobeitCheckvar[playerid] = 1;
  7143. sobeitCheckIsDone[playerid] = 1;
  7144. IsPlayerFrozen[playerid] = 0;
  7145. SetTimerEx("KickEx", 1000, 0, "i", playerid);
  7146. }
  7147. }
  7148. return 1;
  7149. }
  7150.  
  7151. forward ReferralSecurity(playerid);
  7152. public ReferralSecurity(playerid)
  7153. {
  7154. new newrows, newfields, newresult[16], currentIP[16], szString[128];
  7155. GetPlayerIp(playerid, currentIP, sizeof(currentIP));
  7156. cache_get_data(newrows, newfields, MainPipeline);
  7157.  
  7158. if(newrows > 0)
  7159. {
  7160. cache_get_field_content(0, "IP", newresult, MainPipeline);
  7161.  
  7162. if(!strcmp(newresult, currentIP, true))
  7163. {
  7164. format(szString, sizeof(szString), "Nobody");
  7165. strmid(PlayerInfo[playerid][pReferredBy], szString, 0, strlen(szString), MAX_PLAYER_NAME);
  7166. ShowPlayerDialog(playerid, REGISTERREF, DIALOG_STYLE_INPUT, "{FF0000}Error", "This person has the same IP as you.\nPlease choose another player that is not on your network.\n\nIf you haven't been referred, press 'Skip'.\n\nExample: FirstName_LastName (20 Characters Max)", "Enter", "Skip");
  7167. }
  7168. else {
  7169. format(szString, sizeof(szString), "[Referral] (New Account: %s (IP:%s)) has been referred by (Referred Account: %s (IP:%s))", GetPlayerNameEx(playerid), currentIP, PlayerInfo[playerid][pReferredBy], newresult);
  7170. Log("logs/referral.log", szString);
  7171. mysql_free_result(MainPipeline);
  7172. RegistrationStep[playerid] = 3;
  7173. SetPlayerVirtualWorld(playerid, 0);
  7174. ClearChatbox(playerid);
  7175. TutStep[playerid] = 24;
  7176. TextDrawShowForPlayer(playerid, txtNationSelHelper);
  7177. TextDrawShowForPlayer(playerid, txtNationSelMain);
  7178. PlayerNationSelection[playerid] = -1;
  7179. SetPlayerVirtualWorld(playerid, 0);
  7180. SetPlayerInterior(playerid, 0);
  7181. Streamer_UpdateEx(playerid,1716.1129,-1880.0715,22.0264);
  7182. SetPlayerPos(playerid,1716.1129,-1880.0715,-10.0);
  7183. SetPlayerCameraPos(playerid,1755.0413,-1824.8710,20.2100);
  7184. SetPlayerCameraLookAt(playerid,1716.1129,-1880.0715,22.0264);
  7185.  
  7186. //Streamer_UpdateEx(playerid, 1607.0160,-1510.8218,207.4438);
  7187. //SetPlayerPos(playerid, 1607.0160,-1510.8218,-10.0);
  7188. //SetPlayerCameraPos(playerid, 1850.1813,-1765.7552,81.9271);
  7189. //SetPlayerCameraLookAt(playerid, 1607.0160,-1510.8218,207.4438);
  7190. }
  7191. }
  7192. return 1;
  7193. }
  7194.  
  7195. forward OnQueryCreateToy(playerid, toyslot);
  7196. public OnQueryCreateToy(playerid, toyslot)
  7197. {
  7198. PlayerToyInfo[playerid][toyslot][ptID] = mysql_insert_id(MainPipeline);
  7199. printf("Toy ID: %d", PlayerToyInfo[playerid][toyslot][ptID]);
  7200.  
  7201. new szQuery[128];
  7202. format(szQuery, sizeof(szQuery), "UPDATE `toys` SET `modelid` = '%d' WHERE `id` = '%d'", PlayerToyInfo[playerid][toyslot][ptID], PlayerToyInfo[playerid][toyslot][ptModelID]);
  7203. mysql_function_query(MainPipeline, szQuery, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  7204.  
  7205. g_mysql_SaveToys(playerid, toyslot);
  7206. }
  7207.  
  7208. forward OnStaffAccountCheck(playerid);
  7209. public OnStaffAccountCheck(playerid)
  7210. {
  7211. new string[156], rows, fields;
  7212. cache_get_data(rows, fields, MainPipeline);
  7213. if(rows > 0)
  7214. {
  7215. format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s (ID: %d) was punished and has a staff account associated with their IP address.", GetPlayerNameEx(playerid), playerid);
  7216. ABroadCast(COLOR_YELLOW, string, 2);
  7217. }
  7218. return 1;
  7219. }
  7220.  
  7221. // Relay For Life
  7222.  
  7223. stock LoadRelayForLifeTeam(teamid)
  7224. {
  7225. new string[128];
  7226. format(string, sizeof(string), "SELECT * FROM `rflteams` WHERE `id`=%d", teamid);
  7227. mysql_function_query(MainPipeline, string, true, "OnLoadRFLTeam", "i", mapiconid);
  7228. }
  7229.  
  7230. stock LoadRelayForLifeTeams()
  7231. {
  7232. printf("[LoadRelayForLifeTeams] Loading data from database...");
  7233. mysql_function_query(MainPipeline, "SELECT * FROM `rflteams`", true, "OnLoadRFLTeams", "");
  7234. }
  7235.  
  7236. forward OnLoadRFLTeams();
  7237. public OnLoadRFLTeams()
  7238. {
  7239. new i, rows, fields, tmp[128];
  7240. cache_get_data(rows, fields, MainPipeline);
  7241.  
  7242. while(i < rows)
  7243. {
  7244. cache_get_field_content(i, "id", tmp, MainPipeline); RFLInfo[i][RFLsqlid] = strval(tmp);
  7245. cache_get_field_content(i, "name", RFLInfo[i][RFLname], MainPipeline);
  7246. cache_get_field_content(i, "leader", RFLInfo[i][RFLleader], MainPipeline);
  7247. cache_get_field_content(i, "used", tmp, MainPipeline); RFLInfo[i][RFLused] = strval(tmp);
  7248. cache_get_field_content(i, "members", tmp, MainPipeline); RFLInfo[i][RFLmembers] = strval(tmp);
  7249. cache_get_field_content(i, "laps", tmp, MainPipeline); RFLInfo[i][RFLlaps] = strval(tmp);
  7250. i++;
  7251. }
  7252. if(i > 0) printf("[LoadRelayForLifeTeams] %d teams loaded.", i);
  7253. else printf("[LoadRelayForLifeTeams] Failed to load any teams.");
  7254. return 1;
  7255. }
  7256.  
  7257. forward OnLoadRFLTeam(index);
  7258. public OnLoadRFLTeam(index)
  7259. {
  7260. new rows, fields, tmp[128];
  7261. cache_get_data(rows, fields, MainPipeline);
  7262.  
  7263. for(new row; row < rows; row++)
  7264. {
  7265. cache_get_field_content(row, "id", tmp, MainPipeline); RFLInfo[index][RFLsqlid] = strval(tmp);
  7266. cache_get_field_content(row, "name", RFLInfo[index][RFLname], MainPipeline);
  7267. cache_get_field_content(row, "leader", RFLInfo[index][RFLleader], MainPipeline);
  7268. cache_get_field_content(row, "used", tmp, MainPipeline); RFLInfo[index][RFLused] = strval(tmp);
  7269. cache_get_field_content(row, "members", tmp, MainPipeline); RFLInfo[index][RFLmembers] = strval(tmp);
  7270. cache_get_field_content(row, "laps", tmp, MainPipeline); RFLInfo[index][RFLlaps] = strval(tmp);
  7271. }
  7272. }
  7273.  
  7274. stock SaveRelayForLifeTeam(teamid)
  7275. {
  7276. new string[248];
  7277. format(string, sizeof(string), "UPDATE `rflteams` SET `name`='%s', `leader`='%s', `used`=%d, `members`=%d, `laps`=%d WHERE id=%d",
  7278. RFLInfo[teamid][RFLname],
  7279. RFLInfo[teamid][RFLleader],
  7280. RFLInfo[teamid][RFLused],
  7281. RFLInfo[teamid][RFLmembers],
  7282. RFLInfo[teamid][RFLlaps],
  7283. RFLInfo[teamid][RFLsqlid]
  7284. );
  7285. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  7286. }
  7287.  
  7288. stock SaveRelayForLifeTeams()
  7289. {
  7290. for(new i = 0; i < MAX_RFLTEAMS; i++)
  7291. {
  7292. SaveRelayForLifeTeam(i);
  7293. }
  7294. }
  7295.  
  7296. forward OnRFLPScore(index, id);
  7297. public OnRFLPScore(index, id)
  7298. {
  7299. new i, rows, fields, string[1500], tmp[7], name[25], leader[25], laps;
  7300. cache_get_data(rows, fields, MainPipeline);
  7301. switch(id) {
  7302. case 1: {
  7303. while(i < rows)
  7304. {
  7305. cache_get_field_content(i, "name", name, MainPipeline);
  7306. cache_get_field_content(i, "leader", leader, MainPipeline);
  7307. cache_get_field_content(i, "laps", tmp, MainPipeline); laps = strval(tmp);
  7308. format(string, sizeof(string), "%s\nTeam: %s | Leader: %s | Laps: %d",string, name, leader, laps);
  7309. i++;
  7310. }
  7311. if(i < 1) {
  7312. DeletePVar(index, "rflTemp");
  7313. SendClientMessageEx(index, COLOR_GREY, "No teams found.");
  7314. return 1;
  7315. }
  7316. if(i >= 15) {
  7317. SetPVarInt(index, "rflTemp", GetPVarInt(index, "rflTemp") + i);
  7318. ShowPlayerDialog(index, DIALOG_RFL_TEAMS, DIALOG_STYLE_LIST, "Relay For Life Teams", string, "Next", "Close");
  7319. return 1;
  7320. }
  7321. else
  7322. {
  7323. DeletePVar(index, "rflTemp");
  7324. ShowPlayerDialog(index, DIALOG_RFL_TEAMS, DIALOG_STYLE_LIST, "Relay For Life Teams", string, "Close", "");
  7325. return 1;
  7326. }
  7327. }
  7328. case 2: {
  7329. while(i < rows)
  7330. {
  7331. cache_get_field_content(i, "Username", name, MainPipeline);
  7332. cache_get_field_content(i, "RacePlayerLaps", tmp, MainPipeline); laps = strval(tmp);
  7333. format(string, sizeof(string), "%s\n%s | Laps: %d",string, name, laps);
  7334. i++;
  7335. }
  7336. if(i > 0) {
  7337. ShowPlayerDialog(index, DIALOG_RFL_PLAYERS, DIALOG_STYLE_LIST, "Relay For Life Player Top 25", string, "Close", "");
  7338. }
  7339. else {
  7340. SendClientMessageEx(index, COLOR_GREY, "No player has run any laps yet.");
  7341. }
  7342. }
  7343. }
  7344. return 1;
  7345. }
  7346.  
  7347. forward OnCheckRFLName(playerid, Player);
  7348. public OnCheckRFLName(playerid, Player)
  7349. {
  7350. if(IsPlayerConnected(Player))
  7351. {
  7352. if(mysql_affected_rows(MainPipeline))
  7353. {
  7354. SendClientMessageEx(Player, COLOR_YELLOW, "This team name already exists.");
  7355. SendClientMessageEx(playerid, COLOR_YELLOW, "This team name already exists.");
  7356. }
  7357. else
  7358. {
  7359. new newname[25], string[128];
  7360. GetPVarString(Player, "NewRFLName", newname, sizeof(newname));
  7361. format(RFLInfo[PlayerInfo[Player][pRFLTeam]][RFLname], 25, "%s", newname);
  7362. format(string, sizeof(string), "* Your team name has been changed to %s.", newname);
  7363. SendClientMessageEx(Player, COLOR_YELLOW, string);
  7364. format(string, sizeof(string), "* You have changed %s's team name to %s.", GetPlayerNameEx(playerid), newname);
  7365. SendClientMessageEx(playerid, COLOR_YELLOW, string);
  7366. format(string, sizeof(string), "%s has accepted %s's team name change request",GetPlayerNameEx(playerid),GetPlayerNameEx(Player));
  7367. ABroadCast(COLOR_YELLOW, string, 3);
  7368. SaveRelayForLifeTeam(PlayerInfo[Player][pRFLTeam]);
  7369. foreach(new i: Player) {
  7370. if( GetPVarInt( i, "EventToken" ) == 1 ) {
  7371. if( EventKernel[ EventStatus ] == 1 || EventKernel[ EventStatus ] == 2 ) {
  7372. if(EventKernel[EventType] == 3) {
  7373. if(PlayerInfo[i][pRFLTeam] == PlayerInfo[Player][pRFLTeam]) {
  7374. format(string, sizeof(string), "Team: %s", newname);
  7375. UpdateDynamic3DTextLabelText(RFLTeamN3D[i], 0x008080FF, string);
  7376. }
  7377. }
  7378. }
  7379. }
  7380. }
  7381. }
  7382. }
  7383. else
  7384. {
  7385. SendClientMessageEx(playerid, COLOR_GREY, "This user has logged off.");
  7386. }
  7387. DeletePVar(Player, "RFLNameRequest");
  7388. DeletePVar(playerid, "RFLNameChange");
  7389. DeletePVar(Player, "NewRFLName");
  7390. return 1;
  7391. }
  7392.  
  7393. stock SavePoint(pid)
  7394. {
  7395. new szQuery[2048];
  7396.  
  7397. format(szQuery, sizeof(szQuery), "UPDATE `points` SET \
  7398. `posx` = '%f', \
  7399. `posy` = '%f', \
  7400. `posz` = '%f', \
  7401. `vw` = '%d', \
  7402. `type` = '%d', \
  7403. `vulnerable` = '%d', \
  7404. `matpoint` = '%d', \
  7405. `owner` = '%s', \
  7406. `cappername` = '%s', \
  7407. `name` = '%s' WHERE `id` = %d",
  7408. Points[pid][Pointx],
  7409. Points[pid][Pointy],
  7410. Points[pid][Pointz],
  7411. Points[pid][pointVW],
  7412. Points[pid][Type],
  7413. Points[pid][Vulnerable],
  7414. Points[pid][MatPoint],
  7415. g_mysql_ReturnEscaped(Points[pid][Owner], MainPipeline),
  7416. g_mysql_ReturnEscaped(Points[pid][CapperName], MainPipeline),
  7417. g_mysql_ReturnEscaped(Points[pid][Name], MainPipeline),
  7418. pid+1
  7419. );
  7420.  
  7421. mysql_function_query(MainPipeline, szQuery, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  7422. }
  7423.  
  7424. forward OnLoadPoints();
  7425. public OnLoadPoints()
  7426. {
  7427. new fields, rows, index, result[128];
  7428. cache_get_data(rows, fields, MainPipeline);
  7429.  
  7430. while((index < rows))
  7431. {
  7432. cache_get_field_content(index, "id", result, MainPipeline); Points[index][pointID] = strval(result);
  7433. cache_get_field_content(index, "posx", result, MainPipeline); Points[index][Pointx] = floatstr(result);
  7434. cache_get_field_content(index, "posy", result, MainPipeline); Points[index][Pointy] = floatstr(result);
  7435. cache_get_field_content(index, "posz", result, MainPipeline); Points[index][Pointz] = floatstr(result);
  7436. cache_get_field_content(index, "vw", result, MainPipeline); Points[index][pointVW] = strval(result);
  7437. cache_get_field_content(index, "type", result, MainPipeline); Points[index][Type] = strval(result);
  7438. cache_get_field_content(index, "vulnerable", result, MainPipeline); Points[index][Vulnerable] = strval(result);
  7439. cache_get_field_content(index, "matpoint", result, MainPipeline); Points[index][MatPoint] = strval(result);
  7440. cache_get_field_content(index, "owner", Points[index][Owner], MainPipeline, 128);
  7441. cache_get_field_content(index, "cappername", Points[index][CapperName], MainPipeline, MAX_PLAYER_NAME);
  7442. cache_get_field_content(index, "name", Points[index][Name], MainPipeline, 128);
  7443. cache_get_field_content(index, "captime", result, MainPipeline); Points[index][CapTime] = strval(result);
  7444. cache_get_field_content(index, "capfam", result, MainPipeline); Points[index][CapFam] = strval(result);
  7445. cache_get_field_content(index, "capname", Points[index][CapName], MainPipeline, MAX_PLAYER_NAME);
  7446.  
  7447. Points[index][CaptureTimerEx2] = -1;
  7448. Points[index][ClaimerId] = INVALID_PLAYER_ID;
  7449. Points[index][PointPickupID] = CreateDynamicPickup(1239, 23, Points[index][Pointx], Points[index][Pointy], Points[index][Pointz], Points[index][pointVW]);
  7450.  
  7451. if(Points[index][CapFam] != INVALID_FAMILY_ID)
  7452. {
  7453. Points[index][CapCrash] = 1;
  7454. Points[index][TakeOverTimerStarted] = 1;
  7455. Points[index][ClaimerTeam] = Points[index][CapFam];
  7456. Points[index][TakeOverTimer] = Points[index][CapTime];
  7457. format(Points[index][PlayerNameCapping], MAX_PLAYER_NAME, "%s", Points[index][CapName]);
  7458. ReadyToCapture(index);
  7459. Points[index][CaptureTimerEx2] = SetTimerEx("CaptureTimerEx", 60000, 1, "d", index);
  7460. }
  7461.  
  7462. index++;
  7463. }
  7464. if(index == 0) print("[Family Points] No family points has been loaded.");
  7465. if(index != 0) printf("[Family Points] %d family points has been loaded.", index);
  7466. return 1;
  7467. }
  7468.  
  7469. stock GetPartnerName(playerid)
  7470. {
  7471. if(PlayerInfo[playerid][pMarriedID] == -1) format(PlayerInfo[playerid][pMarriedName], MAX_PLAYER_NAME, "Nobody");
  7472. else
  7473. {
  7474. new query[128];
  7475. format(query, sizeof(query), "SELECT `Username` FROM `accounts` WHERE `id` = %d", PlayerInfo[playerid][pMarriedID]);
  7476. mysql_function_query(MainPipeline, query, true, "OnGetPartnerName", "i", playerid);
  7477. }
  7478. }
  7479.  
  7480. forward OnGetPartnerName(playerid);
  7481. public OnGetPartnerName(playerid)
  7482. {
  7483. new fields, rows, index;
  7484. cache_get_data(rows, fields, MainPipeline);
  7485.  
  7486. cache_get_field_content(index, "Username", PlayerInfo[playerid][pMarriedName], MainPipeline, MAX_PLAYER_NAME);
  7487. return 1;
  7488. }
  7489.  
  7490. forward OnStaffPrize(playerid);
  7491. public OnStaffPrize(playerid)
  7492. {
  7493. if(mysql_affected_rows(MainPipeline))
  7494. {
  7495. new type[32], name[MAX_PLAYER_NAME], amount, string[128];
  7496. GetPVarString(playerid, "OnSPrizeType", type, 16);
  7497. GetPVarString(playerid, "OnSPrizeName", name, 24);
  7498. amount = GetPVarInt(playerid, "OnSPrizeAmount");
  7499. format(string, sizeof(string), "AdmCmd: %s has offline-given %s %d free %s.", GetPlayerNameEx(playerid), name, amount, type);
  7500. ABroadCast(COLOR_LIGHTRED, string, 2);
  7501. format(string, sizeof(string), "You have given %s %d %s.", name, amount, type);
  7502. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  7503. format(string, sizeof(string), "[Admin] %s(IP:%s) has offline-given %s %d free %s.", GetPlayerNameEx(playerid), GetPlayerIpEx(playerid), name, amount, type);
  7504. Log("logs/adminrewards.log", string);
  7505. }
  7506. else
  7507. {
  7508. SendClientMessageEx(playerid, COLOR_RED, "Failed to give the prize..");
  7509. }
  7510. DeletePVar(playerid, "OnSPrizeType");
  7511. DeletePVar(playerid, "OnSPrizeName");
  7512. DeletePVar(playerid, "OnSPrizeAmount");
  7513. return 1;
  7514. }
  7515.  
  7516. stock AddNewBackpack(id)
  7517. {
  7518. new string[1024];
  7519. format(string, sizeof(string), "INSERT into `hgbackpacks` (type, posx, posy, posz) VALUES ('%d', '%f', '%f', '%f')",
  7520. HungerBackpackInfo[id][hgBackpackType],
  7521. HungerBackpackInfo[id][hgBackpackPos][0],
  7522. HungerBackpackInfo[id][hgBackpackPos][1],
  7523. HungerBackpackInfo[id][hgBackpackPos][2]);
  7524.  
  7525. mysql_function_query(MainPipeline, string, true, "OnQueryFinish", "i", SENDDATA_THREAD);
  7526. }
  7527.  
  7528. stock SaveHGBackpack(id)
  7529. {
  7530. new string[1024];
  7531. format(string, sizeof(string), "UPDATE `hgbackpacks` SET \
  7532. `type` = %d,
  7533. `posx` = %f,
  7534. `posy` = %f,
  7535. `posz` = %f WHERE `id` = %d",
  7536. HungerBackpackInfo[id][hgBackpackType],
  7537. HungerBackpackInfo[id][hgBackpackPos][0],
  7538. HungerBackpackInfo[id][hgBackpackPos][1],
  7539. HungerBackpackInfo[id][hgBackpackPos][2],
  7540. id
  7541. );
  7542.  
  7543. mysql_function_query(MainPipeline, string, false "OnQueryFinish", "i", SENDDATA_THREAD);
  7544. }
  7545.  
  7546. forward OnLoadHGBackpacks();
  7547. public OnLoadHGBackpacks()
  7548. {
  7549. new fields, rows, index, result[128], string[128];
  7550. cache_get_data(rows, fields, MainPipeline);
  7551.  
  7552. while((index < rows))
  7553. {
  7554. cache_get_field_content(index, "id", result, MainPipeline); HungerBackpackInfo[index][hgBackpackId] = strval(result);
  7555. cache_get_field_content(index, "type", result, MainPipeline); HungerBackpackInfo[index][hgBackpackType] = strval(result);
  7556. cache_get_field_content(index, "posx", result, MainPipeline); HungerBackpackInfo[index][hgBackpackPos][0] = floatstr(result);
  7557. cache_get_field_content(index, "posy", result, MainPipeline); HungerBackpackInfo[index][hgBackpackPos][1] = floatstr(result);
  7558. cache_get_field_content(index, "posz", result, MainPipeline); HungerBackpackInfo[index][hgBackpackPos][2] = floatstr(result);
  7559.  
  7560. HungerBackpackInfo[index][hgActiveEx] = 1;
  7561.  
  7562. HungerBackpackInfo[index][hgBackpackPickupId] = CreateDynamicPickup(371, 23, HungerBackpackInfo[index][hgBackpackPos][0], HungerBackpackInfo[index][hgBackpackPos][1], HungerBackpackInfo[index][hgBackpackPos][2], 2039);
  7563. format(string, sizeof(string), "Hunger Games Backpack\nType: %s\n{FF0000}(ID: %d){FFFFFF}", GetBackpackName(index), index);
  7564. HungerBackpackInfo[index][hgBackpack3DText] = CreateDynamic3DTextLabel(string, COLOR_ORANGE, HungerBackpackInfo[index][hgBackpackPos][0], HungerBackpackInfo[index][hgBackpackPos][1], HungerBackpackInfo[index][hgBackpackPos][2]+1, 20.0, .worldid = 2039, .interiorid = 0);
  7565.  
  7566. index++;
  7567. }
  7568.  
  7569. hgBackpackCount = index;
  7570.  
  7571. if(index == 0) print("[Hunger Games] No Backpack has been loaded.");
  7572. if(index != 0) printf("[Hunger Games] %d Backpacks has been loaded.", index);
  7573. return true;
  7574. }
  7575.  
  7576. forward ExecuteShopQueue(playerid, id);
  7577. public ExecuteShopQueue(playerid, id)
  7578. {
  7579. new rows, fields, index, result[128], string[128], query[128], tmp[8];
  7580. switch(id)
  7581. {
  7582. case 0:
  7583. {
  7584. cache_get_data(rows, fields, MainPipeline);
  7585. if(IsPlayerConnected(playerid))
  7586. {
  7587. while(index < rows)
  7588. {
  7589. cache_get_field_content(index, "id", result, MainPipeline); tmp[0] = strval(result);
  7590. cache_get_field_content(index, "GiftVoucher", result, MainPipeline); tmp[1] = strval(result);
  7591. cache_get_field_content(index, "CarVoucher", result, MainPipeline); tmp[2] = strval(result);
  7592. cache_get_field_content(index, "VehVoucher", result, MainPipeline); tmp[3] = strval(result);
  7593. cache_get_field_content(index, "SVIPVoucher", result, MainPipeline); tmp[4] = strval(result);
  7594. cache_get_field_content(index, "GVIPVoucher", result, MainPipeline); tmp[5] = strval(result);
  7595. cache_get_field_content(index, "PVIPVoucher", result, MainPipeline); tmp[6] = strval(result);
  7596. cache_get_field_content(index, "credits_spent", result, MainPipeline); tmp[7] = strval(result);
  7597.  
  7598. if(tmp[1] > 0)
  7599. {
  7600. PlayerInfo[playerid][pGiftVoucher] += tmp[1];
  7601. format(string, sizeof(string), "You have been automatically issued %d gift reset voucher(s).", tmp[1]);
  7602. SendClientMessageEx(playerid, COLOR_WHITE, string);
  7603. format(string, sizeof(string), "[ID: %d] %s was automatically issued %d gift reset voucher(s)", tmp[0], GetPlayerNameEx(playerid), tmp[1]);
  7604. Log("logs/shoplog.log", string);
  7605. }
  7606. if(tmp[2] > 0)
  7607. {
  7608. PlayerInfo[playerid][pCarVoucher] += tmp[2];
  7609. format(string, sizeof(string), "You have been automatically issued %d restricted car voucher(s).", tmp[2]);
  7610. SendClientMessageEx(playerid, COLOR_WHITE, string);
  7611. format(string, sizeof(string), "[ID: %d] %s was automatically issued %d restricted car voucher(s)", tmp[0], GetPlayerNameEx(playerid), tmp[2]);
  7612. Log("logs/shoplog.log", string);
  7613. }
  7614. if(tmp[3] > 0)
  7615. {
  7616. PlayerInfo[playerid][pVehVoucher] += tmp[3];
  7617. format(string, sizeof(string), "You have been automatically issued %d car voucher(s).", tmp[3]);
  7618. SendClientMessageEx(playerid, COLOR_WHITE, string);
  7619. format(string, sizeof(string), "[ID: %d] %s was automatically issued %d car voucher(s)", tmp[0], GetPlayerNameEx(playerid), tmp[3]);
  7620. Log("logs/shoplog.log", string);
  7621. }
  7622. if(tmp[4] > 0)
  7623. {
  7624. PlayerInfo[playerid][pSVIPVoucher] += tmp[4];
  7625. format(string, sizeof(string), "You have been automatically issued %d Silver VIP voucher(s).", tmp[4]);
  7626. SendClientMessageEx(playerid, COLOR_WHITE, string);
  7627. format(string, sizeof(string), "[ID: %d] %s was automatically issued %d Silver VIP voucher(s)", tmp[0], GetPlayerNameEx(playerid), tmp[4]);
  7628. Log("logs/shoplog.log", string);
  7629. }
  7630. if(tmp[5] > 0)
  7631. {
  7632. PlayerInfo[playerid][pGVIPVoucher] += tmp[5];
  7633. format(string, sizeof(string), "You have been automatically issued %d Gold VIP voucher(s).", tmp[5]);
  7634. SendClientMessageEx(playerid, COLOR_WHITE, string);
  7635. format(string, sizeof(string), "[ID: %d] %s was automatically issued %d Gold VIP voucher(s)", tmp[0], GetPlayerNameEx(playerid), tmp[5]);
  7636. Log("logs/shoplog.log", string);
  7637. }
  7638. if(tmp[6] > 0)
  7639. {
  7640. PlayerInfo[playerid][pPVIPVoucher] += tmp[6];
  7641. format(string, sizeof(string), "You have been automatically issued %d Platinum VIP voucher(s).", tmp[6]);
  7642. SendClientMessageEx(playerid, COLOR_WHITE, string);
  7643. format(string, sizeof(string), "[ID: %d] %s was automatically issued %d Platinum VIP voucher(s)", tmp[0], GetPlayerNameEx(playerid), tmp[6]);
  7644. Log("logs/shoplog.log", string);
  7645. }
  7646.  
  7647. PlayerInfo[playerid][pCredits] -= tmp[7];
  7648. format(query, sizeof(query), "UPDATE `shop_orders` SET `status` = 1 WHERE `id` = %d", tmp[0]);
  7649. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  7650. OnPlayerStatsUpdate(playerid);
  7651. return SendClientMessageEx(playerid, COLOR_CYAN, "* Use /myvouchers to check and use your vouchers at any time!");
  7652. }
  7653. }
  7654. }
  7655. case 1:
  7656. {
  7657. cache_get_data(rows, fields, ShopPipeline);
  7658. if(IsPlayerConnected(playerid))
  7659. {
  7660. while(index < rows)
  7661. {
  7662. cache_get_field_content(index, "order_id", result, ShopPipeline); tmp[0] = strval(result);
  7663. cache_get_field_content(index, "credit_amount", result, ShopPipeline); tmp[1] = strval(result);
  7664.  
  7665. PlayerInfo[playerid][pCredits] += tmp[1];
  7666. format(string, sizeof(string), "You have been automatically issued %s credit(s).", number_format(tmp[1]));
  7667. SendClientMessageEx(playerid, COLOR_WHITE, string);
  7668. format(string, sizeof(string), "[ID: %d] %s was automatically issued %s credit(s)", tmp[0], GetPlayerNameEx(playerid), number_format(tmp[1]));
  7669. Log("logs/shoplog.log", string);
  7670. format(query, sizeof(query), "UPDATE `order_delivery_status` SET `status` = 1 WHERE `order_id` = %d", tmp[0]);
  7671. mysql_function_query(ShopPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  7672. OnPlayerStatsUpdate(playerid);
  7673. return 1;
  7674. }
  7675. }
  7676. }
  7677. }
  7678. return 1;
  7679. }
  7680.  
  7681. stock CheckAdminWhitelist(playerid)
  7682. {
  7683. new string[128];
  7684. format(string, sizeof(string), "SELECT `AdminLevel`, `SecureIP` FROM `accounts` WHERE `Username` = '%s'", GetPlayerNameExt(playerid));
  7685. mysql_function_query(MainPipeline, string, true, "OnQueryFinish", "iii", ADMINWHITELIST_THREAD, playerid, g_arrQueryHandle{playerid});
  7686. return true;
  7687. }
  7688.  
  7689. stock GivePlayerCashEx(playerid, type, amount)
  7690. {
  7691. if(IsPlayerConnected(playerid) && gPlayerLogged{playerid})
  7692. {
  7693. new szQuery[128];
  7694. switch(type)
  7695. {
  7696. case TYPE_BANK:
  7697. {
  7698. PlayerInfo[playerid][pAccount] += amount;
  7699. format(szQuery, sizeof(szQuery), "UPDATE `accounts` SET `Bank`=%d WHERE `id` = %d", PlayerInfo[playerid][pAccount], GetPlayerSQLId(playerid));
  7700. mysql_function_query(MainPipeline, szQuery, false, "OnQueryFinish", "ii", SENDDATA_THREAD, playerid);
  7701. }
  7702. case TYPE_ONHAND:
  7703. {
  7704. PlayerInfo[playerid][pCash] += amount;
  7705. format(szQuery, sizeof(szQuery), "UPDATE `accounts` SET `Money`=%d WHERE `id` = %d", PlayerInfo[playerid][pCash], GetPlayerSQLId(playerid));
  7706. mysql_function_query(MainPipeline, szQuery, false, "OnQueryFinish", "ii", SENDDATA_THREAD, playerid);
  7707. }
  7708. }
  7709. }
  7710. return 1;
  7711. }
  7712.  
  7713. stock PointCrashProtection(point)
  7714. {
  7715. new query[128], temp;
  7716. temp = Points[point][ClaimerTeam];
  7717. if(temp == INVALID_PLAYER_ID)
  7718. {
  7719. temp = INVALID_FAMILY_ID;
  7720. }
  7721. format(query, sizeof(query), "UPDATE `points` SET `captime` = %d, `capfam` = %d, `capname` = '%s' WHERE `id` = %d",Points[point][TakeOverTimer], temp, Points[point][PlayerNameCapping], Points[point][pointID]);
  7722. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  7723. return 1;
  7724. }
  7725.  
  7726. /*stock LoadHelp()
  7727. {
  7728. printf("[LoadHelp] Loading data from database...");
  7729. mysql_function_query(MainPipeline, "SELECT * FROM `help`", true, "OnLoadHelp", "");
  7730. }
  7731.  
  7732. forward OnLoadHelp();
  7733. public OnLoadHelp()
  7734. {
  7735. new i, rows, fields, tmp[128];
  7736. cache_get_data(rows, fields, MainPipeline);
  7737.  
  7738. TOTAL_COMMANDS = rows;
  7739. while(i < rows)
  7740. {
  7741. cache_get_field_content(i, "id", tmp, MainPipeline); HelpInfo[i][id] = strval(tmp);
  7742. cache_get_field_content(i, "name", HelpInfo[i][name], MainPipeline, 255);
  7743. cache_get_field_content(i, "params", HelpInfo[i][params], MainPipeline, 255);
  7744. cache_get_field_content(i, "description", HelpInfo[i][description], MainPipeline, 255);
  7745. cache_get_field_content(i, "type", tmp, MainPipeline); HelpInfo[i][type] = strval(tmp);
  7746. cache_get_field_content(i, "subtype", tmp, MainPipeline); HelpInfo[i][subtype] = strval(tmp);
  7747. cache_get_field_content(i, "perms", tmp, MainPipeline); HelpInfo[i][perms] = strval(tmp);
  7748. i++;
  7749. }
  7750. }*/
  7751.  
  7752. stock LoadGangTags()
  7753. {
  7754. new query[128];
  7755. format(query, sizeof(query), "SELECT * FROM `gangtags` LIMIT %d", MAX_GANGTAGS);
  7756. mysql_function_query(MainPipeline, query, true, "OnGangTagQueryFinish", "ii", LOAD_GANGTAGS, -1);
  7757. }
  7758.  
  7759. stock SaveGangTag(gangtag)
  7760. {
  7761. new query[256];
  7762. format(query, sizeof(query), "UPDATE `gangtags` SET \
  7763. `posx` = %f, \
  7764. `posy` = %f, \
  7765. `posz` = %f, \
  7766. `posrx` = %f, \
  7767. `posry` = %f, \
  7768. `posrz` = %f, \
  7769. `objectid` = %d, \
  7770. `vw` = %d, \
  7771. `interior` = %d, \
  7772. `family` = %d, \
  7773. `time` = %d, \
  7774. `used` = %d WHERE `id` = %d",
  7775. GangTags[gangtag][gt_PosX],
  7776. GangTags[gangtag][gt_PosY],
  7777. GangTags[gangtag][gt_PosZ],
  7778. GangTags[gangtag][gt_PosRX],
  7779. GangTags[gangtag][gt_PosRY],
  7780. GangTags[gangtag][gt_PosRZ],
  7781. GangTags[gangtag][gt_ObjectID],
  7782. GangTags[gangtag][gt_VW],
  7783. GangTags[gangtag][gt_Int],
  7784. GangTags[gangtag][gt_Family],
  7785. GangTags[gangtag][gt_Time],
  7786. GangTags[gangtag][gt_Used],
  7787. GangTags[gangtag][gt_SQLID]
  7788. );
  7789. mysql_function_query(MainPipeline, query, false, "OnGangTagQueryFinish", "ii", SAVE_GANGTAG, gangtag);
  7790. }
  7791.  
  7792. forward OnGangTagQueryFinish(threadid, extraid);
  7793. public OnGangTagQueryFinish(threadid, extraid)
  7794. {
  7795. new fields, rows;
  7796. cache_get_data(rows, fields, MainPipeline);
  7797. switch(threadid)
  7798. {
  7799. case LOAD_GANGTAGS:
  7800. {
  7801. new row, result[64];
  7802. while(row < rows)
  7803. {
  7804. cache_get_field_content(row, "id", result, MainPipeline); GangTags[row][gt_SQLID] = strval(result);
  7805. cache_get_field_content(row, "posx", result, MainPipeline); GangTags[row][gt_PosX] = floatstr(result);
  7806. cache_get_field_content(row, "posy", result, MainPipeline); GangTags[row][gt_PosY] = floatstr(result);
  7807. cache_get_field_content(row, "posz", result, MainPipeline); GangTags[row][gt_PosZ] = floatstr(result);
  7808. cache_get_field_content(row, "posrx", result, MainPipeline); GangTags[row][gt_PosRX] = floatstr(result);
  7809. cache_get_field_content(row, "posry", result, MainPipeline); GangTags[row][gt_PosRY] = floatstr(result);
  7810. cache_get_field_content(row, "posrz", result, MainPipeline); GangTags[row][gt_PosRZ] = floatstr(result);
  7811. cache_get_field_content(row, "objectid", result, MainPipeline); GangTags[row][gt_ObjectID] = strval(result);
  7812. cache_get_field_content(row, "vw", result, MainPipeline); GangTags[row][gt_VW] = strval(result);
  7813. cache_get_field_content(row, "interior", result, MainPipeline); GangTags[row][gt_Int] = strval(result);
  7814. cache_get_field_content(row, "family", result, MainPipeline); GangTags[row][gt_Family] = strval(result);
  7815. cache_get_field_content(row, "used", result, MainPipeline); GangTags[row][gt_Used] = strval(result);
  7816. cache_get_field_content(row, "time", result, MainPipeline); GangTags[row][gt_Time] = strval(result);
  7817. CreateGangTag(row);
  7818. row++;
  7819. }
  7820. if(row > 0)
  7821. {
  7822. printf("[MYSQL] Successfully loaded %d gang tags.", row);
  7823. }
  7824. else
  7825. {
  7826. print("[MYSQL] Failed loading any gang tags.");
  7827. }
  7828. }
  7829. case SAVE_GANGTAG:
  7830. {
  7831. if(mysql_affected_rows(MainPipeline))
  7832. {
  7833. printf("[MYSQL] Successfully saved gang tag %d (SQLID: %d).", extraid, GangTags[extraid][gt_SQLID]);
  7834. }
  7835. else
  7836. {
  7837. printf("[MYSQL] Failed saving gang tag %d (SQLID: %d).", extraid, GangTags[extraid][gt_SQLID]);
  7838. }
  7839. }
  7840. }
  7841. return 1;
  7842. }
  7843.  
  7844. // g_mysql_LoadGiftBox()
  7845. // Description: Loads the data of the dynamic giftbox from the SQL Database.
  7846. stock g_mysql_LoadGiftBox()
  7847. {
  7848. print("[Dynamic Giftbox] Loading the Dynamic Giftbox...");
  7849. mysql_function_query(MainPipeline, "SELECT * FROM `giftbox`", true, "OnQueryFinish", "iii", LOADGIFTBOX_THREAD, INVALID_PLAYER_ID, -1);
  7850. }
  7851.  
  7852. stock SaveDynamicGiftBox()
  7853. {
  7854. new query[4096];
  7855. for(new i = 0; i < 4; i++)
  7856. {
  7857. if(i == 0)
  7858. format(query, sizeof(query), "UPDATE `giftbox` SET `dgMoney%d` = '%d',", i, dgMoney[i]);
  7859. else
  7860. format(query, sizeof(query), "%s `dgMoney%d` = '%d',", query, i, dgMoney[i]);
  7861.  
  7862. format(query, sizeof(query), "%s `dgRimKit%d` = '%d',", query, i, dgRimKit[i]);
  7863. format(query, sizeof(query), "%s `dgFirework%d` = '%d',", query, i, dgFirework[i]);
  7864. format(query, sizeof(query), "%s `dgGVIP%d` = '%d',", query, i, dgGVIP[i]);
  7865. format(query, sizeof(query), "%s `dgSVIP%d` = '%d',", query, i, dgSVIP[i]);
  7866. format(query, sizeof(query), "%s `dgGVIPEx%d` = '%d',", query, i, dgGVIPEx[i]);
  7867. format(query, sizeof(query), "%s `dgSVIPEx%d` = '%d',", query, i, dgSVIPEx[i]);
  7868. format(query, sizeof(query), "%s `dgCarSlot%d` = '%d',", query, i, dgCarSlot[i]);
  7869. format(query, sizeof(query), "%s `dgToySlot%d` = '%d',", query, i, dgToySlot[i]);
  7870. format(query, sizeof(query), "%s `dgArmor%d` = '%d',", query, i, dgArmor[i]);
  7871. format(query, sizeof(query), "%s `dgFirstaid%d` = '%d',", query, i, dgFirstaid[i]);
  7872. format(query, sizeof(query), "%s `dgDDFlag%d` = '%d',", query, i, dgDDFlag[i]);
  7873. format(query, sizeof(query), "%s `dgGateFlag%d` = '%d',", query, i, dgGateFlag[i]);
  7874. format(query, sizeof(query), "%s `dgCredits%d` = '%d',", query, i, dgCredits[i]);
  7875. format(query, sizeof(query), "%s `dgPriorityAd%d` = '%d',", query, i, dgPriorityAd[i]);
  7876. format(query, sizeof(query), "%s `dgHealthNArmor%d` = '%d',", query, i, dgHealthNArmor[i]);
  7877. format(query, sizeof(query), "%s `dgGiftReset%d` = '%d',", query, i, dgGiftReset[i]);
  7878. format(query, sizeof(query), "%s `dgMaterial%d` = '%d',", query, i, dgMaterial[i]);
  7879. format(query, sizeof(query), "%s `dgWarning%d` = '%d',", query, i, dgWarning[i]);
  7880. format(query, sizeof(query), "%s `dgPot%d` = '%d',", query, i, dgPot[i]);
  7881. format(query, sizeof(query), "%s `dgCrack%d` = '%d',", query, i, dgCrack[i]);
  7882. format(query, sizeof(query), "%s `dgPaintballToken%d` = '%d',", query, i, dgPaintballToken[i]);
  7883. format(query, sizeof(query), "%s `dgVIPToken%d` = '%d',", query, i, dgVIPToken[i]);
  7884. format(query, sizeof(query), "%s `dgRespectPoint%d` = '%d',", query, i, dgRespectPoint[i]);
  7885. format(query, sizeof(query), "%s `dgCarVoucher%d` = '%d',", query, i, dgCarVoucher[i]);
  7886. format(query, sizeof(query), "%s `dgBuddyInvite%d` = '%d',", query, i, dgBuddyInvite[i]);
  7887. format(query, sizeof(query), "%s `dgLaser%d` = '%d',", query, i, dgLaser[i]);
  7888. format(query, sizeof(query), "%s `dgCustomToy%d` = '%d',", query, i, dgCustomToy[i]);
  7889. format(query, sizeof(query), "%s `dgAdmuteReset%d` = '%d',", query, i, dgAdmuteReset[i]);
  7890. format(query, sizeof(query), "%s `dgNewbieMuteReset%d` = '%d',", query, i, dgNewbieMuteReset[i]);
  7891.  
  7892. if(i == 3)
  7893. format(query, sizeof(query), "%s `dgRestrictedCarVoucher%d` = '%d'", query, i, dgRestrictedCarVoucher[i]);
  7894. else
  7895. format(query, sizeof(query), "%s `dgPlatinumVIPVoucher%d` = '%d',", query, i, dgPlatinumVIPVoucher[i]);
  7896. }
  7897.  
  7898. mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  7899. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement