Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Half-Life C++ - Server side Christmas detection (cross-platform)
- // All the code is on the "enginecallback.h" file
- // Add the "#include <ctime>" line above or below it's friend (#include "event_flags.h")
- // Add the "IsChristmas" function at the end just before the "#endif"
- #include <ctime>
- inline bool IsChristmas()
- {
- // Get the time now
- time_t tTime = time( 0 );
- struct tm *stTimeNow = localtime( &tTime );
- // [DEBUG] Tell the date
- //ALERT( at_console, "%i-%i-%i\n", (stTimeNow->tm_year + 1900), (stTimeNow->tm_mon + 1), stTimeNow->tm_mday );
- // It's Christmas ?
- if ( ((stTimeNow->tm_mon + 1) == 12) && (stTimeNow->tm_mday == 25) )
- return true;
- else
- return false;
- }
- // Usage example : Use a special christmas MDL (model) for Barney
- // barney.cpp - Precache
- PRECACHE_MODEL( IsChristmas() ? "models/barney_christmas.mdl" : "models/barney.mdl" );
- // barney.cpp - Spawn
- SET_MODEL( ENT( pev ), IsChristmas() ? "models/barney_christmas.mdl" : "models/barney.mdl" );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement