Givecash Plugin v0.5
Locked
Plugins
-
Update to the givecash plugin. In this version:
- Added /drawcash, /setcashcode, and /showcash commands to allow simple “banking” facilities.
- Added anonymous /givecash transfers
- Cheating detection while docked to prevent cash hacks being used to transfer cash to clean players.
- Prohibit transfers to/from chars in a prison system.
It’s up on the forge. Link: http://forge.the-starport.net/gf/project/flhook/frs/?action=FrsReleaseView&release_id=105
-
I looked over your anticheat check code and noticed you do some tricks to check for cheats
Here is a simple function that calls flservers anticheat functions on a given char, if I may suggest:
HK_ERROR HkAntiCheat(wstring wscCharname) { HK_GET_CLIENTID(iClientID, wscCharname); // check if logged in if(iClientID == -1) return HKE_PLAYER_NOT_LOGGED_IN; // check if ship in space uint iShip = 0; pub::Player::GetShip(iClientID, iShip); if(iShip) return HKE_PLAYER_IN_SPACE; char *szObjPtr; memcpy(&szObjPtr, &Players, 4); szObjPtr += 0x418 * (iClientID - 1); char cRes; ////////////////////////// 1 __asm { mov ecx, [szObjPtr] call [FLAntiCheat1] mov [cRes], al } if(cRes != 0) { // kick __asm { push 3 mov ecx, [szObjPtr] call [FLPossibleCheatingDetected] } HkKick(ARG_CLIENTID(iClientID)); return HKE_POSSIBLE_CHEATING_DETECTED; } ////////////////////////// 2 __asm { mov ecx, [szObjPtr] call [FLAntiCheat2] mov [cRes], al } if(cRes != 0) { // kick __asm { push 2 mov ecx, [szObjPtr] call [FLPossibleCheatingDetected] } HkKick(ARG_CLIENTID(iClientID)); return HKE_POSSIBLE_CHEATING_DETECTED; } ////////////////////////// 3 ulong lRet; ulong lCompare; __asm { mov ecx, [szObjPtr] mov eax, [ecx+0x320] mov [lCompare], eax call [FLAntiCheat3] mov [lRet], eax } if(lRet > lCompare) { // kick __asm { push 1 mov ecx, [szObjPtr] call [FLPossibleCheatingDetected] } HkKick(ARG_CLIENTID(iClientID)); return HKE_POSSIBLE_CHEATING_DETECTED; } ////////////////////////// 4 __asm { mov ecx, [szObjPtr] call [FLAntiCheat4] mov [cRes], al } if(cRes != 0) { // kick __asm { push 4 mov ecx, [szObjPtr] call [FLPossibleCheatingDetected] } HkKick(ARG_CLIENTID(iClientID)); return HKE_POSSIBLE_CHEATING_DETECTED; } return HKE_OK; }
with
typedef void (__stdcall *_FLAntiCheat)(); typedef void (__stdcall *_FLPossibleCheatingDetected)(int iReason); #define ADDR_FL_ANTICHEAT_1 0x70120 #define ADDR_FL_ANTICHEAT_2 0x6FD20 #define ADDR_FL_ANTICHEAT_3 0x6FAF0 #define ADDR_FL_ANTICHEAT_4 0x6FAA0 #define ADDR_FL_POSSIBLE_CHEATING_DETECTED 0x6F570 _FLAntiCheat FLAntiCheat1; _FLAntiCheat FLAntiCheat2; _FLAntiCheat FLAntiCheat3; _FLAntiCheat FLAntiCheat4; _FLPossibleCheatingDetected FLPossibleCheatingDetected;
and
FLAntiCheat1 = (_FLAntiCheat) ((char*)hModServer + ADDR_FL_ANTICHEAT_1); FLAntiCheat2 = (_FLAntiCheat) ((char*)hModServer + ADDR_FL_ANTICHEAT_2); FLAntiCheat3 = (_FLAntiCheat) ((char*)hModServer + ADDR_FL_ANTICHEAT_3); FLAntiCheat4 = (_FLAntiCheat) ((char*)hModServer + ADDR_FL_ANTICHEAT_4); FLPossibleCheatingDetected = (_FLPossibleCheatingDetected) ((char*)hModServer + ADDR_FL_POSSIBLE_CHEATING_DETECTED);
Code written by mc_horst
So, it could be like
if(HkAnticheat(char) == HKE_OK) {
// do transfer
} -
Yeah, that’s the part of the trick I’m using but to make it work I need to call save char before the transfer actually happens. As a result HkSaveChar is called more often than necessary. mc_horst’s solution is much more elegant, simplifies the code and reduces server load.