Guest User

Untitled

a guest
Jan 1st, 2012
404
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.14 KB | None | 0 0
  1. #if defined __DineroProtc__
  2. #endinput
  3. #endif
  4.  
  5. #define __DineroProtc__
  6.  
  7. #if defined FILTERSCRIPT
  8. #define FUNC::%1(%2) stock %1(%2)
  9. #else
  10. #define FUNC::%1(%2) forward %1(%2); public %1(%2)
  11. #endif
  12.  
  13. #if !defined FILTERSCRIPT
  14.  
  15. #if !defined foreach
  16. #tryinclude <foreach>
  17. #endif
  18.  
  19. #if !defined foreach
  20. #define foreach(%1,%2) for(new %2; %2 < MAX_PLAYERS; %2++) if(IsPlayerConnected(%2))
  21. #define _N_FOREACH
  22. #endif
  23.  
  24. #if !defined TIEMPO_DETECCION_CHEAT
  25. #define TIEMPO_DETECCION_CHEAT 500
  26. #endif
  27.  
  28. forward ProtecDineroTimer();
  29.  
  30. new
  31. __N_Dinero[MAX_PLAYERS];
  32.  
  33. static
  34. bool:J_TIENE_OPC,
  35. bool:J_TIENE_OMCD;
  36.  
  37. public ProtecDineroTimer()
  38. {
  39. foreach(Player, playerid)
  40. {
  41. if(GetPlayerMoney(playerid) > __N_Dinero[playerid])
  42. {
  43. if(J_TIENE_OMCD)
  44. CallLocalFunction("OnDineroCheatDetectado", "dd", playerid, GetPlayerMoney(playerid)-__N_Dinero[playerid]);
  45. GivePlayerMoney(playerid, __N_Dinero[playerid]-GetPlayerMoney(playerid));
  46. }
  47. else
  48. {
  49. __N_Dinero[playerid] = GetPlayerMoney(playerid);
  50. }
  51. }
  52. }
  53.  
  54. public OnGameModeInit()
  55. {
  56. SetTimer("ProtecDineroTimer", TIEMPO_DETECCION_CHEAT, true);
  57. if(funcidx("__N_OnGameModeInit") != -1)
  58. CallLocalFunction("__N_OnGameModeInit", "");
  59. J_TIENE_OPC = (funcidx("__N_OnPlayerConnect") != -1);
  60. J_TIENE_OMCD = (funcidx("OnDineroCheatDetectado") != -1);
  61. }
  62.  
  63. public OnPlayerConnect(playerid)
  64. {
  65. N_ResetPlayerMoney(playerid);
  66. if(J_TIENE_OPC)
  67. CallLocalFunction("__N_OnPlayerConnect", "d", playerid);
  68. }
  69.  
  70. #endif
  71.  
  72. FUNC::N_GivePlayerMoney(playerid, amount)
  73. {
  74. #if defined FILTERSCRIPT
  75. return CallRemoteFunction("N_GivePlayerMoney", "dd", playerid, amount);
  76. #else
  77. __N_Dinero[playerid] += amount;
  78. return GivePlayerMoney(playerid, amount);
  79. #endif
  80. }
  81.  
  82. FUNC::N_ResetPlayerMoney(playerid)
  83. {
  84. #if defined FILTERSCRIPT
  85. return CallRemoteFunction("N_ResetPlayerMoney", "d", playerid);
  86. #else
  87. __N_Dinero[playerid] = 0;
  88. return ResetPlayerMoney(playerid);
  89. #endif
  90. }
  91.  
  92. FUNC::N_GetPlayerMoney(playerid)
  93. {
  94. #if defined FILTERSCRIPT
  95. return CallRemoteFunction("N_GetPlayerMoney", "d", playerid);
  96. #else
  97. return __N_Dinero[playerid];
  98. #endif
  99. }
  100.  
  101. #define GivePlayerMoney N_GivePlayerMoney
  102. #define ResetPlayerMoney N_ResetPlayerMoney
  103. #define GetPlayerMoney N_GetPlayerMoney
  104.  
  105. #if defined FILTERSCRIPT
  106. #endinput
  107. #endif
  108.  
  109. #if defined _ALS_OnGameModeInit
  110. #undef OnGameModeInit
  111. #else
  112. #define _ALS_OnGameModeInit
  113. #endif
  114.  
  115. #if defined _ALS_OnPlayerConnect
  116. #undef OnPlayerConnect
  117. #else
  118. #define _ALS_OnPlayerConnect
  119. #endif
  120.  
  121. #define OnGameModeInit __N_OnGameModeInit
  122. #define OnPlayerConnect __N_OnPlayerConnect
  123.  
  124. forward OnGameModeInit();
  125. forward OnPlayerConnect(playerid);
  126. forward OnDineroCheatDetectado(playerid, amount);
  127.  
  128. #if defined _N_FOREACH
  129. #undef foreach
  130. #undef _N_FOREACH
  131. #endif
Advertisement
Add Comment
Please, Sign In to add comment