Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @@ -260,6 +260,10 @@
- static cell_t ExtinguishEntity(IPluginContext *pContext, const cell_t *params)
- {
- - static ValveCall *pCall = NULL;
- - if (!pCall)
- +#if SOURCE_ENGINE == SE_ORANGEBOXVALVE
- + /*
- + * For some reason, extinguish (removing the FL_ONFIRE effect) does not work on CS:S.
- + * See bug 3390.
- + */
- + if (strcmp(g_pSM->GetGameFolderName(), "cstrike") == 0)
- {
- @@ -265,3 +269,5 @@
- {
- - if (!CreateBaseCall("Extinguish", ValveCall_Entity, NULL, NULL, 0, &pCall))
- + CBaseEntity *pEntity = NULL;
- + int index = gamehelpers->ReferenceToIndex(params[1]);
- + if ((unsigned)index == INVALID_EHANDLE_INDEX && params[1] != -1)
- {
- @@ -267,5 +273,3 @@
- {
- - return pContext->ThrowNativeError("\"Extinguish\" not supported by this mod");
- - } else if (!pCall) {
- - return pContext->ThrowNativeError("\"Extinguish\" wrapper failed to initialize");
- + return pContext->ThrowNativeError("Entity %d is not valid", params[1]);
- }
- @@ -271,2 +275,65 @@
- }
- +
- + if (index >= 1 && index <= playerhelpers->GetMaxClients())
- + {
- + IGamePlayer *player = playerhelpers->GetGamePlayer(index);
- + if (!player->IsInGame())
- + {
- + return pContext->ThrowNativeError("Client %d is not in game", params[1]);
- + }
- + }
- +
- + pEntity = gamehelpers->ReferenceToEntity(params[1]);
- +
- + sm_sendprop_info_t info;
- + IServerNetworkable *pNet = ((IServerUnknown *)pEntity)->GetNetworkable();
- + if (!pNet)
- + {
- + return pContext->ThrowNativeError("Edict %d (%d) is not networkable", gamehelpers->ReferenceToIndex(params[1]), params[1]);
- + }
- + if (!gamehelpers->FindSendPropInfo(pNet->GetServerClass()->GetName(), "m_hEffectEntity", &info))
- + {
- + return pContext->ThrowNativeError("Property \"m_hEffectEntity\" not found (entity %d)", params[1]);
- + }
- +
- + CBaseHandle &hEffectEntity = *(CBaseHandle *)((uint8_t *)pEntity + info.actual_offset);
- +
- + edict_t *pEffectEdict = gamehelpers->GetHandleEntity(hEffectEntity);
- + if (pEffectEdict)
- + {
- + if (strcmp(pEffectEdict->GetNetworkable()->GetServerClass()->GetName(), "CEntityFlame") == 0)
- + {
- + datamap_t *pMap;
- + typedescription_t *td;
- + if ((pMap = gamehelpers->GetDataMap(pEntity)) == NULL)
- + {
- + return pContext->ThrowNativeError("Could not retrieve datamap");
- + }
- + if ((td = gamehelpers->FindInDataMap(pMap, "m_flLifetime")) == NULL)
- + {
- + return pContext->ThrowNativeError("Property \"m_flLifetime\" not found (entity %d)", params[1]);
- + }
- +
- + *(float *)((uint8_t *)pEntity + GetTypeDescOffs(td)) = 0.0f;
- + }
- + }
- + } // if "cstrike"
- + else
- + {
- +#endif // if SOURCE_ENGINE == SE_EPISODE2VALVE
- + static ValveCall *pCall = NULL;
- + if (!pCall)
- + {
- + if (!CreateBaseCall("Extinguish", ValveCall_Entity, NULL, NULL, 0, &pCall))
- + {
- + return pContext->ThrowNativeError("\"Extinguish\" not supported by this mod");
- + } else if (!pCall) {
- + return pContext->ThrowNativeError("\"Extinguish\" wrapper failed to initialize");
- + }
- + }
- +
- + START_CALL();
- + DECODE_VALVE_PARAM(1, thisinfo, 0);
- + FINISH_CALL_SIMPLE(NULL);
- +#if SOURCE_ENGINE == SE_ORANGEBOXVALVE
- }
- @@ -272,8 +339,5 @@
- }
- -
- - START_CALL();
- - DECODE_VALVE_PARAM(1, thisinfo, 0);
- - FINISH_CALL_SIMPLE(NULL);
- +#endif
- return 1;
- }
Add Comment
Please, Sign In to add comment