MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / SetPauseState

Method SetPauseState

core/logic/PluginSys.cpp:583–626  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

581}
582
583bool CPlugin::SetPauseState(bool paused)
584{
585 if (paused && GetStatus() != Plugin_Running)
586 {
587 return false;
588 }
589 else if (!paused && GetStatus() != Plugin_Paused && GetStatus() != Plugin_Error) {
590 return false;
591 }
592
593 if (paused)
594 {
595 LibraryActions(LibraryAction_Removed);
596 }
597 else
598 {
599 // Set to running again BEFORE trying to call OnPluginPauseChange ;)
600 m_status = Plugin_Running;
601 m_pRuntime->SetPauseState(false);
602 }
603
604 IPluginFunction *pFunction = m_pRuntime->GetFunctionByName("OnPluginPauseChange");
605 if (pFunction)
606 {
607 cell_t result;
608 pFunction->PushCell(paused ? 1 : 0);
609 pFunction->Execute(&result);
610 }
611
612 if (paused)
613 {
614 m_status = Plugin_Paused;
615 m_pRuntime->SetPauseState(true);
616 }
617
618 g_PluginSys._SetPauseState(this, paused);
619
620 if (!paused)
621 {
622 LibraryActions(LibraryAction_Added);
623 }
624
625 return true;
626}
627
628IdentityToken_t *CPlugin::GetIdentity()
629{

Callers 2

EvictWithErrorMethod · 0.80

Calls 3

PushCellMethod · 0.80
_SetPauseStateMethod · 0.80
ExecuteMethod · 0.45

Tested by

no test coverage detected