Advertisement
Biesmen

OPMC 2.0

May 9th, 2011
1,161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. //============================================================//
  2. //* OnPlayerMoneyChange - OPMC
  3. //* Version: 2.0
  4. //============================================================//
  5. //* Created by:
  6. //* Biesmen
  7. //============================================================//
  8. //* Using the ALS Hooking.
  9. //============================================================//
  10.  
  11. #include <a_samp>
  12.  
  13. #undef MAX_PLAYERS
  14. #define MAX_PLAYERS 500 // Change 500 to your server's playerslots.
  15.  
  16. new OPMCMoney[MAX_PLAYERS];
  17. static
  18. bool:PlayerUP,
  19. bool:PlayerSP;
  20.  
  21. forward OnPlayerMoneyChange(playerid, amount, totalamount);
  22.  
  23. public OnPlayerSpawn(playerid)
  24. {
  25. OPMCMoney[playerid] = GetPlayerMoney(playerid);
  26. return (PlayerSP)?CallLocalFunction("Inc_OnPlayerSpawn","i", playerid):1;
  27. }
  28. #if defined _ALS_OnPlayerSpawn
  29. #undef OnPlayerSpawn
  30. #else
  31. #define _ALS_OnPlayerSpawn
  32. #endif
  33. #define OnPlayerSpawn Inc_OnPlayerSpawn
  34. forward Inc_OnPlayerSpawn(playerid);
  35.  
  36. public OnPlayerUpdate(playerid)
  37. {
  38. new PlayerMoney = GetPlayerMoney(playerid);
  39. if(PlayerMoney != OPMCMoney[playerid])
  40. {
  41. CallLocalFunction("OnPlayerMoneyChange", "iii", playerid, (PlayerMoney - OPMCMoney[playerid]), PlayerMoney);
  42. OPMCMoney[playerid] = PlayerMoney;
  43. }
  44. return (PlayerUP)?CallLocalFunction("Inc_OnPlayerUpdate","i", playerid):1;
  45. }
  46. #if defined _ALS_OnPlayerUpdate
  47. #undef OnPlayerUpdate
  48. #else
  49. #define _ALS_OnPlayerUpdate
  50. #endif
  51. #define OnPlayerUpdate Inc_OnPlayerUpdate
  52. forward Inc_OnPlayerUpdate(playerid);
  53.  
  54. public OnGameModeInit()
  55. {
  56. PlayerUP = (funcidx("Inc_OnPlayerUpdate") != -1);
  57. PlayerSP = (funcidx("Inc_OnPlayerSpawn") != -1);
  58. return (funcidx("Inc_OnGameModeInit") != -1)?CallLocalFunction("Inc_OnGameModeInit",""):1;
  59. }
  60. #if defined _ALS_OnGameModeInit
  61. #undef OnGameModeInit
  62. #else
  63. #define _ALS_OnGameModeInit
  64. #endif
  65. #define OnGameModeInit Inc_OnGameModeInit
  66. forward Inc_OnGameModeInit();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement