Pass return value to WeaponSwitchPost, WeaponCanUsePost, WeaponCanSwitchToPost

Aperta
#2,532 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
Mezza giornata
Idoneità per principianti
60/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
cpp
Ambito
api

Direzione di ricerca

Start from plugins/include/sdkhooks.inc, where the SDKHook_WeaponSwitchPost/WeaponCanUsePost/WeaponCanSwitchToPost callback typedefs are declared, and from the SDKHooks extension sources under extensions/sdkhooks/ where those forwards are created and invoked. Use SDKHook_ReloadPost as the working template: trace exactly how bSuccess is captured from the engine hook and pushed into the forward, then do the same for the three missing hooks. Check with the maintainer whether the pending khook migration branch should land first, since the hooks may be rewritten. Done means all three Post callbacks accept the extra bool parameter, the include file and any callback documentation match, and a small test plugin compiles against the new signatures.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Feature Request

SDKHook_ReloadPost already passes the engine function's return value into the callback:
void OnReloadPost(int weapon, bool bSuccess)

The following hooks also return meaningful bool values, but their Post callbacks do not expose them:
SDKHook_WeaponSwitchPost
SDKHook_WeaponCanUsePost
SDKHook_WeaponCanSwitchToPost

Plugins need the real outcome e.g., whether a weapon switch actually succeeded. Adding the return value as an extra callback parameter, consistent with ReloadPost, would cover this cleanly.

@Kenzzer this might be a quick addition during the khook migration, or I'm happy to submit a PR once that branch lands.

Lingua principale
C++
Stelle
1.2k
Fork
476
Merge medio
2g 9h
PR unite (30g)
13

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di alliedmodders/sourcemod

Tutte le issue di alliedmodders/sourcemod

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.