// // ------------------------------------------------------------------------- // // TimeWaster's Happy Hour Script v0.2 // // ------------------------------------------------------------------------- // // From here, Happy Hour will be referenced as "HH" // To configure a full hour (60 minutes) of HH, please use 22:00 to 22:59 hours, due to the Minutes are inklusive. // This script is released under the GPL: http://www.opensource.org/licenses/gpl-license.php // // Installation: // 1. The plugin "Eventscripts" has to be installed on your server: http://www.mattie.info/cs/ (both versions are fine) // 2. Copy this script into the folder /addons/eventscripts/happyhour/ (you have to create the folder /happyhour/ !) // 3. Add the following 2 lines to THE END of your server.cfg (without the "//"!!!). DO NOT add them to your autoexec.cfg! // es_load happyhour // es_xdoblock happyhour/hh_time // 4. Wait for the next mapchange or Restart your server // That's it. (Unless you want to configure this script in the next block of code?) // // block hh_config { // ------------------------------------------------------------------------- // ONLY DO CHANGES BETWEEN HERE... // ------------------------------------------------------------------------- // es_xset hh_givePrimaryWeaponT "weapon_ak47" // this weapon will be given to Terrorist's if player has no primary weapon es_xset hh_givePrimaryWeaponCT "weapon_m4a1" // this weapon will be given to Counter-Terrorist's if player has no primary weapon es_xset hh_giveSecondaryWeapon "weapon_deagle" // this weapon will be given to player // es_xset hh_startHour 20 // hour the HH starts (in 24 hour time format!) es_xset hh_startMinute 0 // minute the HH starts (inclusive!) es_xset hh_startHour_humanReadable "8 PM" // HH start time as human readable format es_xset hh_endHour 20 // hour the HH ends (in 24 hour time format!) es_xset hh_endMinute 59 // minute the HH ends (inclusive, means if you choose 59, minute 59 will be the last minute the HH is on!) es_xset hh_endHour_humanReadable "9 PM" // HH end time as human readable format es_xset hh_timeFrameInfo 5 // every x minutes a message is displayed when the HH will start. // es_xset hh_renewHEGrenade false // a thrown HE granade will instantly be replaced with a new one (ON YOUR OWN RISK!) es_xset hh_renewFlashGrenade false // a thrown FlashBang will instantly be replaced with a new one (ON YOUR OWN RISK!) es_xset hh_renewSmokeGrenade false // a thrown Smoke granade will instantly be replaced with a new one (ON YOUR OWN RISK!) es_xset hh_bombForAll false // all Terrorist's get a bomb, not just one Terrorist (ON YOUR OWN RISK!) // // ------------------------------------------------------------------------- // ...AND HERE! // ------------------------------------------------------------------------- } block load { // set all variables es_xdoblock happyhour/hh_config es_xset hh_doHappyHour true es_xset hh_isHappyHour false es_xset hh_HappyHourWillEnd false es_xset hh_HappyHourWillStart false es_xset hh_preventMessage false // calc start and end time in minutes es_xset hh_startTime 0 es_math hh_startTime + server_var(hh_startHour) es_xmath hh_startTime * 60 es_math hh_startTime + server_var(hh_startMinute) es_xset hh_endTime 0 es_math hh_endTime + server_var(hh_endHour) es_xmath hh_endTime * 60 es_math hh_endTime + server_var(hh_endMinute) } block unload { // force do nothing es_xset hh_doHappyHour false es_xset hh_isHappyHour false } block hh_time { if (server_var(hh_doHappyHour) == true) do { // get current time es_xset hh_time 0 es_xset hh_timeHour 0 es_xset hh_timeMinute 0 eventscripts_timeformat "%H" es_gettimestring hh_timeHour eventscripts_timeformat "%M" es_gettimestring hh_timeMinute es_math hh_time + server_var(hh_timeHour) es_xmath hh_time * 60 es_math hh_time + server_var(hh_timeMinute) // check if it is happy hour es_xset hh_isHappyHour false if (server_var(hh_startTime) < server_var(hh_endTime)) do { if (server_var(hh_time) >= server_var(hh_startTime)) do { if (server_var(hh_time) <= server_var(hh_endTime)) then es_xset hh_isHappyHour true } } else do { if (server_var(hh_time) >= server_var(hh_startTime)) then es_xset hh_isHappyHour true if (server_var(hh_time) <= server_var(hh_endTime)) then es_xset hh_isHappyHour true } // display status messages if (server_var(hh_HappyHourWillEnd) == true) do { es_xmsg ---------------------------------------------------- es_xmsg The Happy Hour is over! es_xmsg For more information write !happy into the chat. es_xmsg ---------------------------------------------------- es_xset hh_HappyHourWillEnd false es_xset hh_preventMessage true } if (server_var(hh_HappyHourWillStart) == true) do { es_xmsg ---------------------------------------------------- es_xmsg Now it's Happy Hour! You'll get every round es_xmsg weapons and a complete set of equipment! es_xmsg For more information write !happy into the chat. es_xmsg ---------------------------------------------------- es_xset hh_HappyHourWillStart false es_xset hh_preventMessage true } if (server_var(hh_preventMessage) == false) do { if (server_var(hh_isHappyHour) == true) do { es_set hh_tempTime server_var(hh_endTime) es_xmath hh_tempTime - 5 if (server_var(hh_tempTime) < 0) then es_xmath hh_tempTime + 1440 if (server_var(hh_time) == server_var(hh_tempTime)) do { es_xmsg ---------------------------------------------------- es_xmsg The Happy Hour will end in 5 minutes! es_xmsg For more information write !happy into the chat. es_xmsg ---------------------------------------------------- } else do { es_xmath hh_tempTime + 4 if (server_var(hh_tempTime) > 1439) then es_xmath hh_tempTime - 1440 if (server_var(hh_time) == server_var(hh_tempTime)) do { es_xmsg ---------------------------------------------------- es_xmsg The Happy Hour will end in 1 minute! es_xmsg For more information write !happy into the chat. es_xmsg ---------------------------------------------------- es_xset hh_HappyHourWillEnd true } else do { es_set hh_tempTime2 server_var(hh_time) es_math hh_tempTime2 / server_var(hh_timeFrameInfo) es_set hh_tempTime3 server_var(hh_tempTime2) es_xmath hh_tempTime2 int if (server_var(hh_tempTime2) == server_var(hh_tempTime3)) do { es_xmsg ---------------------------------------------------- es_xmsg It's Happy Hour! es_xmsg For more information write !happy into the chat. es_xmsg ---------------------------------------------------- } } } } else do { es_set hh_tempTime server_var(hh_startTime) es_xmath hh_tempTime - 5 if (server_var(hh_tempTime) < 0) then es_xmath hh_tempTime + 1440 if (server_var(hh_time) == server_var(hh_tempTime)) do { es_xmsg ---------------------------------------------------- es_xmsg In 5 minutes it's Happy Hour! es_xmsg For more information write !happy into the chat. es_xmsg ---------------------------------------------------- } else do { es_xmath hh_tempTime + 4 if (server_var(hh_tempTime) > 1439) then es_xmath hh_tempTime - 1440 if (server_var(hh_time) == server_var(hh_tempTime)) do { es_xmsg ---------------------------------------------------- es_xmsg In 1 minute it's Happy Hour! es_xmsg For more information write !happy into the chat. es_xmsg ---------------------------------------------------- es_xset hh_HappyHourWillStart true } else do { es_set hh_tempTime2 server_var(hh_time) es_math hh_tempTime2 / server_var(hh_timeFrameInfo) es_set hh_tempTime3 server_var(hh_tempTime2) es_xmath hh_tempTime2 int if (server_var(hh_tempTime2) == server_var(hh_tempTime3)) do { es_xmsg ---------------------------------------------------- es_msg The next Happy Hour is at server_var(hh_startHour_humanReadable)! es_xmsg For more information write !happy into the chat. es_xmsg ---------------------------------------------------- } } } } } es_xset hh_preventMessage false // check again in 60 seconds es_delayed 60 es_xdoblock happyhour/hh_time } } event player_spawn { if (server_var(hh_doHappyHour) == true) do { if (server_var(hh_isHappyHour) == true) do { // get user team es_xset hh_userTeam false if (event_var(es_userteam) == 2) then es_xset hh_userTeam true if (event_var(es_userteam) == 3) then es_xset hh_userTeam true // if user is on team T or CT proceed if (server_var(hh_userTeam) == true) do { // get users status of primary weapon and c4 es_xset hh_userPrimary 0 es playerget primary hh_userPrimary event_var(userid) es_xset hh_userC4 0 es playerget c4 hh_userC4 event_var(userid) // remove all weapons from player es_fire event_var(userid) player_weaponstrip kill es_give event_var(userid) player_weaponstrip es_fire event_var(userid) player_weaponstrip strip // give all weapons to player es_delayed 0.1 es_give event_var(userid) weapon_knife es_delayed 0.1 es_give event_var(userid) server_var(hh_giveSecondaryWeapon) if (server_var(hh_userPrimary) == 0) do { if(event_var(es_userteam) == 2) then es_delayed 0.1 es_give event_var(userid) server_var(hh_givePrimaryWeaponT) if(event_var(es_userteam) == 3) then es_delayed 0.1 es_give event_var(userid) server_var(hh_givePrimaryWeaponCT) } else es_delayed 0.1 es_give event_var(userid) server_var(hh_userPrimary) es_delayed 0.1 es_give event_var(userid) weapon_hegrenade es_delayed 0.1 es_give event_var(userid) weapon_flashbang es_delayed 0.1 es_give event_var(userid) weapon_flashbang es_delayed 0.1 es_give event_var(userid) weapon_smokegrenade es_delayed 0.1 es playerset armor event_var(userid) 100 if(event_var(es_userteam) == 3) then es_delayed 0.1 es playerset defuser event_var(userid) 1 es_delayed 0.1 es playerset nightvision event_var(userid) 1 if(event_var(es_userteam) == 2) do { if(server_var(hh_bombForAll) == true) then es_delayed 0.5 es_give event_var(userid) weapon_c4 else do { if (server_var(hh_userC4) == 1) then es_delayed 0.5 es_give event_var(userid) weapon_c4 } } } } } } event smokegrenade_detonate { if (server_var(hh_doHappyHour) == true) do { if (server_var(hh_isHappyHour) == true) do { if (server_var(hh_renewSmokeGrenade) == true) do { es_delayed 0.1 es_give event_var(userid) weapon_smokegrenade } } } } event hegrenade_detonate { if (server_var(hh_doHappyHour) == true) do { if (server_var(hh_isHappyHour) == true) do { if (server_var(hh_renewHEGrenade) == true) do { es_delayed 0.1 es_give event_var(userid) weapon_hegrenade } } } } event flashbang_detonate { if (server_var(hh_doHappyHour) == true) do { if (server_var(hh_isHappyHour) == true) do { if (server_var(hh_renewFlashGrenade) == true) do { es_delayed 0.1 es_give event_var(userid) weapon_flashbang } } } } event player_say { // if user wants infos? if (event_var(text) == "!happy") do { // paste infos about happy hour es_tell event_var(userid) ----------------------------------------------------------------------- es_tell event_var(userid) Every day from server_var(hh_startHour_humanReadable) to server_var(hh_endHour_humanReadable) it's Happy Hour on this server. es_tell event_var(userid) This means you'll get every round 2 weapons and a complete set of es_tell event_var(userid) equipment for free! The weapons will be handed to you automatically es_tell event_var(userid) at spawn, you don't have to buy them. es_tell event_var(userid) ----------------------------------------------------------------------- } } event player_activate { // when user connects to server and happy hour is running if (server_var(hh_doHappyHour) == true) do { if (server_var(hh_isHappyHour) == true) do { // paste infos about happy hour es_tell event_var(userid) ----------------------------------------------- es_tell event_var(userid) Right now it's Happy Hour on this server! es_tell event_var(userid) You'll get every round weapons for free! es_tell event_var(userid) For more information write !happy into the chat. es_tell event_var(userid) ----------------------------------------------- } } }