Advertisement
Biesmen

OPMC 1.0

May 8th, 2011
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. //============================================================//
  2. //* OnPlayerMoneyChange - OPMC
  3. //* Version: 1.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);
  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 ZmoneyZ[MAX_PLAYERS];
  39. if(GetPlayerMoney(playerid) != OPMCMoney[playerid])
  40. {
  41. ZmoneyZ[playerid] = GetPlayerMoney(playerid)-OPMCMoney[playerid];
  42. CallLocalFunction("OnPlayerMoneyChange", "ii", playerid, ZmoneyZ[playerid]);
  43. OPMCMoney[playerid] = GetPlayerMoney(playerid);
  44. }
  45. return (PlayerUP)?CallLocalFunction("Inc_OnPlayerUpdate","i", playerid):1;
  46. }
  47. #if defined _ALS_OnPlayerUpdate
  48. #undef OnPlayerUpdate
  49. #else
  50. #define _ALS_OnPlayerUpdate
  51. #endif
  52. #define OnPlayerUpdate Inc_OnPlayerUpdate
  53. forward Inc_OnPlayerUpdate(playerid);
  54.  
  55. public OnGameModeInit()
  56. {
  57. PlayerUP = (funcidx("Inc_OnPlayerUpdate") != -1);
  58. PlayerSP = (funcidx("Inc_OnPlayerSpawn") != -1);
  59. return (funcidx("Inc_OnGameModeInit") != -1)?CallLocalFunction("Inc_OnGameModeInit",""):1;
  60. }
  61. #if defined _ALS_OnGameModeInit
  62. #undef OnGameModeInit
  63. #else
  64. #define _ALS_OnGameModeInit
  65. #endif
  66. #define OnGameModeInit Inc_OnGameModeInit
  67. forward Inc_OnGameModeInit();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement