Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #if defined __DineroProtc__
- #endinput
- #endif
- #define __DineroProtc__
- #if defined FILTERSCRIPT
- #define FUNC::%1(%2) stock %1(%2)
- #else
- #define FUNC::%1(%2) forward %1(%2); public %1(%2)
- #endif
- #if !defined FILTERSCRIPT
- #if !defined foreach
- #tryinclude <foreach>
- #endif
- #if !defined foreach
- #define foreach(%1,%2) for(new %2; %2 < MAX_PLAYERS; %2++) if(IsPlayerConnected(%2))
- #define _N_FOREACH
- #endif
- #if !defined TIEMPO_DETECCION_CHEAT
- #define TIEMPO_DETECCION_CHEAT 500
- #endif
- forward ProtecDineroTimer();
- new
- __N_Dinero[MAX_PLAYERS];
- static
- bool:J_TIENE_OPC,
- bool:J_TIENE_OMCD;
- public ProtecDineroTimer()
- {
- foreach(Player, playerid)
- {
- if(GetPlayerMoney(playerid) > __N_Dinero[playerid])
- {
- if(J_TIENE_OMCD)
- CallLocalFunction("OnDineroCheatDetectado", "dd", playerid, GetPlayerMoney(playerid)-__N_Dinero[playerid]);
- GivePlayerMoney(playerid, __N_Dinero[playerid]-GetPlayerMoney(playerid));
- }
- else
- {
- __N_Dinero[playerid] = GetPlayerMoney(playerid);
- }
- }
- }
- public OnGameModeInit()
- {
- SetTimer("ProtecDineroTimer", TIEMPO_DETECCION_CHEAT, true);
- if(funcidx("__N_OnGameModeInit") != -1)
- CallLocalFunction("__N_OnGameModeInit", "");
- J_TIENE_OPC = (funcidx("__N_OnPlayerConnect") != -1);
- J_TIENE_OMCD = (funcidx("OnDineroCheatDetectado") != -1);
- }
- public OnPlayerConnect(playerid)
- {
- N_ResetPlayerMoney(playerid);
- if(J_TIENE_OPC)
- CallLocalFunction("__N_OnPlayerConnect", "d", playerid);
- }
- #endif
- FUNC::N_GivePlayerMoney(playerid, amount)
- {
- #if defined FILTERSCRIPT
- return CallRemoteFunction("N_GivePlayerMoney", "dd", playerid, amount);
- #else
- __N_Dinero[playerid] += amount;
- return GivePlayerMoney(playerid, amount);
- #endif
- }
- FUNC::N_ResetPlayerMoney(playerid)
- {
- #if defined FILTERSCRIPT
- return CallRemoteFunction("N_ResetPlayerMoney", "d", playerid);
- #else
- __N_Dinero[playerid] = 0;
- return ResetPlayerMoney(playerid);
- #endif
- }
- FUNC::N_GetPlayerMoney(playerid)
- {
- #if defined FILTERSCRIPT
- return CallRemoteFunction("N_GetPlayerMoney", "d", playerid);
- #else
- return __N_Dinero[playerid];
- #endif
- }
- #define GivePlayerMoney N_GivePlayerMoney
- #define ResetPlayerMoney N_ResetPlayerMoney
- #define GetPlayerMoney N_GetPlayerMoney
- #if defined FILTERSCRIPT
- #endinput
- #endif
- #if defined _ALS_OnGameModeInit
- #undef OnGameModeInit
- #else
- #define _ALS_OnGameModeInit
- #endif
- #if defined _ALS_OnPlayerConnect
- #undef OnPlayerConnect
- #else
- #define _ALS_OnPlayerConnect
- #endif
- #define OnGameModeInit __N_OnGameModeInit
- #define OnPlayerConnect __N_OnPlayerConnect
- forward OnGameModeInit();
- forward OnPlayerConnect(playerid);
- forward OnDineroCheatDetectado(playerid, amount);
- #if defined _N_FOREACH
- #undef foreach
- #undef _N_FOREACH
- #endif
Advertisement
Add Comment
Please, Sign In to add comment