Guest User

Untitled

a guest
May 29th, 2014
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.60 KB | None | 0 0
  1. // This file holds all common functions that don't fit in any other file
  2.  
  3. // This functions gives the player the given amount of money and scorepoints
  4. RewardPlayer(playerid, Money, Points)
  5. {
  6. // Add the given amount of money to the player's account
  7. APlayerData[playerid][PlayerMoney] = APlayerData[playerid][PlayerMoney] + Money;
  8. // Add the given amount of scorepoints to the player's account
  9. APlayerData[playerid][PlayerScore] = APlayerData[playerid][PlayerScore] + Points;
  10. }
  11.  
  12. // This function creates the vehicle and saves the vehicle-lodel in the AVehicleData-array (can only be used during GameModeInit)
  13. // It also sets the fuel to maximum
  14. Vehicle_AddStatic(vModel, Float:vX, Float:vY, Float:vZ, Float:vRotation, vC1, vC2, vSpawnDelay)
  15. {
  16. // Create a new static vehicle during GameModeInit
  17. new vid = AddStaticVehicleEx(vModel, vX, vY, vZ, vRotation, vC1, vC2, vSpawnDelay);
  18. // Save the vehicle-model
  19. AVehicleData[vid][Model] = vModel;
  20. // Set the fuel to maximum so the vehicle can be used
  21. AVehicleData[vid][Fuel] = MaxFuel;
  22. // Save the colors
  23. AVehicleData[vid][Color1] = vC1;
  24. AVehicleData[vid][Color2] = vC2;
  25. // Set this vehicle as a static vehicle
  26. AVehicleData[vid][StaticVehicle] = true;
  27.  
  28. return vid;
  29. }
  30.  
  31. // This function is the same as Vehicle_AddStatic, but uses CreateVehicle instead of AddStaticVehicleEx, so can be used everywhere
  32. Vehicle_Create(vModel, Float:vX, Float:vY, Float:vZ, Float:vRotation, vC1, vC2, vSpawnDelay)
  33. {
  34. // Create a new static vehicle during GameModeInit
  35. new vid = CreateVehicle(vModel, vX, vY, vZ, vRotation, vC1, vC2, vSpawnDelay);
  36. // Save the vehicle-model
  37. AVehicleData[vid][Model] = vModel;
  38. // Set the fuel to maximum so the vehicle can be used
  39. AVehicleData[vid][Fuel] = MaxFuel;
  40. // Save the colors
  41. AVehicleData[vid][Color1] = vC1;
  42. AVehicleData[vid][Color2] = vC2;
  43.  
  44. return vid;
  45. }
  46.  
  47. // This function deletes the vehicle and clears all the data (is only used for player-owned vehicles)
  48. Vehicle_Delete(vid)
  49. {
  50. // Setup local variables
  51. new HouseID, CarSlot;
  52.  
  53. // Get the HouseID and CarSlot where the vehicle is linked to
  54. HouseID = AVehicleData[vid][BelongsToHouse];
  55.  
  56. // Check if this was a valid HouseID
  57. if (HouseID != 0)
  58. {
  59. // Loop through all carslots of this house to find the vehicle-id
  60. for (new i; i < 10; i++)
  61. {
  62. // Check if this carslot holds the same vehicle-id
  63. if (AHouseData[HouseID][VehicleIDs][i] == vid)
  64. {
  65. CarSlot = i; // The carslot has been found where the vehicle is stored, remember it
  66. break; // Stop the for-loop
  67. }
  68. }
  69.  
  70. // Remove the vehicle from the house
  71. AHouseData[HouseID][VehicleIDs][CarSlot] = 0;
  72. }
  73.  
  74. // Delete the vehicle
  75. DestroyVehicle(vid);
  76. // Clear the data
  77. AVehicleData[vid][Owned] = false;
  78. AVehicleData[vid][Owner] = 0;
  79. AVehicleData[vid][Model] = 0;
  80. AVehicleData[vid][PaintJob] = 0;
  81. for (new i; i < 14; i++)
  82. AVehicleData[vid][Components][i] = 0;
  83. AVehicleData[vid][Color1] = 0;
  84. AVehicleData[vid][Color2] = 0;
  85. AVehicleData[vid][SpawnX] = 0.0;
  86. AVehicleData[vid][SpawnY] = 0.0;
  87. AVehicleData[vid][SpawnZ] = 0.0;
  88. AVehicleData[vid][SpawnRot] = 0.0;
  89. AVehicleData[vid][BelongsToHouse] = 0;
  90. }
  91.  
  92. // This function returns "1" if both locations are not closeby and returns "0" if both locations are close to eachother
  93. Locations_CheckDistance(LocationA, LocationB, Float:Range)
  94. {
  95. // Setup local variables
  96. new Float:Xa, Float:Ya, Float:Xb, Float:Yb, Float:X, Float:Y;
  97.  
  98. // Get the coordinates of LocationA
  99. Xa = ALocations[LocationA][LocX];
  100. Ya = ALocations[LocationA][LocY];
  101. // Get the coordinates of LocationB
  102. Xb = ALocations[LocationB][LocX];
  103. Yb = ALocations[LocationB][LocY];
  104.  
  105. // Calculate the distances between both locations
  106. Y = Yb - Ya;
  107. X = Xb - Xa;
  108.  
  109. // Check if both locations are further apart then the range indicates
  110. if (((X * X) + (Y * Y)) > (Range * Range))
  111. return 1; // Location B is further away from Location A than Range indicates
  112. else
  113. return 0; // both locations are closer to eachother than Range indicates
  114. }
  115.  
  116. // This function ports all non-admin players out of the given area to the location specified
  117. Player_PortOutAdminZone(playerid, Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2, Float:x3, Float:y3, Float:z3)
  118. {
  119. // Setup local variables
  120. new Float:x, Float:y, Float:z;
  121.  
  122. // Get the player's coordinates
  123. GetPlayerPos(playerid, x, y, z);
  124.  
  125. // Check if the player is not an admin
  126. if (APlayerData[playerid][PlayerLevel] == 0)
  127. if ((x1 < x) && (x < x2))
  128. if ((y1 < y) && (y < y2))
  129. if ((z1 < z) && (z < z2))
  130. {
  131. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You're not allowed inside an admin-area");
  132. SetPlayerPos(playerid, x3, y3, z3); // Port the player out of the area
  133. }
  134. }
  135.  
  136. // This function sends the given text to all admins
  137. SendAdminText(playerid, command[], text[])
  138. {
  139. // Setup local variables
  140. new Name[24], Msg[128];
  141.  
  142. // Get the player's name
  143. GetPlayerName(playerid, Name, sizeof(Name));
  144. // Loop through all players
  145. for (new i; i < MAX_PLAYERS; i++)
  146. {
  147. // Check if the player is an admin
  148. if (APlayerData[i][PlayerLevel] > 0)
  149. {
  150. // Send the given text to the admin
  151. format(Msg, 128, "{FF0000}%s {00FF00}used: {0000FF}%s %s", Name, command, text);
  152. SendClientMessage(i, 0xFFFFFFFF, Msg);
  153. }
  154. }
  155.  
  156. // Also log all used commands in the server.log file
  157. format(Msg, 128, "%s used: %s %s", Name, command, text);
  158. print(Msg);
  159. }
  160.  
  161. // This timer informs the player how long he will be frozen
  162. forward Player_FreezeTimer(playerid);
  163. public Player_FreezeTimer(playerid)
  164. {
  165. // Setup local variables
  166. new Msg[128];
  167.  
  168. // Decrease the remaining time this player will be frozen
  169. APlayerData[playerid][PlayerFrozen]--;)
  170.  
  171. // Check if the player is allowed to move again
  172. if (APlayerData[playerid][PlayerFrozen] >= 1)
  173. {
  174. // Construct the message to inform the player how long he stays frozen
  175. if (APlayerData[playerid][PlayerFrozen] >= 60)
  176. format(Msg, 128, "Frozen for %i minutes", APlayerData[playerid][PlayerFrozen] / 60);
  177. else
  178. format(Msg, 128, "Frozen for %i seconds", APlayerData[playerid][PlayerFrozen]);
  179.  
  180. // Display the message to inform the player how long he stays frozen
  181. GameTextForPlayer(playerid, Msg, 1000, 4);
  182. }
  183. else { // The timer has run out, so allow his to move again
  184. TogglePlayerControllable(playerid, 1);
  185. KillTimer(FreezeTimer[playerid]);
  186. }
  187. }
  188.  
  189. // This function creates a list of commands, starting from the FirstCommand and automatically shows the dialog
  190. CommandList_Create(playerid)
  191. {
  192. // Setup local variables
  193. new Counter, CommandList[1000], DialogTitle[128];
  194.  
  195. // Only add 4 commands to the list, starting from the FirstItem
  196. for (new i = APlayerData[playerid][DialogFirstItem]; i < sizeof(ACommands); i++)
  197. {
  198. // Increase a counter (which holds the number of commands that have been added to the list
  199. Counter++;
  200.  
  201. // Check if the maximum hasn't been reached yet
  202. if (Counter <= 5)
  203. {
  204. // Check if this command is valid for this player
  205. if (APlayerData[playerid][PlayerLevel] >= ACommands[i][CommandLevel])
  206. {
  207. // Check if the command is used for admins or not
  208. if (ACommands[i][CommandLevel] == 0)
  209. {
  210. // Add the commandname and description to the list
  211. format(CommandList, 500, "%s%s{00FF00}%s", CommandList, "\n", ACommands[i][CommandStructure]); // Add the name of the next command to the list on the next line
  212. format(CommandList, 500, "%s%s\t\t{FFFF00}%s", CommandList, "\n", ACommands[i][CommandDescription]); // Add the description of the next command to the list on the next line
  213. }
  214. else
  215. {
  216. // Add the commandname and description to the list
  217. format(CommandList, 500, "%s%sLvl %i: {00FF00}%s", CommandList, "\n", ACommands[i][CommandLevel], ACommands[i][CommandStructure]); // Add the name of the next command to the list on the next line
  218. format(CommandList, 500, "%s%s\t\t{FFFF00}%s", CommandList, "\n", ACommands[i][CommandDescription]); // Add the description of the next command to the list on the next line
  219. }
  220. }
  221. else
  222. break;
  223. }
  224. else // 5 commands have been added to the list (now Counter = 6)
  225. {
  226. // Add an empty line and "Next..." to the list to let the player know there are more commands
  227. format(CommandList, 500, "%s%s%s", CommandList, "\n \n", TXT_DialogEntryNext);
  228. // Also stop the For-loop
  229. break;
  230. }
  231. }
  232.  
  233. // Construct the title for the dialog (to include a page number)
  234. format(DialogTitle, 128, TXT_DialogCommandTitle, (APlayerData[playerid][DialogFirstItem] / 5) + 1);
  235. // Show the commands in a dialog
  236. ShowPlayerDialog(playerid, DialogPlayerCommands, DIALOG_STYLE_LIST, DialogTitle, CommandList, TXT_DialogButtonSelect, TXT_DialogButtonCancel);
  237.  
  238. return 1;
  239. }
  240.  
  241. // This function returns "1" if the given vehicle-id is a plane or helicopter
  242. IsVehicleAirVehicle(vid)
  243. {
  244. switch (GetVehicleModel(vid))
  245. {
  246. case 592, 577, 511, 512, 593, 520, 553, 476, 519, 460, 513, 548, 425, 417, 487, 488, 497, 563, 447, 469: return 1;
  247. default: return 0;
  248. }
  249.  
  250. return 0;
  251. }
  252.  
  253. // This function creates a speedcamera (store data and create the objects)
  254. SetupSpeedCamera(CamID, Float:x, Float:y, Float:z, Float:rot, MaxSpeed)
  255. }
  256.  
  257.  
  258. // Store all the given values
  259. ACameras[CamID][CamX] = x;
  260. ACameras[CamID][CamY] = y;
  261. ACameras[CamID][CamZ] = z;
  262. ACameras[CamID][CamAngle] = rot;
  263. ACameras[CamID][CamSpeed] = MaxSpeed;
  264. // Create both camera objects and store their reference
  265. ACameras[CamID][CamObj1] = CreateObject(18880, x, y, z, 0.0, 0.0, rot);
  266. ACameras[CamID][CamObj2] = CreateObject(18880, x, y, z, 0.0, 0.0, rot + 180.0);
  267. format(TextMaxSpeed, sizeof(TextMaxSpeed), "%s %i", TXT_MaxSpeedCamera, MaxSpeed);
  268. ACameras[CamID][LabelID] = Create3DTextLabel(TextMaxSpeed, 0xFF0000FF, x, y, z + 0.75, 100.0, 0, 0);
  269. }
  270.  
  271.  
  272. // This function sends the report to all admins
  273. SendReportToAdmins(OffenderID, Reason[], bool:AutoReport = false)
  274. {
  275. // Setup local variables
  276. new Name[24], Msg[128], TxtMsg[128], TotalReason[128];
  277.  
  278. // Get the name of the offender
  279. GetPlayerName(OffenderID, Name, sizeof(Name));
  280.  
  281. // Construct the report message for all admins
  282. if (AutoReport == false)
  283. {
  284. // Construct the report messages for a normal report
  285. format(Msg, 128, "{00FFFF}*** Report: %s (%i): %s", Name, OffenderID, Reason);
  286. format(TxtMsg, 128, "Report:~n~~g~%s (%i)~n~~r~%s", Name, OffenderID, Reason);
  287. format(TotalReason, 128, Reason);
  288. }
  289. else
  290. {
  291. // Construct the report messages for an automated report (sent by the AntiHack function)
  292. format(Msg, 128, "{00FFFF}*** Auto-Report: %s (%i): %s", Name, OffenderID, Reason);
  293. format(TxtMsg, 128, "Auto-Report:~n~~g~%s (%i)~n~~r~%s", Name, OffenderID, Reason);
  294. format(TotalReason, 128, "%s (by AntiHack)", Reason);
  295. // For automated reports, preset the time to 60 seconds to stop the Anti-Hack system reporting the player every half a second
  296. APlayerData[OffenderID][AutoReportTime] = 120; // The time must be doubled, as the speedometer runs twice every second
  297. }
  298.  
  299. // Loop through all the players to find all online admins
  300. for (new playerid; playerid < MAX_PLAYERS; playerid++)
  301. {
  302. // Check if this player is an admin
  303. if (APlayerData[playerid][PlayerLevel] > 0)
  304. {
  305. // Send a message to the admin to inform him about the report
  306. SendClientMessage(playerid, 0xFFFFFFFF, Msg);
  307. // Also send the admin a GameText-message so he can see it more clearly
  308. GameTextForPlayer(playerid, TxtMsg, 10000, 4);
  309. }
  310. }
  311.  
  312. // Add the report to the AReports-array so admins can review it in a dialog (maximum 50 reports can be stored)
  313. AddReport(OffenderID, TotalReason);
  314. }
  315.  
  316. // This function adds the report to the AReports array automatically
  317. AddReport(OffenderID, Reason[])
  318. {
  319. // Setup local variables
  320. new ReportID = -1, Name[24];
  321.  
  322. // Check if there is a free spot in the AReports array
  323. for (new i; i < 50; i++)
  324. {
  325. // Check if this report-spot is empty
  326. if (AReports[i][ReportUsed] == false)
  327. {
  328. ReportID = i;
  329. break; // If this spot hasn't been used yet, stop the for-loop
  330. }
  331. }
  332.  
  333. // If no spot is free (ReportID is still -1)
  334. if (ReportID == -1)
  335. {
  336. // Drop the report on ID 0, and move them all downwards
  337. for (new i = 1; i < 50; i++)
  338. {
  339. AReports[i - 1][ReportUsed] = AReports[i][ReportUsed];
  340. format(AReports[i - 1][ReportName], 24, "%s", AReports[i][ReportName]);
  341. format(AReports[i - 1][ReportReason], 128, "%s", AReports[i][ReportReason]);
  342. }
  343.  
  344. // ReportID 49 is available now, so use this to add the new report
  345. ReportID = 49;
  346. }
  347.  
  348. // Get the name of the offender
  349. GetPlayerName(OffenderID, Name, sizeof(Name));
  350.  
  351. // Store the data into the array
  352. AReports[ReportID][ReportUsed] = true;
  353. format(AReports[ReportID][ReportName], 24, "%s", Name);
  354. format(AReports[ReportID][ReportReason], 128, "%s", Reason);
  355. }
  356.  
  357.  
  358.  
  359. // This function converts an ip-address into 4 separate integer parts and returns a string that only holds the first three parts
  360. GetFirstThreeDigitsFromIP(PlayerIP[])
  361. {
  362. // Setup local variables
  363. new Part1, Part2, Part3, DotLoc, RetIP[16];
  364.  
  365. // Get the first part of the IP-address
  366. Part1 = strval(PlayerIP[0]);
  367.  
  368. // Find the first dot
  369. DotLoc = strfind(PlayerIP, ".", false, 0);
  370. // Get the second part of the IP-address (the part that follows the first dot)
  371. Part2 = strval(PlayerIP[DotLoc+1]);
  372.  
  373. // Find the second dot
  374. DotLoc = strfind(PlayerIP, ".", false, DotLoc+1);
  375. // Get the third part of the IP-address (the part that follows the second dot)
  376. Part3 = strval(PlayerIP[DotLoc+1]);
  377.  
  378. // Combine them all into an IP that only holds the first three digits, followed by a dot
  379. format(RetIP, 16, "%i.%i.%i.", Part1, Part2, Part3);
  380. // Return it to the calling function
  381. return RetIP;
  382. }
  383.  
  384.  
  385.  
  386. // This timer is executed every 2 minutes and sends all timedmessages one at a time
  387. forward Timer_TimedMessages();
  388. public Timer_TimedMessages()
  389. {
  390. // Send the message
  391. SendClientMessageToAll(0xFFFFFFFF, ATimedMessages[LastTimedMessage]);
  392.  
  393. // Select the next message
  394. LastTimedMessage++;
  395.  
  396. // Check if the next chosen message exists (the messagenumber is the same as the size of the array of messages)
  397. if (LastTimedMessage == sizeof(ATimedMessages))
  398. LastTimedMessage = 0; // Select the first message again
  399.  
  400. return 1;
  401. }
  402.  
  403. // This timer is executed every 5 minutes and sends the data about a random bonus mission to every trucker
  404. forward ShowRandomBonusMission();
  405. public ShowRandomBonusMission()
  406. {
  407. // Setup local variables
  408. new bool:MissionSet = false, Msg1[128], Msg2[128], Msg3[128], lName[50], sName[50], eName[50], tName[100];
  409.  
  410. // Check if there is no mission defined yet (only happens when server is restarted), or when the mission has been completed by a player
  411. if ((RandomBonusMission[RandomLoad] == 0) || (RandomBonusMission[MissionFinished] == true))
  412. {
  413. // Keep checking until a valid mission has been set
  414. while (MissionSet == false)
  415. {
  416. // Choose a random LoadID
  417. RandomBonusMission[RandomLoad] = random(sizeof(ALoads));
  418.  
  419. switch (RandomBonusMission[RandomLoad])
  420. {
  421. case 0: MissionSet = false; // If the dummy load has been chosen, allow the while loop to run again to search for another valid load
  422. default: // If another load has been chosen, check if it is a trucker load
  423. {
  424. switch(ALoads[RandomBonusMission[RandomLoad]][PCV_Required]) // Check the class & vehicle variable
  425. {
  426. case PCV_TruckerOreTrailer, PCV_TruckerFluidsTrailer, PCV_TruckerCargoTrailer, PCV_TruckerCementTruck, PCV_TruckerNoTrailer, PCV_TruckerDumper, PCV_TruckerPacker, PCV_TruckerSecuricar:
  427. {
  428. // Now only the loads for truckers are checked
  429. MissionSet = true; // The load has been determined now as it's a valid load for truckers only
  430. }
  431. default: MissionSet = false; // If another class & vehicle has been chosen (mafia or pilot load), search again
  432. }
  433. }
  434. }
  435. }
  436.  
  437. // Find a random startlocation and endlocation from the chosen load
  438. RandomBonusMission[RandomStartLoc] = Product_GetRandomStartLoc(RandomBonusMission[RandomLoad]);
  439. RandomBonusMission[RandomEndLoc] = Product_GetRandomEndLoc(RandomBonusMission[RandomLoad]);
  440. // Set the new random mission as not-completed yet
  441. RandomBonusMission[MissionFinished] = false;
  442. }
  443.  
  444. // Get the names of the load, start-location and end-location
  445. format(lName, 50, ALoads[RandomBonusMission[RandomLoad]][LoadName]);
  446. format(sName, 50, ALocations[RandomBonusMission[RandomStartLoc]][LocationName]);
  447. format(eName, 50, ALocations[RandomBonusMission[RandomEndLoc]][LocationName]);
  448. // Setup the name of the vehicle you'll need for this mission
  449. switch(ALoads[RandomBonusMission[RandomLoad]][PCV_Required])
  450. {
  451. case PCV_TruckerOreTrailer: format(tName, 128, "Truck With Ore Trailer");
  452. case PCV_TruckerFluidsTrailer: format(tName, 128, "Truck With Fluids Trailer");
  453. case PCV_TruckerCargoTrailer: format(tName, 128, "Truck With Cargo Trailer");
  454. case PCV_TruckerCementTruck: format(tName, 128, "Cement Truck");
  455. case PCV_TruckerNoTrailer: format(tName, 128, "Flatbed or DFT-30");
  456. case PCV_TruckerDumper: format(tName, 128, "Dumper");
  457. case PCV_TruckerPacker: format(tName, 128, "Packer");
  458. case PCV_TruckerSecuricar: format(tName, 128, "Securicar");
  459. }
  460.  
  461. // Construct the messages that describe the mission
  462. format(Msg1, 128, "{00FF00}[BONUSMISSION]{FFFFFF}Transport {00FF00}%s", lName);
  463. format(Msg2, 128, " {FFFFFF}From {00FF00}%s{FFFFFF} To {00FF00}%s", sName, eName);
  464. format(Msg3, 128, " {FFFFFF}You'll Need A {00FF00}%s{FFFFFF} To Complete This Mission", tName);
  465.  
  466. // Now send the data about the random mission to all truckers
  467. for (new playerid; playerid < MAX_PLAYERS; playerid++)
  468. {
  469. // Check if this player is online
  470. if (APlayerData[playerid][LoggedIn] == true)
  471. {
  472. // Check if this player is a trucker
  473. if (APlayerData[playerid][PlayerClass] == ClassTruckDriver)
  474. {
  475. SendClientMessage(playerid, 0xFFFFFFFF, Msg1);
  476. SendClientMessage(playerid, 0xFFFFFFFF, Msg2);
  477. SendClientMessage(playerid, 0xFFFFFFFF, Msg3);
  478. }
  479. }
  480. }
  481.  
  482. return 1;
  483. }
  484.  
  485.  
  486.  
  487. // This function displays the main bank menu dialog
  488. ShowBankMenu(playerid)
  489. {
  490. // Setup local variables
  491. new BankOptions[256], BankTitle[128];
  492.  
  493. // Construct the title of the bank dialog
  494. format(BankTitle, sizeof(BankTitle), "{FFFFFF}Your bank funds: {00FF00}$%i", APlayerData[playerid][BankMoney]);
  495.  
  496. // Construct the options of the bank dialog
  497. format(BankOptions, sizeof(BankOptions), "{00FF00}Deposit money\n");
  498. format(BankOptions, sizeof(BankOptions), "%s{00FF00}Withdraw money\n", BankOptions);
  499. format(BankOptions, sizeof(BankOptions), "%s{00FF00}Transfer money\n", BankOptions);
  500. format(BankOptions, sizeof(BankOptions), "%s{00FF00}Cancel bank account\n", BankOptions);
  501.  
  502. // Show the bank dialog
  503. ShowPlayerDialog(playerid, DialogBankOptions, DIALOG_STYLE_LIST, BankTitle, BankOptions, TXT_DialogButtonSelect, TXT_DialogButtonCancel);
  504. }
  505.  
  506. // This timer increases the variable "CurrentIntrestTime" every hour
  507. forward Bank_IntrestTimer();
  508. public Bank_IntrestTimer()
  509. {
  510. // Setup local variables
  511. new IntrestAmount, Msg[128];
  512.  
  513. // Increase the variable by one
  514. CurrentIntrestTime++;
  515.  
  516. // And save it to the file
  517. IntrestTime_Save();
  518.  
  519. // Process intrest for all online player with a bank account if intrest is enabled
  520. if (IntrestEnabled == true)
  521. {
  522. // Loop through all players
  523. for (new playerid; playerid < MAX_PLAYERS; playerid++)
  524. {
  525. // Check if this player is logged in
  526. if (APlayerData[playerid][LoggedIn] == true)
  527. {
  528. // Check if this player has a bank account (just check if there is money in the bank, it's useless to process the intrest for
  529. // a bank account which doesn't have any money in it, and having BankMoney also means the player has a bank account)
  530. if (APlayerData[playerid][BankMoney] > 0)
  531. {
  532. // Calculate the intrest
  533. IntrestAmount = floatround(floatmul(APlayerData[playerid][BankMoney], BankIntrest), floatround_floor);
  534. // Add intrest to this player's bank account
  535. APlayerData[playerid][BankMoney] = APlayerData[playerid][BankMoney] + IntrestAmount;
  536. // Save the CurrentIntrestTime for this bank account
  537. APlayerData[playerid][LastIntrestTime] = CurrentIntrestTime;
  538. // Save the player's bank account
  539. BankFile_Save(playerid);
  540.  
  541. // Inform the player that he received intrest on his bank account and how much
  542. format(Msg, 128, "{00BBFF}You've received {FFBB00}$%i{00BBFF} intrest on your bank account", IntrestAmount);
  543. SendClientMessage(playerid, 0xFFFFFFFF, Msg);
  544. }
  545. }
  546. }
  547. }
  548. }
  549.  
  550.  
  551.  
  552. // This function creates a list of help-items, for which the player can get information about it
  553. HelpList_Create(playerid)
  554. {
  555. // Setup local variables
  556. new HelpList[1000], DialogTitle[128];
  557.  
  558. // Construct the title for the dialog (to include a page number)
  559. format(DialogTitle, 128, "Here you can get help about any of these items:");
  560.  
  561. // Add all help-topics to the list
  562. for (new i; i < sizeof(AHelpTopics); i++)
  563. {
  564. format(HelpList, 1000, "%s%s\n", HelpList, AHelpTopics[i]);
  565. }
  566.  
  567. // Show the commands in a dialog
  568. ShowPlayerDialog(playerid, DialogHelpItemChosen, DIALOG_STYLE_LIST, DialogTitle, HelpList, TXT_DialogButtonSelect, TXT_DialogButtonCancel);
  569.  
  570. return 1;
  571. }
Advertisement
Add Comment
Please, Sign In to add comment