MCPcopy Create free account
hub / github.com/assaultcube/AC / exechook

Function exechook

source/src/command.cpp:673–691  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

671
672#ifndef STANDALONE
673bool exechook(int context, const char *ident, const char *body,...) // execute cubescript hook if available and allowed in current context/gamemode
674{ // always use one of HOOK_SP_MP, HOOK_SP or HOOK_MP and then OR them (as needed) with HOOK_TEAM, HOOK_NOTEAM, HOOK_BOTMODE, HOOK_FLAGMODE, HOOK_ARENA
675 if(multiplayer(NULL) && (context & HOOK_FLAGMASK) != HOOK_MP && (context & HOOK_FLAGMASK) != HOOK_SP_MP) return false; // hook is singleplayer-only
676 if(((context & HOOK_TEAM) && !m_teammode) ||
677 ((context & HOOK_NOTEAM) && m_teammode) ||
678 ((context & HOOK_BOTMODE) && !m_botmode) ||
679 ((context & HOOK_FLAGMODE) && m_flags_) ||
680 ((context & HOOK_ARENA) && m_arena)) return false; // wrong gamemode
681 if(identexists(ident))
682 {
683 defvformatstring(arglist, body, body);
684 defformatstring(execbody)("%s%c%s", ident, *arglist ? ' ' : '\0', arglist);
685 setcontext("hook", execbody);
686 execute(execbody);
687 resetcontext();
688 return true;
689 }
690 return false;
691}
692
693void identhash(uint64_t *d)
694{

Callers 15

newmapFunction · 0.85
onCallVoteFunction · 0.85
onChangeVoteFunction · 0.85
parsemessagesFunction · 0.85
disconnectFunction · 0.85
gets2cFunction · 0.85
selectweaponFunction · 0.85
attackeventFunction · 0.85
reloadMethod · 0.85
pickupeffectsFunction · 0.85
newnameFunction · 0.85
findplayerstartFunction · 0.85

Calls 5

multiplayerFunction · 0.85
identexistsFunction · 0.85
setcontextFunction · 0.85
executeFunction · 0.85
resetcontextFunction · 0.85

Tested by

no test coverage detected