Skip to content

Game Events

This only works for internal plugins. This allows you to react with ingame CS:GO events. In these examples, the class instance is called sdk_event_information. This is declared like so:

auto sdk_event_information = std::make_unique< fantasy_sdk::GameEvents>( );

Listen

Arguments

  • const char * - Event name.
  • SDK_GAME_EVENT

Example

auto on_player_death(void * ev) -> void
{
    auto dead_player = GetPlayerFromEvent(sdk_information, sdk_event_information, ev); /// userid
    auto attacking_player = GetPlayerFromEventEx(sdk_information, sdk_event_information, ev, "attacker");
    auto local_player = sdk_information->GetActivePlayerInformation();
    auto is_headshot_kill = sdk_event_information->GetBool(ev, "headshot");
}

sdk_event_information->Listen("player_death", on_player_death);

GetBool

Arguments

  • void *
  • const char *

Returns

  • boolean

GetInteger


GetLong


GetString


GetFloat


GetPlayerFromID

Arguments

  • int

Returns

  • int

GetPlayerFromEvent (Macro)

#ifndef GetPlayerFromEvent
    #define GetPlayerFromEvent( a, b, c ) a->GetPlayerInformation( a->GetPlayerIDByIndex( b->GetPlayerFromID( b->GetInteger(c, "userid") ) ) )
#endif

GetPlayerFromEventEx (Macro)

#ifndef GetPlayerFromEventEx
    #define GetPlayerFromEventEx( a, b, c, d ) a->GetPlayerInformation( a->GetPlayerIDByIndex( b->GetPlayerFromID( b->GetInteger(c, d) ) ) )
#endif