Problem mit FLHook Plugin 1.6.0
-
Sorry my English is to bad…
Mahlzeit,
Ich hab da nen kleines Problem, und zwar wenn ich nen FL Server mit dem flhook plugin 1.6.0 starte und dann Ingame autobuy all on schalte wird man gekickt sobald man gedockt wird und Munition nach kaufen muss, bei allen anderen hook Versionen passiert das nich, getestet hab ich das mit 1.5.5, 1.5.8, 1.5.9 und sogar mit der letzten LC hook Variante
Ich hab darauf hin mal die src codes der verschiedenen Hook Versionen mit einander verglichen, Speziell die Hkfuncplayers.ccp in der Hoffnung dem Problem so auf die spur zu kommen.
Aber alles was ich dabei herausfand war das alle Vorgänger Versionen von hook mit einem festen munitions wer von 50 arbetiten#define ADD_EQUIP_TO_CART(desc) { aci.iArchID = eq->iAmmoArchID;
aci.iCount = 50 - HkPlayerAutoBuyGetCount(lstCargo, aci.iArchID);
aci.wscDescription = desc;
lstCart.push_back(aci); }und die 1.6.0 anscheinend davon ausgeht das es Player relevant ist wie viel ammo nach gekauft wird
#define ADD_EQUIP_TO_CART(desc) { aci.iArchID = eq->iAmmoArchID;
aci.iCount = MAX_PLAYER_AMMO - HkPlayerAutoBuyGetCount(lstCargo, aci.iArchID);
aci.wscDescription = desc;
lstCart.push_back(aci); }ich hab mit den beiden werten ein wenig rum experimentiert aber da ich nich wirklich der c++ Guru bin (noob) konnte ich das Problem mit den kicks nich beheben
kann jemand helfen? hat einer nen tipp?
Grüsse,
Andi
-
ok bin mitlerweile von alleine… ähm ok fast alleine drauf gekommen^^
das hier,
Autobuy in version 1.6.0
« on: November 19, 2008, 03:01:48 pm »
Reply with quoteQuote
Has any else had problems using the autobuy command with flhook plugin 1.6.0 - I think it is broken?During the base docking process, items are automatically bought and added to the player’s ship but the player gets kicked when this happens. The “flserver-errors.log” file contains an entry like:
1: E:\FL\Scratch\Source\Server\gf\BaseDB.cpp(1645) : *** ERROR: Location 0 is invalid
Looking at the code, BaseEnter() calls HkPlayerAutoBuy() which calls HkAddCargo(). HkAddCargo() uses a base/location exit/enter trick to deal with the flserver cheat detection but the location isn’t valid when the BaseEnter function is called.
I tried the following modification in HkAddCargo() and it seemed to fix the problem…I’m not sure it does but it works for a few simple test cases I tried.
if(iBase) { if(iLocation) // ADDED THIS CHECK Server.LocationExit(iLocation,iClientID); Server.BaseExit(iBase,iClientID); if(!HkIsValidClientID(iClientID)) // got cheat kicked return HKE_PLAYER_NOT_LOGGED_IN; } and if(iBase) { Server.BaseEnter(iBase, iClientID); if(iLocation) // ADDED THIS CHECK Server.LocationEnter(iLocation, iClientID); ```}
und die übernahme des volgenden Codes aus der 1.5.9 konnte das Problem beheben
HK_ERROR HkAddCargo(wstring wscCharname, uint iGoodID, int iCount, bool bMission) { HK_GET_CLIENTID(iClientID, wscCharname); if(iClientID == -1 || HkIsInCharSelectMenu(iClientID)) return HKE_PLAYER_NOT_LOGGED_IN; // anti-cheat related char *szClassPtr; memcpy(&szClassPtr, &Players, 4); szClassPtr += 0x418 * (iClientID - 1); EquipDescList *edlList = (EquipDescList*)szClassPtr + 0x328; bool bCargoFound = true; if(!edlList->find_matching_cargo(iGoodID, 0, 1)) bCargoFound = false; // add const GoodInfo *gi; if(!(gi = GoodList::find_by_id(iGoodID))) return HKE_INVALID_GOOD; bool bMultiCount; memcpy(&bMultiCount, (char*)gi + 0x70, 1); if(bMultiCount) { // it's a good that can have multiple units(commodities, missile ammo, etc) int iRet; // we need to do this, else server or client may crash list <cargo_info>lstCargo; HkEnumCargo(wscCharname, lstCargo, iRet); foreach(lstCargo, CARGO_INFO, it) { if(((*it).iArchID == iGoodID) && ((*it).bMission != bMission)) { HkRemoveCargo(wscCharname, (*it).iID, (*it).iCount); iCount += (*it).iCount; } } pub::Player::AddCargo(iClientID, iGoodID, iCount, 1, bMission); } else { for(int i = 0; (i < iCount); i++) pub::Player::AddCargo(iClientID, iGoodID, 1, 1, bMission); } uint iBase = 0; pub::Player::GetBase(iClientID, iBase); if(iBase) { // player docked on base /////////////////////////////////////////////////// // fix, else we get anti-cheat msg when undocking // this DOES NOT disable anti-cheat-detection, we're // just making some adjustments so that we dont get kicked // fix "Ship or Equipment not sold on base" kick if(!bCargoFound) { // get last equipid char *szLastEquipID = szClassPtr + 0x3C8; ushort sEquipID; memcpy(&sEquipID, szLastEquipID, 2); // add to check-list which is being compared to the users equip-list when saving char EquipDesc ed; memset(&ed, 0, sizeof(ed)); ed.id = sEquipID; ed.count = iCount; ed.archid = iGoodID; edlList->add_equipment_item(ed, true); } // fix "Ship Related" kick, update crc ulong lCRC; __asm { mov ecx, [szClassPtr] call [CRCAntiCheat] mov [lCRC], eax } memcpy(szClassPtr + 0x320, &lCRC, 4); }</cargo_info>
grüsse,
Andi