Advertisement
Guest User

cksurf.sp

a guest
Dec 2nd, 2016
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 104.58 KB | None | 0 0
  1. /*=============================================
  2. = ckSurf - CS:GO surf Timer *
  3. * By Elzi =
  4. =============================================*/
  5.  
  6. /*=============================================
  7. = Includes =
  8. =============================================*/
  9.  
  10. #include <sourcemod>
  11. #include <sdkhooks>
  12. #include <adminmenu>
  13. #include <cstrike>
  14. #include <smlib>
  15. #include <geoip>
  16. #include <basecomm>
  17. #include <colors>
  18. #undef REQUIRE_EXTENSIONS
  19. #include <clientprefs>
  20. #undef REQUIRE_PLUGIN
  21. #include <dhooks>
  22. #include <mapchooser>
  23. #include <ckSurf>
  24.  
  25. /*====================================
  26. = Declarations =
  27. ====================================*/
  28.  
  29. /*============================================
  30. = Definitions =
  31. =============================================*/
  32.  
  33. // Require new syntax and semicolons
  34. #pragma newdecls required
  35. #pragma semicolon 1
  36.  
  37. // Plugin info
  38. #define VERSION "1.18"
  39. #define PLUGIN_VERSION 118
  40.  
  41. // Database definitions
  42. #define MYSQL 0
  43. #define SQLITE 1
  44. #define PERCENT 0x25
  45.  
  46. // Chat colors
  47. #define WHITE 0x01
  48. #define DARKRED 0x02
  49. #define PURPLE 0x03
  50. #define GREEN 0x04
  51. #define MOSSGREEN 0x05
  52. #define LIMEGREEN 0x06
  53. #define RED 0x07
  54. #define ORANGE 0x10
  55. #define GRAY 0x08
  56. #define YELLOW 0x09
  57. #define DARKGREY 0x0A
  58. #define BLUE 0x0B
  59. #define DARKBLUE 0x0C
  60. #define LIGHTBLUE 0x0D
  61. #define PINK 0x0E
  62. #define LIGHTRED 0x0F
  63.  
  64. // Trail definitions
  65. #define BEAMLIFE 2.0
  66. #define BONUS_BOT_TRAIL_COLOR {255, 255, 0, 255}
  67. #define RECORD_BOT_TRAIl_COLOR {0, 0, 255, 255}
  68. #define RGB_GREEN {0, 255, 0, 255}
  69. #define RGB_RED {255, 0, 0, 255}
  70. #define RGB_DARKRED {139, 0, 0, 255}
  71. #define RGB_BLUE {0, 0, 255, 255}
  72. #define RGB_LIGHTBLUE {178, 223, 238, 255}
  73. #define RGB_DARKBLUE {0, 0, 139, 255}
  74. #define RBG_YELLOW {255, 255, 0, 255}
  75. #define RGB_GREENYELLOW {173, 255, 47, 255}
  76. #define RGB_PURPLE {128, 0, 128, 255}
  77. #define RGB_MAGENTA {255, 0, 255, 255}
  78. #define RGB_PINK {238, 162, 173, 255}
  79. #define RGB_WHITE {248, 248, 255, 255}
  80. #define RGB_CYAN {0, 255, 255, 255}
  81. #define RGB_SPRINGGREEN {0, 255, 127, 255}
  82. #define RGB_OLIVE {192, 255, 62, 255}
  83. #define RGB_ORANGE {238, 154, 0, 255}
  84. #define RGB_GREY {145, 145, 145, 255}
  85. #define RGB_DARKGREY {69, 69, 69, 255}
  86.  
  87. // Paths
  88. #define CK_REPLAY_PATH "data/cKreplays/"
  89. #define BLOCKED_LIST_PATH "configs/ckSurf/hidden_chat_commands.txt"
  90. #define MULTI_SERVER_MAPCYCLE "configs/ckSurf/multi_server_mapcycle.txt"
  91. #define CUSTOM_TITLE_PATH "configs/ckSurf/custom_chat_titles.txt"
  92. #define SKILLGROUP_PATH "configs/ckSurf/skillgroups.cfg"
  93. #define PRO_FULL_SOUND_PATH "sound/quake/holyshit.mp3"
  94. #define PRO_RELATIVE_SOUND_PATH "*quake/holyshit.mp3"
  95. #define CP_FULL_SOUND_PATH "sound/quake/wickedsick.mp3"
  96. #define CP_RELATIVE_SOUND_PATH "*quake/wickedsick.mp3"
  97. #define UNSTOPPABLE_SOUND_PATH "sound/quake/unstoppable.mp3"
  98. #define UNSTOPPABLE_RELATIVE_SOUND_PATH "*quake/unstoppable.mp3"
  99.  
  100. // Checkpoint definitions
  101. #define CPLIMIT 35 // Maximum amount of checkpoints in a map
  102.  
  103. // Zone definitions
  104. #define ZONE_MODEL "models/props/de_train/barrel.mdl"
  105. #define ZONEAMOUNT 9 // The amount of different type of zones - Types: Start(1), End(2), Stage(3), Checkpoint(4), Speed(5), TeleToStart(6), Validator(7), Chekcer(8), Stop(0)
  106. #define MAXZONEGROUPS 11 // Maximum amount of zonegroups in a map
  107. #define MAXZONES 128 // Maximum amount of zones in a map
  108.  
  109. // Ranking definitions
  110. #define MAX_PR_PLAYERS 1066
  111. #define MAX_SKILLGROUPS 64
  112.  
  113. // UI definitions
  114. #define HIDE_RADAR (1 << 12)
  115. #define HIDE_CHAT ( 1<<7 )
  116.  
  117. // Replay definitions
  118. #define BM_MAGIC 0xBAADF00D
  119. #define BINARY_FORMAT_VERSION 0x01
  120. #define ADDITIONAL_FIELD_TELEPORTED_ORIGIN (1<<0)
  121. #define ADDITIONAL_FIELD_TELEPORTED_ANGLES (1<<1)
  122. #define ADDITIONAL_FIELD_TELEPORTED_VELOCITY (1<<2)
  123. #define FRAME_INFO_SIZE 15
  124. #define AT_SIZE 10
  125. #define ORIGIN_SNAPSHOT_INTERVAL 150
  126. #define FILE_HEADER_LENGTH 74
  127.  
  128. // Title definitions
  129. #define TITLE_COUNT 23 // The amount of custom titles that can be configured in custom_chat_titles.txt
  130.  
  131.  
  132.  
  133.  
  134. /*====================================
  135. = Enumerations =
  136. ====================================*/
  137.  
  138. enum FrameInfo
  139. {
  140. playerButtons = 0,
  141. playerImpulse,
  142. Float:actualVelocity[3],
  143. Float:predictedVelocity[3],
  144. Float:predictedAngles[2],
  145. CSWeaponID:newWeapon,
  146. playerSubtype,
  147. playerSeed,
  148. additionalFields,
  149. pause,
  150. }
  151.  
  152. enum AdditionalTeleport
  153. {
  154. Float:atOrigin[3],
  155. Float:atAngles[3],
  156. Float:atVelocity[3],
  157. atFlags
  158. }
  159.  
  160. enum FileHeader
  161. {
  162. FH_binaryFormatVersion = 0,
  163. String:FH_Time[32],
  164. String:FH_Playername[32],
  165. FH_Checkpoints,
  166. FH_tickCount,
  167. Float:FH_initialPosition[3],
  168. Float:FH_initialAngles[3],
  169. Handle:FH_frames
  170. }
  171.  
  172. enum MapZone
  173. {
  174. zoneId, // ID within the map
  175. zoneType, // Types: Start(1), End(2), Stage(3), Checkpoint(4), Speed(5), TeleToStart(6), Validator(7), Chekcer(8), Stop(0)
  176. zoneTypeId, // ID of the same type eg. Start-1, Start-2, Start-3...
  177. Float:PointA[3],
  178. Float:PointB[3],
  179. String:zoneName[128],
  180. zoneGroup,
  181. Vis,
  182. Team
  183. }
  184.  
  185. enum SkillGroup
  186. {
  187. PointReq, // Points required for next skillgroup
  188. NameColor, // Color to use for name if colored chatnames is turned on
  189. String:RankName[32], // Skillgroup name without colors
  190. String:RankNameColored[32], // Skillgroup name with colors
  191. }
  192.  
  193.  
  194.  
  195.  
  196. /*===================================
  197. = Plugin Info =
  198. ===================================*/
  199.  
  200. public Plugin myinfo =
  201. {
  202. name = "ckSurf",
  203. author = "Elzi",
  204. description = "#clan.kikkeli's Surf Plugin",
  205. version = VERSION,
  206. url = ""
  207. };
  208.  
  209.  
  210.  
  211.  
  212. /*=================================
  213. = Variables =
  214. =================================*/
  215.  
  216. /*---------- Stages ----------*/
  217. int g_Stage[MAXZONEGROUPS][MAXPLAYERS + 1]; // Which stage is the client in
  218. bool g_bhasStages; // Does the map have stages
  219.  
  220. /*---------- Spawn locations ----------*/
  221. float g_fSpawnLocation[MAXZONEGROUPS][3]; // Spawn coordinates
  222. float g_fSpawnAngle[MAXZONEGROUPS][3]; // Spawn angle
  223. bool g_bGotSpawnLocation[MAXZONEGROUPS]; // Does zonegroup have a spawn location
  224.  
  225. /*---------- Player titles ----------*/
  226. bool g_bflagTitles[MAXPLAYERS + 1][TITLE_COUNT]; // Which titles have been given for client
  227. bool g_bflagTitles_orig[MAXPLAYERS + 1][TITLE_COUNT]; // Used to track which title the user gained / lost
  228. bool g_bHasTitle[MAXPLAYERS + 1]; // Does the client have any titles
  229. char g_szflagTitle_Colored[TITLE_COUNT][32]; // Titles with colors
  230. char g_szflagTitle[TITLE_COUNT][32]; // Titles loaded from config
  231. int g_iTitleInUse[MAXPLAYERS + 1]; // Which title the client is using
  232. int g_iCustomTitleCount; // How many custom titles are loaded
  233. // Chat Colors in String Format
  234. char szWHITE[12], szDARKRED[12], szPURPLE[12], szGREEN[12], szMOSSGREEN[12], szLIMEGREEN[12], szRED[12], szGRAY[12], szYELLOW[12], szDARKGREY[12], szBLUE[12], szDARKBLUE[12], szLIGHTBLUE[12], szPINK[12], szLIGHTRED[12], szORANGE[12];
  235. bool g_bAdminSelectedHasFlag[MAXPLAYERS + 1]; // Does the client the admin selected have titles?
  236. char g_szAdminSelectedSteamID[MAXPLAYERS + 1][32]; // SteamID of the user admin chose when giving title
  237. bool g_bAdminFlagTitlesTemp[MAXPLAYERS + 1][TITLE_COUNT]; // Which title admin chose to give in !givetitles
  238. int g_iAdminSelectedClient[MAXPLAYERS + 1]; // Which clientid did the admin select
  239. int g_iAdminEditingType[MAXPLAYERS + 1]; // What the admin is editing
  240.  
  241. /*---------- VIP Variables ----------*/
  242. // Enable VIP CVar
  243. bool g_bServerVipCommand;
  244. ConVar g_hServerVipCommand;
  245. // Trail variables
  246. bool g_bTrailOn[MAXPLAYERS + 1]; // Client is using a trail
  247. bool g_bTrailApplied[MAXPLAYERS + 1]; // Client has been given a title
  248. bool g_bClientStopped[MAXPLAYERS + 1]; // Client is not moving
  249. int g_iTrailColor[MAXPLAYERS + 1]; // Trail color the client is using
  250. float g_fClientLastMovement[MAXPLAYERS + 1]; // Last time the client moved
  251. // Auto VIP Cvar
  252. int g_AutoVIPFlag;
  253. bool g_bAutoVIPFlag;
  254. ConVar g_hAutoVIPFlag = null;
  255. // Vote Extend
  256. char g_szUsedVoteExtend[MAXPLAYERS+1][32]; // SteamID's which triggered extend vote
  257. int g_VoteExtends = 0; // How many extends have happened in current map
  258. ConVar g_hVoteExtendTime; // Extend time CVar
  259. float g_fVoteExtendTime;
  260. ConVar g_hMaxVoteExtends; // Extend max count CVar
  261. int g_MaxVoteExtends;
  262.  
  263. /*---------- Bonus variables ----------*/
  264. char g_szBonusFastest[MAXZONEGROUPS][MAX_NAME_LENGTH]; // Name of the #1 in the current maps bonus
  265. char g_szBonusFastestTime[MAXZONEGROUPS][64]; // Fastest bonus time in 00:00:00:00 format
  266. float g_fPersonalRecordBonus[MAXZONEGROUPS][MAXPLAYERS + 1]; // Clients personal bonus record in the current map
  267. char g_szPersonalRecordBonus[MAXZONEGROUPS][MAXPLAYERS + 1][64]; // Personal bonus record in 00:00:00 format
  268. float g_fBonusFastest[MAXZONEGROUPS]; // Fastest bonus time in the current map
  269. float g_fOldBonusRecordTime[MAXZONEGROUPS]; // Old record time, for prints + counting
  270. int g_MapRankBonus[MAXZONEGROUPS][MAXPLAYERS + 1]; // Clients personal bonus rank in the current map
  271. int g_OldMapRankBonus[MAXZONEGROUPS][MAXPLAYERS + 1]; // Old rank in bonus
  272. int g_bMissedBonusBest[MAXPLAYERS + 1]; // Has the client mbissed his best bonus time
  273. int g_tmpBonusCount[MAXZONEGROUPS]; // Used to make sure bonus finished prints are correct
  274. int g_iBonusCount[MAXZONEGROUPS]; // Amount of players that have passed the bonus in current map
  275. int g_totalBonusCount; // How many total bonuses there are
  276. bool g_bhasBonus; // Does map have a bonus?
  277.  
  278. /*---------- Checkpoint variables ----------*/
  279. float g_fCheckpointTimesRecord[MAXZONEGROUPS][MAXPLAYERS + 1][CPLIMIT]; // Clients best run's times
  280. float g_fCheckpointTimesNew[MAXZONEGROUPS][MAXPLAYERS + 1][CPLIMIT]; // Clients current run's times
  281. float g_fCheckpointServerRecord[MAXZONEGROUPS][CPLIMIT]; // Server record checkpoint times
  282. char g_szLastSRDifference[MAXPLAYERS + 1][64]; // Last difference to the server record checkpoint
  283. char g_szLastPBDifference[MAXPLAYERS + 1][64]; // Last difference to clients own record checkpoint
  284. float g_fLastDifferenceTime[MAXPLAYERS + 1]; // The time difference was shown, used to show for a few seconds in timer panel
  285. float tmpDiff[MAXPLAYERS + 1]; // Used to calculate time gain / lost
  286. int lastCheckpoint[MAXZONEGROUPS][MAXPLAYERS + 1]; // Used to track which checkpoint was last reached
  287. bool g_bCheckpointsFound[MAXZONEGROUPS][MAXPLAYERS + 1]; // Clients checkpoints have been found?
  288. bool g_bCheckpointRecordFound[MAXZONEGROUPS]; // Map record checkpoints found?
  289. float g_fMaxPercCompleted[MAXPLAYERS + 1]; // The biggest % amount the player has reached in current map
  290.  
  291. /*---------- Advert variables ----------*/
  292. int g_Advert; // Defines which advert to play
  293.  
  294.  
  295. /*---------- Maptier Variables ----------*/
  296. char g_sTierString[MAXZONEGROUPS][512]; // The string for each zonegroup
  297. bool g_bTierEntryFound; // Tier data found?
  298. bool g_bTierFound[MAXZONEGROUPS]; // Tier data found in ZGrp
  299. Handle AnnounceTimer[MAXPLAYERS + 1]; // Tier announce timer
  300.  
  301. /*---------- Zone Variables ----------*/
  302. // Client
  303. bool g_bIgnoreZone[MAXPLAYERS + 1]; // Ignore end zone end touch if teleporting from inside a zone
  304. int g_iClientInZone[MAXPLAYERS + 1][4]; // Which zone the client is in 0 = ZoneType, 1 = ZoneTypeId, 2 = ZoneGroup, 3 = ZoneID
  305. // Zone Counts & Data
  306. int g_mapZonesTypeCount[MAXZONEGROUPS][ZONEAMOUNT]; // Zone type count in each zoneGroup
  307. char g_szZoneGroupName[MAXZONEGROUPS][128]; // Zone group's name
  308. int g_mapZones[MAXZONES][MapZone]; // Map Zone array
  309. int g_mapZonesCount; // The total amount of zones in the map
  310. int g_mapZoneCountinGroup[MAXZONEGROUPS]; // Map zone count in zonegroups
  311. int g_mapZoneGroupCount; // Zone group cound
  312.  
  313. // Editing zones
  314. bool g_bEditZoneType[MAXPLAYERS + 1]; // If editing zone type
  315. char g_CurrentZoneName[MAXPLAYERS + 1][64]; // Selected zone's name
  316. float g_Positions[MAXPLAYERS + 1][2][3]; // Selected zone's position
  317. float g_fBonusStartPos[MAXPLAYERS + 1][2][3]; // Bonus start zone position
  318. float g_fBonusEndPos[MAXPLAYERS + 1][2][3]; // Bonus end zone positions
  319. float g_AvaliableScales[5] = { 1.0, 5.0, 10.0, 50.0, 100.0 }; // Scaling options
  320. int g_CurrentSelectedZoneGroup[MAXPLAYERS + 1]; // Currently selected zonegroup
  321. int g_CurrentZoneTeam[MAXPLAYERS + 1]; // Current zone team TODO: Remove
  322. int g_CurrentZoneVis[MAXPLAYERS + 1]; // Current zone visibility per team TODO: Remove
  323. int g_CurrentZoneType[MAXPLAYERS + 1]; // Currenyly selected zone's type
  324. int g_Editing[MAXPLAYERS + 1]; // What state of editing is happening eg. editing, creating etc.
  325. int g_ClientSelectedZone[MAXPLAYERS + 1] = { -1, ... }; // Currently selected zone id
  326. int g_ClientSelectedScale[MAXPLAYERS + 1]; // Currently selected scale
  327. int g_ClientSelectedPoint[MAXPLAYERS + 1]; // Currently selected point
  328. int g_CurrentZoneTypeId[MAXPLAYERS + 1]; // Currently selected zone's type ID
  329. bool g_ClientRenamingZone[MAXPLAYERS + 1]; // Is client renaming zone?
  330. float g_fZonePositions[MAXZONES][3]; // Loaded zone positions in memory
  331. int beamColorT[] = { 255, 0, 0, 255 }; // Zone team colors TODO: remove
  332. int beamColorCT[] = { 0, 0, 255, 255 };
  333. int beamColorN[] = { 255, 255, 0, 255 };
  334. int beamColorM[] = { 0, 255, 0, 255 };
  335. char g_szZoneDefaultNames[ZONEAMOUNT][128] = { "Stop", "Start", "End", "Stage", "Checkpoint", "SpeedStart", "TeleToStart", "Validator", "Checker" }; // Default zone names
  336. int g_BeamSprite; // Zone sprites
  337. int g_HaloSprite;
  338.  
  339. /*---------- PushFix by Mev, George & Blacky ----------*/
  340. /*---------- https://forums.alliedmods.net/showthread.php?t=267131 ----------*/
  341. ConVar g_hTriggerPushFixEnable;
  342. bool g_bTriggerPushFixEnable;
  343. bool g_bPushing[MAXPLAYERS + 1];
  344.  
  345. /*---------- Slope Boost Fix by Mev & Blacky ----------*/
  346. /*---------- https://forums.alliedmods.net/showthread.php?t=266888 ----------*/
  347. float g_vCurrent[MAXPLAYERS + 1][3];
  348. float g_vLast[MAXPLAYERS + 1][3];
  349. bool g_bOnGroundFix[MAXPLAYERS + 1];
  350. bool g_bLastOnGround[MAXPLAYERS + 1];
  351. ConVar g_hSlopeFixEnable;
  352. bool g_bSlopeFixEnable;
  353.  
  354. /*---------- Forwards ----------*/
  355. Handle g_MapFinishForward;
  356. Handle g_BonusFinishForward;
  357. Handle g_PracticeFinishForward;
  358.  
  359. /*---------- CVars ----------*/
  360. // Zones
  361. int g_ZoneMenuFlag;
  362. ConVar g_hZoneMenuFlag = null;
  363. ConVar g_hZoneDisplayType = null; // How zones are displayed (lower edge, full)
  364. int g_zoneDisplayType;
  365. ConVar g_hZonesToDisplay = null; // Which zones are displayed
  366. int g_zonesToDisplay;
  367. ConVar g_hChecker; // Zone refresh rate
  368. float g_fChecker;
  369. Handle g_hZoneTimer = INVALID_HANDLE;
  370. //Zone Colors
  371. int g_zoneStartColor[4];
  372. ConVar g_hzoneStartColor = null;
  373. char g_szzoneStartColor[24];
  374. int g_zoneEndColor[4];
  375. ConVar g_hzoneEndColor = null;
  376. char g_szzoneEndColor[24];
  377. int g_zoneBonusStartColor[4];
  378. ConVar g_hzoneBonusStartColor = null;
  379. char g_szzoneBonusStartColor[24];
  380. int g_zoneBonusEndColor[4];
  381. ConVar g_hzoneBonusEndColor = null;
  382. char g_szzoneBonusEndColor[24];
  383. int g_zoneStageColor[4];
  384. ConVar g_hzoneStageColor = null;
  385. char g_szzoneStageColor[24];
  386. int g_zoneCheckpointColor[4];
  387. ConVar g_hzoneCheckpointColor = null;
  388. char g_szzoneCheckpointColor[24];
  389. int g_zoneSpeedColor[4];
  390. ConVar g_hzoneSpeedColor = null;
  391. char g_szzoneSpeedColor[24];
  392. int g_zoneTeleToStartColor[4];
  393. ConVar g_hzoneTeleToStartColor = null;
  394. char g_szzoneTeleToStartColor[24];
  395. int g_zoneValidatorColor[4];
  396. ConVar g_hzoneValidatorColor = null;
  397. char g_szzoneValidatorColor[24];
  398. int g_zoneCheckerColor[4];
  399. ConVar g_hzoneCheckerColor = null;
  400. char g_szzoneCheckerColor[24];
  401. int g_zoneStopColor[4];
  402. ConVar g_hzoneStopColor = null;
  403. char g_szzoneStopColor[24];
  404. ConVar g_hAnnounceRecord; // Announce rank type: 0 announce all, 1 announce only PB's, 3 announce only SR's
  405. int g_iAnnounceRecord;
  406. ConVar g_hCommandToEnd; // !end Enable / Disable
  407. bool g_bCommandToEnd;
  408. ConVar g_hWelcomeMsg = null;
  409. char g_sWelcomeMsg[512]; // Welcome message
  410. ConVar g_hReplayBotPlayerModel = null;
  411. char g_sReplayBotPlayerModel[256]; // Repalay bot player model
  412. ConVar g_hReplayBotArmModel = null; // Replay bot arm model
  413. char g_sReplayBotArmModel[256];
  414. ConVar g_hPlayerModel = null; // Player models
  415. char g_sPlayerModel[256];
  416. ConVar g_hArmModel = null; // Player arm models
  417. char g_sArmModel[256];
  418. ConVar g_hcvarRestore = null; // Restore player's runs?
  419. bool g_bRestore;
  420. ConVar g_hNoClipS = null; // Allow noclip?
  421. bool g_bNoClipS;
  422. ConVar g_hReplayBot = null; // Replay bot?
  423. bool g_bMapReplay; // Why two bools?
  424. bool g_bReplayBot;
  425. ConVar g_hBonusBot = null; // Bonus bot?
  426. bool g_bBonusReplay; // Why two bools?
  427. bool g_bMapBonusReplay;
  428. ConVar g_hColoredNames = null; // Colored names in chat?
  429. bool g_bColoredNames;
  430. ConVar g_hPauseServerside = null; // Allow !pause?
  431. bool g_bPauseServerside;
  432. ConVar g_hChallengePoints = null; // Allow betting points in challenges?
  433. bool g_bChallengePoints;
  434. ConVar g_hAutoBhopConVar = null; // Allow autobhop?
  435. bool g_bAutoBhopConVar; // Why two bools?
  436. bool g_bAutoBhop;
  437. ConVar g_hDynamicTimelimit = null; // Dynamic timelimit?
  438. bool g_bDynamicTimelimit;
  439. ConVar g_hAdminClantag = null; // Admin clan tag?
  440. bool g_bAdminClantag;
  441. ConVar g_hConnectMsg = null; // Connect message?
  442. bool g_bConnectMsg;
  443. ConVar g_hDisconnectMsg = null; // Disconnect message?
  444. bool g_bDisconnectMsg;
  445. ConVar g_hRadioCommands = null; // Allow radio commands?
  446. bool g_bRadioCommands;
  447. ConVar g_hInfoBot = null; // Info bot?
  448. bool g_bInfoBot;
  449. ConVar g_hAttackSpamProtection = null; // Throttle shooting?
  450. bool g_bAttackSpamProtection;
  451. int g_AttackCounter[MAXPLAYERS + 1]; // Used to calculate player shots
  452. ConVar g_hGoToServer = null; // Allow !goto?
  453. bool g_bGoToServer;
  454. ConVar g_hAllowRoundEndCvar = null; // Allow round ending?
  455. bool g_bRoundEnd; // Why two bools?
  456. bool g_bAllowRoundEndCvar;
  457. ConVar g_hPlayerSkinChange = null; // Allow changing player models?
  458. bool g_bPlayerSkinChange;
  459. ConVar g_hCountry = null; // Display countries for players?
  460. bool g_bCountry;
  461. ConVar g_hAutoRespawn = null; // Respawn players automatically?
  462. bool g_bAutoRespawn;
  463. ConVar g_hcvarNoBlock = null; // Allow player blocking?
  464. bool g_bNoBlock;
  465. ConVar g_hPointSystem = null; // Use the point system?
  466. bool g_bPointSystem;
  467. ConVar g_hCleanWeapons = null; // Clean weapons from ground?
  468. bool g_bCleanWeapons;
  469. int g_ownerOffset; // Used to clear weapons from ground
  470. ConVar g_hcvargodmode = null; // Enable god mode?
  471. bool g_bgodmode;
  472. bool g_bAutoTimer; // Start timer automatically? Kinda useless for ckSurf
  473. ConVar g_hAutoTimer = null;
  474. ConVar g_hMapEnd = null; // Allow map ending?
  475. bool g_bMapEnd;
  476. ConVar g_hAutohealing_Hp = null; // Automatically heal lost HP?
  477. int g_Autohealing_Hp;
  478. ConVar g_hExtraPoints = null; // How many extra points for improving times?
  479. int g_ExtraPoints;
  480. ConVar g_hExtraPoints2 = null; // How many extra points for finishing a map for the first time?
  481. int g_ExtraPoints2;
  482. // Bot Colors & effects:
  483. ConVar g_hReplayBotColor = null; // Replay bot color
  484. int g_ReplayBotColor[3];
  485. ConVar g_hBonusBotColor = null; // Bonus bot color
  486. int g_BonusBotColor[3];
  487. ConVar g_hBonusBotTrail = null; // Bonus bot trail?
  488. bool g_bBonusReplayTrailEnabled;
  489. ConVar g_hRecordBotTrail = null; // Record bot trail?
  490. bool g_bRecordBotTrailEnabled;
  491. ConVar g_hReplayBotTrailColor = null; // Replay bot trail color
  492. int g_ReplayBotTrailColor[4];
  493. ConVar g_hBonusBotTrailColor = null; // Bonus bot trail color
  494. int g_BonusBotTrailColor[4];
  495. ConVar g_hDoubleRestartCommand;
  496. bool g_bDoubleRestartCommand; // Doube !r on / off
  497. ConVar g_hStartPreSpeed = null; // Start zone speed cap
  498. float g_fStartPreSpeed;
  499. ConVar g_hSpeedPreSpeed = null; // Speed Start zone speed cap
  500. float g_fSpeedPreSpeed;
  501. ConVar g_hBonusPreSpeed = null; // Bonus start zone speed cap
  502. float g_fBonusPreSpeed;
  503. ConVar g_hSoundEnabled = null; // Enable timer start sound
  504. bool bSoundEnabled;
  505. ConVar g_hSoundPath = null; // Define start sound
  506. char sSoundPath[64];
  507. ConVar g_hSpawnToStartZone = null; // Teleport on spawn to start zone
  508. bool bSpawnToStartZone;
  509. ConVar g_hAnnounceRank = null; // Min rank to announce in chat
  510. int g_AnnounceRank;
  511. ConVar g_hForceCT = null; // Force players CT
  512. bool g_bForceCT;
  513. ConVar g_hChatSpamFilter = null; // Chat spam limiter
  514. float g_fChatSpamFilter;
  515. float g_fLastChatMessage[MAXPLAYERS + 1]; // Last message time
  516. int g_messages[MAXPLAYERS + 1]; // Spam message count
  517. ConVar g_henableChatProcessing = null; // Is chat processing enabled
  518. bool g_benableChatProcessing;
  519. ConVar g_hMultiServerMapcycle = null; // Use multi server mapcycle
  520. bool g_bMultiServerMapcycle;
  521.  
  522. /*---------- SQL Variables ----------*/
  523. Handle g_hDb = null; // SQL driver
  524. int g_DbType; // Database type
  525. bool g_bInTransactionChain = false; // Used to check if SQL changes are being made
  526. int g_failedTransactions[7]; // Used to track failed transactions when making database changes
  527. bool g_bRenaming = false; // Used to track if sql tables are being renamed
  528. bool g_bSettingsLoaded[MAXPLAYERS + 1]; // Used to track if a players settings have been loaded
  529. bool g_bLoadingSettings[MAXPLAYERS + 1]; // Used to track if players settings are being loaded
  530. bool g_bServerDataLoaded; // Are the servers settings loaded
  531. char g_szRecordMapSteamID[MAX_NAME_LENGTH]; // SteamdID of #1 player in map, used to fetch checkpoint times
  532.  
  533. /*---------- User Commands ----------*/
  534. float g_flastClientUsp[MAXPLAYERS + 1]; // Throttle !usp command
  535. bool g_insertingInformation; // Used to check if a admin is inserting zone or maptier information, don't allow many at the same time
  536. bool g_bNoClip[MAXPLAYERS + 1]; // Client is noclipping
  537.  
  538. /*---------- User Options ----------*/
  539. // org variables track the original setting status, on disconnect, check if changed, if so, update new settings to database
  540. bool g_bHideChat[MAXPLAYERS + 1]; // Hides chat
  541. bool g_borg_HideChat[MAXPLAYERS + 1];
  542. bool g_bViewModel[MAXPLAYERS + 1]; // Hides viewmodel
  543. bool g_borg_ViewModel[MAXPLAYERS + 1];
  544. bool g_bCheckpointsEnabled[MAXPLAYERS + 1]; // Command to disable checkpoints
  545. bool g_borg_CheckpointsEnabled[MAXPLAYERS + 1];
  546. bool g_bActivateCheckpointsOnStart[MAXPLAYERS + 1]; // Did client enable checkpoints? Then start using them again on the next run
  547. bool g_bEnableQuakeSounds[MAXPLAYERS + 1]; // Enable quake sounds?
  548. bool g_borg_EnableQuakeSounds[MAXPLAYERS + 1];
  549. bool g_bShowNames[MAXPLAYERS + 1]; // TODO: remove
  550. bool g_borg_ShowNames[MAXPLAYERS + 1];
  551. bool g_bStartWithUsp[MAXPLAYERS + 1]; // TODO: Remove
  552. bool g_borg_StartWithUsp[MAXPLAYERS + 1];
  553. bool g_bShowTime[MAXPLAYERS + 1]; // TODO: Remove
  554. bool g_borg_ShowTime[MAXPLAYERS + 1];
  555. bool g_bHide[MAXPLAYERS + 1]; // Hide other players?
  556. bool g_borg_Hide[MAXPLAYERS + 1];
  557. bool g_bShowSpecs[MAXPLAYERS + 1]; // Show spectator list?
  558. bool g_borg_ShowSpecs[MAXPLAYERS + 1];
  559. bool g_bGoToClient[MAXPLAYERS + 1]; // Allow !goto
  560. bool g_borg_GoToClient[MAXPLAYERS + 1];
  561. bool g_bAutoBhopClient[MAXPLAYERS + 1]; // Use auto bhop?
  562. bool g_borg_AutoBhopClient[MAXPLAYERS + 1];
  563. bool g_bInfoPanel[MAXPLAYERS + 1]; // Client is showing the info panel
  564. bool g_borg_InfoPanel[MAXPLAYERS + 1];
  565.  
  566. /*---------- Run Variables ----------*/
  567. float g_fPersonalRecord[MAXPLAYERS + 1]; // Clients personal record in map
  568. bool g_bTimeractivated[MAXPLAYERS + 1]; // Is clients timer running
  569. bool g_bValidRun[MAXPLAYERS + 1]; // Used to check if a clients run is valid in validator and checker zones
  570. bool g_bBonusFirstRecord[MAXPLAYERS + 1]; // First bonus time in map?
  571. bool g_bBonusPBRecord[MAXPLAYERS + 1]; // Personal best time in bonus
  572. bool g_bBonusSRVRecord[MAXPLAYERS + 1]; // New server record in bonus
  573. char g_szBonusTimeDifference[MAXPLAYERS + 1]; // How many seconds were improved / lost in that run
  574. float g_fStartTime[MAXPLAYERS + 1]; // Time when run was started
  575. float g_fFinalTime[MAXPLAYERS + 1]; // Total time the run took
  576. char g_szFinalTime[MAXPLAYERS + 1][32]; // Total time the run took in 00:00:00 format
  577. float g_fPauseTime[MAXPLAYERS + 1]; // Time spent in !pause this run
  578. float g_fStartPauseTime[MAXPLAYERS + 1]; // Time when !pause started
  579. float g_fCurrentRunTime[MAXPLAYERS + 1]; // Current runtime
  580. bool g_bMissedMapBest[MAXPLAYERS + 1]; // Missed personal record time?
  581. bool g_bMapFirstRecord[MAXPLAYERS + 1]; // Was players run his first time finishing the map?
  582. bool g_bMapPBRecord[MAXPLAYERS + 1]; // Was players run his personal best?
  583. bool g_bMapSRVRecord[MAXPLAYERS + 1]; // Was players run the new server record?
  584. char g_szTimeDifference[MAXPLAYERS + 1][32]; // Used to print the client's new times difference to record
  585. float g_fRecordMapTime; // Record map time in seconds
  586. char g_szRecordMapTime[64]; // Record map time in 00:00:00 format
  587. char g_szPersonalRecord[MAXPLAYERS + 1][64]; // Client's peronal record in 00:00:00 format
  588. float g_favg_maptime; // Average map time
  589. float g_fAvg_BonusTime[MAXZONEGROUPS]; // Average bonus times TODO: Combine with g_favg_maptime
  590. bool g_bFirstTimerStart[MAXPLAYERS + 1]; // If timer is started for the first time, print avg times
  591. bool g_bPause[MAXPLAYERS + 1]; // Client has timer paused
  592. int g_MapTimesCount; // How many times the map has been beaten
  593. int g_MapRank[MAXPLAYERS + 1]; // Clients rank in current map
  594. int g_OldMapRank[MAXPLAYERS + 1]; // Clients old rank
  595. int g_Time_Type[MAXPLAYERS + 1]; // Did the client improve his time? New Server record? etc.
  596. char g_szRecordPlayer[MAX_NAME_LENGTH]; // Current map's record player's name
  597.  
  598. /*---------- Replay Variables ----------*/
  599. bool g_bNewRecordBot; // Checks if the bot is new, if so, set weapon
  600. bool g_bNewBonusBot; // Checks if the bot is new, if so, set weapon
  601. Handle g_hTeleport = null; // Used to track teleportations
  602. Handle g_hRecording[MAXPLAYERS + 1]; // Client is beign recorded
  603. Handle g_hLoadedRecordsAdditionalTeleport = null;
  604. Handle g_hRecordingAdditionalTeleport[MAXPLAYERS + 1];
  605. Handle g_hBotMimicsRecord[MAXPLAYERS + 1] = { null, ... }; // Is mimicing a record
  606. float g_fInitialPosition[MAXPLAYERS + 1][3]; // Replay start position
  607. float g_fInitialAngles[MAXPLAYERS + 1][3]; // Replay start angle
  608. bool g_bValidTeleportCall[MAXPLAYERS + 1]; // Is teleport valid?
  609. bool g_bNewReplay[MAXPLAYERS + 1]; // Don't allow starting a new run if saving a record run
  610. bool g_bNewBonus[MAXPLAYERS + 1]; // Don't allow starting a new run if saving a record run
  611. int g_BotMimicRecordTickCount[MAXPLAYERS + 1] = { 0, ... };
  612. int g_BotActiveWeapon[MAXPLAYERS + 1] = { -1, ... };
  613. int g_CurrentAdditionalTeleportIndex[MAXPLAYERS + 1];
  614. int g_RecordedTicks[MAXPLAYERS + 1];
  615. int g_RecordPreviousWeapon[MAXPLAYERS + 1];
  616. int g_OriginSnapshotInterval[MAXPLAYERS + 1];
  617. int g_BotMimicTick[MAXPLAYERS + 1] = { 0, ... };
  618. int g_RecordBot = -1; // Record bot client ID
  619. int g_BonusBot = -1; // Bonus bot client ID
  620. int g_InfoBot = -1; // Info bot client ID
  621. bool g_bReplayAtEnd[MAXPLAYERS + 1]; // Replay is at the end
  622. float g_fReplayRestarted[MAXPLAYERS + 1]; // Make replay stand still for long enough for trail to die
  623. char g_szReplayName[128]; // Replay bot name
  624. char g_szReplayTime[128]; // Replay bot time
  625. char g_szBonusName[128]; // Replay bot name
  626. char g_szBonusTime[128]; // Replay bot time
  627.  
  628. /*---------- Misc ----------*/
  629. Handle g_MapList = null; // Used to load the mapcycle
  630. float g_fMapStartTime; // Used to check if a player just joined the server
  631. Handle g_hSkillGroups = null; // Array that holds SkillGroup objects in it
  632. // Use !r twice to restart the run
  633. float g_fErrorMessage[MAXPLAYERS + 1]; // Used to limit error message spam too often
  634. float g_fClientRestarting[MAXPLAYERS + 1]; // Used to track the time the player took to write the second !r, if too long, reset the boolean
  635. bool g_bClientRestarting[MAXPLAYERS + 1]; // Client wanted to restart run
  636. float g_fLastTimeNoClipUsed[MAXPLAYERS + 1]; // Last time the client used noclip
  637. bool g_bRespawnPosition[MAXPLAYERS + 1]; // Does client have a respawn location in memory?
  638. float g_fLastSpeed[MAXPLAYERS + 1]; // Client's last speed, used in panels
  639. bool g_bLateLoaded = false; // Was plugin loaded late?
  640. bool g_bMapChooser; // Known mapchooser loaded? Used to update info bot
  641. bool g_bClientOwnReason[MAXPLAYERS + 1]; // If call admin, ignore chat message
  642. bool g_bNoClipUsed[MAXPLAYERS + 1]; // Has client used noclip to gain current speed
  643. bool g_bOverlay[MAXPLAYERS + 1]; // Map finished overlay
  644. bool g_bSpectate[MAXPLAYERS + 1]; // Is client spectating
  645. bool g_bFirstTeamJoin[MAXPLAYERS + 1]; // First time client joined game, show start messages & start timers
  646. bool g_bFirstSpawn[MAXPLAYERS + 1]; // First time client spawned
  647. bool g_bSelectProfile[MAXPLAYERS + 1];
  648. bool g_bOnGround[MAXPLAYERS + 1]; // Is client touching the ground?
  649. bool g_specToStage[MAXPLAYERS + 1]; // Is client teleporting from spectate?
  650. float g_fTeleLocation[MAXPLAYERS + 1][3]; // Location where client is spawned from spectate
  651. int g_ragdolls = -1; // Used to clear ragdolls from ground
  652. int g_Server_Tickrate; // Server tickrate
  653. int g_SpecTarget[MAXPLAYERS + 1]; // Who the client is spectating?
  654. int g_LastButton[MAXPLAYERS + 1]; // Buttons the client is using, used to show them when specating
  655. int g_MVPStars[MAXPLAYERS + 1]; // The amount of MVP's a client has TODO: make sure this is used everywhere
  656. int g_PlayerChatRank[MAXPLAYERS + 1]; // What color is client's name in chat (based on rank)
  657. char g_pr_chat_coloredrank[MAXPLAYERS + 1][128]; // Clients rank, colored, used in chat
  658. char g_pr_rankname[MAXPLAYERS + 1][32]; // Client's rank, non-colored, used in clantag
  659. char g_szMapPrefix[2][32]; // Map's prefix, used to execute prefix cfg's
  660. char g_szMapName[128]; // Current map's name
  661. char g_szPlayerPanelText[MAXPLAYERS + 1][512]; // Info panel text when spectating
  662. char g_szCountry[MAXPLAYERS + 1][100]; // Country codes
  663. char g_szCountryCode[MAXPLAYERS + 1][16]; // Country codes
  664. char g_szSteamID[MAXPLAYERS + 1][32]; // Client's steamID
  665. char g_BlockedChatText[256][256]; // Blocked chat commands
  666. float g_fLastOverlay[MAXPLAYERS + 1]; // Last time an overlay was displayed
  667.  
  668.  
  669. /*---------- Player location restoring ----------*/
  670. bool g_bPositionRestored[MAXPLAYERS + 1]; // Clients location was restored this run
  671. bool g_bRestorePositionMsg[MAXPLAYERS + 1]; // Show client restore message?
  672. bool g_bRestorePosition[MAXPLAYERS + 1]; // Clients position is being restored
  673. float g_fPlayerCordsLastPosition[MAXPLAYERS + 1][3]; // Client's last location, used on recovering run and coming back from spectate
  674. float g_fPlayerLastTime[MAXPLAYERS + 1]; // Client's last time, used on recovering run and coming back from spec
  675. float g_fPlayerAnglesLastPosition[MAXPLAYERS + 1][3]; // Client's last angles, used on recovering run and coming back from spec
  676. float g_fPlayerCordsRestore[MAXPLAYERS + 1][3]; // Used in restoring players location
  677. float g_fPlayerAnglesRestore[MAXPLAYERS + 1][3]; // Used in restoring players angle
  678.  
  679. /*---------- Menus ----------*/
  680. Menu g_menuTopSurfersMenu[MAXPLAYERS + 1] = null;
  681. float g_fProfileMenuLastQuery[MAXPLAYERS + 1]; // Last time profile was queried by player, spam protection
  682. int g_MenuLevel[MAXPLAYERS + 1]; // Tracking menu level
  683. int g_OptionsMenuLastPage[MAXPLAYERS + 1]; // Weird options menu tricker TODO: wtf
  684. char g_pr_szrank[MAXPLAYERS + 1][512]; // Client's rank string displayed in !profile
  685. char g_szProfileName[MAXPLAYERS + 1][MAX_NAME_LENGTH]; // !Profile name
  686. char g_szProfileSteamId[MAXPLAYERS + 1][32];
  687. // Admin
  688. int g_AdminMenuFlag; // Admin flag required for !ckadmin
  689. ConVar g_hAdminMenuFlag = null;
  690. Handle g_hAdminMenu = null; // Add !ckadmin to !admin
  691. int g_AdminMenuLastPage[MAXPLAYERS + 1]; // Weird admin menu trickery TODO: wtf
  692.  
  693. /*---------- Challenge variables ----------*/
  694. /**
  695.  
  696. TODO:
  697. - Recode completely
  698.  
  699. */
  700.  
  701. float g_fChallenge_RequestTime[MAXPLAYERS + 1]; // How long a challenge request is available
  702. float g_fSpawnPosition[MAXPLAYERS + 1][3]; // Challenge start location
  703. bool g_bChallenge_Checkpoints[MAXPLAYERS + 1]; // Allow checkpoints in challenge. TODO: remove
  704. bool g_bChallenge_Abort[MAXPLAYERS + 1]; // Abort challenge
  705. bool g_bChallenge[MAXPLAYERS + 1];
  706. bool g_bChallenge_Request[MAXPLAYERS + 1];
  707. int g_pr_PointUnit;
  708. int g_Challenge_Bet[MAXPLAYERS + 1];
  709. int g_Challenge_WinRatio[MAX_PR_PLAYERS + 1];
  710. int g_CountdownTime[MAXPLAYERS + 1];
  711. int g_Challenge_PointsRatio[MAX_PR_PLAYERS + 1];
  712. char g_szChallenge_OpponentID[MAXPLAYERS + 1][32];
  713.  
  714. /*---------- Player Points ----------*/
  715. float g_pr_finishedmaps_perc[MAX_PR_PLAYERS + 1]; // % of maps the client has finished
  716. bool g_pr_RankingRecalc_InProgress; // Is point recalculation in progress?
  717. bool g_pr_Calculating[MAXPLAYERS + 1]; // Clients points are being calculated
  718. bool g_bProfileRecalc[MAX_PR_PLAYERS + 1]; // Has this profile been recalculated?
  719. bool g_bManualRecalc; // Point recalculation type
  720. bool g_pr_showmsg[MAXPLAYERS + 1]; // Print the amount of gained points to chat?
  721. bool g_bRecalcRankInProgess[MAXPLAYERS + 1]; // Is clients points being recalculated?
  722. int g_pr_Recalc_ClientID = 0; // Client ID being recalculated
  723. int g_pr_Recalc_AdminID = -1; // ClientID that started the recalculation
  724. int g_pr_AllPlayers; // Ranked player count on server
  725. int g_pr_RankedPlayers; // Player count with points
  726. int g_pr_MapCount; // Total map count in mapcycle
  727. int g_pr_TableRowCount; // The amount of clients that get recalculated in a full recalculation
  728. int g_pr_points[MAX_PR_PLAYERS + 1]; // Clients points
  729. int g_pr_oldpoints[MAX_PR_PLAYERS + 1]; // Clients points before recalculation
  730. int g_pr_multiplier[MAX_PR_PLAYERS + 1]; // How many times has the client improved on his times
  731. int g_pr_finishedmaps[MAX_PR_PLAYERS + 1]; // How many maps a client has finished
  732. int g_PlayerRank[MAXPLAYERS + 1]; // Players server rank
  733. int g_MapRecordCount[MAXPLAYERS + 1]; // SR's the client has
  734. bool g_bnewRecord[MAXPLAYERS + 1]; // Was client's run a new record?
  735. char g_pr_szName[MAX_PR_PLAYERS + 1][64]; // Used to update client's name in database
  736. char g_pr_szSteamID[MAX_PR_PLAYERS + 1][32]; // steamid of client being recalculated
  737.  
  738. /*---------- Practice Mode ----------*/
  739. float g_fCheckpointVelocity_undo[MAXPLAYERS + 1][3]; // Velocity at checkpoint that is on !undo
  740. float g_fCheckpointVelocity[MAXPLAYERS + 1][3]; // Current checkpoints velocity
  741. float g_fCheckpointLocation[MAXPLAYERS + 1][3]; // Current checkpoint location
  742. float g_fCheckpointLocation_undo[MAXPLAYERS + 1][3]; // Undo checkpoints location
  743. float g_fCheckpointAngle[MAXPLAYERS + 1][3]; // Current checkpoints angle
  744. float g_fCheckpointAngle_undo[MAXPLAYERS + 1][3]; // Undo checkpoints angle
  745. float g_fLastPlayerCheckpoint[MAXPLAYERS + 1]; // Don't overwrite checkpoint if spamming !cp
  746. bool g_bCreatedTeleport[MAXPLAYERS + 1]; // Client has created atleast one checkpoint
  747. bool g_bPracticeMode[MAXPLAYERS + 1]; // Client is in the practice mode
  748.  
  749.  
  750. /*=========================================
  751. = Predefined arrays =
  752. =========================================*/
  753.  
  754. char EntityList[][] = // Disable entities that often break maps
  755. {
  756. "logic_timer",
  757. "team_round_timer",
  758. "logic_relay",
  759. "trigger_hurt"
  760. };
  761.  
  762. char RadioCMDS[][] = // Disable radio commands
  763. {
  764. "coverme", "takepoint", "holdpos", "regroup", "followme", "takingfire", "go", "fallback", "sticktog",
  765. "getinpos", "stormfront", "report", "roger", "enemyspot", "needbackup", "sectorclear", "inposition",
  766. "reportingin", "getout", "negative", "enemydown", "cheer", "thanks", "nice", "compliment"
  767. };
  768.  
  769. int RGB_COLORS[][] = // Store defined RGB colors in an array
  770. {
  771. RGB_GREEN, RGB_RED, RGB_DARKRED, RGB_BLUE, RGB_LIGHTBLUE, RGB_DARKBLUE, RBG_YELLOW, RGB_GREENYELLOW,
  772. RGB_PURPLE, RGB_MAGENTA, RGB_PINK, RGB_WHITE, RGB_CYAN, RGB_SPRINGGREEN, RGB_OLIVE, RGB_ORANGE,
  773. RGB_GREY, RGB_DARKGREY
  774. };
  775.  
  776. char RGB_COLOR_NAMES[][] = // Store RGB color names in an array also
  777. {
  778. "Green", "Red", "Darkred", "Blue", "Lightblue", "Darkblue", "Yellow", "Greenyellow", "Purple",
  779. "Magenta", "Pink", "White", "Cyan", "Springgreen", "Olive", "Orange", "Grey", "Darkgrey"
  780. };
  781.  
  782.  
  783. /*===== End of Declarations ======*/
  784.  
  785.  
  786.  
  787.  
  788. /*================================
  789. = Includes =
  790. ================================*/
  791.  
  792. #include "ckSurf/misc.sp"
  793. #include "ckSurf/admin.sp"
  794. #include "ckSurf/commands.sp"
  795. #include "ckSurf/hooks.sp"
  796. #include "ckSurf/buttonpress.sp"
  797. #include "ckSurf/sql.sp"
  798. #include "ckSurf/timer.sp"
  799. #include "ckSurf/replay.sp"
  800. #include "ckSurf/surfzones.sp"
  801.  
  802.  
  803.  
  804.  
  805. /*==============================
  806. = Events =
  807. ==============================*/
  808.  
  809. public void OnLibraryAdded(const char[] name)
  810. {
  811. Handle tmp = FindPluginByFile("mapchooser_extended.smx");
  812. if ((StrEqual("mapchooser", name)) || (tmp != null && GetPluginStatus(tmp) == Plugin_Running))
  813. g_bMapChooser = true;
  814. if (tmp != null)
  815. CloseHandle(tmp);
  816.  
  817. //botmimic 2
  818. if (StrEqual(name, "dhooks") && g_hTeleport == null)
  819. {
  820. // Optionally setup a hook on CBaseEntity::Teleport to keep track of sudden place changes
  821. Handle hGameData = LoadGameConfigFile("sdktools.games");
  822. if (hGameData == null)
  823. return;
  824. int iOffset = GameConfGetOffset(hGameData, "Teleport");
  825. CloseHandle(hGameData);
  826. if (iOffset == -1)
  827. return;
  828.  
  829. g_hTeleport = DHookCreate(iOffset, HookType_Entity, ReturnType_Void, ThisPointer_CBaseEntity, DHooks_OnTeleport);
  830. if (g_hTeleport == null)
  831. return;
  832. DHookAddParam(g_hTeleport, HookParamType_VectorPtr);
  833. DHookAddParam(g_hTeleport, HookParamType_ObjectPtr);
  834. DHookAddParam(g_hTeleport, HookParamType_VectorPtr);
  835. if (GetEngineVersion() == Engine_CSGO)
  836. DHookAddParam(g_hTeleport, HookParamType_Bool);
  837.  
  838. for (int i = 1; i <= MaxClients; i++)
  839. {
  840. if (IsClientInGame(i))
  841. OnClientPutInServer(i);
  842. }
  843. }
  844. }
  845.  
  846. public void OnPluginEnd()
  847. {
  848. //remove clan tags
  849. for (int x = 1; x <= MaxClients; x++)
  850. {
  851. if (IsValidClient(x))
  852. {
  853. SetEntPropEnt(x, Prop_Send, "m_bSpotted", 1);
  854. SetEntProp(x, Prop_Send, "m_iHideHUD", 0);
  855. SetEntProp(x, Prop_Send, "m_iAccount", 1);
  856. CS_SetClientClanTag(x, "");
  857. OnClientDisconnect(x);
  858. }
  859. }
  860.  
  861.  
  862. //set server convars back to default
  863. ServerCommand("sm_cvar sv_enablebunnyhopping 0;sv_friction 5.2;sv_accelerate 5.5;sv_airaccelerate 10;sv_maxvelocity 2000;sv_staminajumpcost .08;sv_staminalandcost .050");
  864. ServerCommand("mp_respawn_on_death_ct 0;mp_respawn_on_death_t 0;mp_respawnwavetime_ct 10.0;mp_respawnwavetime_t 10.0;bot_zombie 0;mp_ignore_round_win_conditions 0");
  865. ServerCommand("sv_infinite_ammo 0;mp_endmatch_votenextmap 1;mp_do_warmup_period 1;mp_warmuptime 60;mp_match_can_clinch 1;mp_match_end_changelevel 0");
  866. ServerCommand("mp_match_restart_delay 15;mp_endmatch_votenextleveltime 20;mp_endmatch_votenextmap 1;mp_halftime 0;mp_do_warmup_period 1;mp_maxrounds 0;bot_quota 0");
  867. ServerCommand("mp_startmoney 800; mp_playercashawards 1; mp_teamcashawards 1");
  868. }
  869.  
  870. public void OnLibraryRemoved(const char[] name)
  871. {
  872. if (StrEqual(name, "adminmenu"))
  873. g_hAdminMenu = null;
  874. if (StrEqual(name, "dhooks"))
  875. g_hTeleport = null;
  876. }
  877.  
  878. public void OnMapStart()
  879. {
  880. //get mapname
  881. GetCurrentMap(g_szMapName, 128);
  882.  
  883. if (!g_bRenaming && !g_bInTransactionChain)
  884. {
  885. checkSpawnPoints();
  886. }
  887. /** Start Loading Server Settings:
  888. * 1. Load zones (db_selectMapZones)
  889. * 2. Get map record time (db_GetMapRecord_Pro)
  890. * 3. Get the amount of players that have finished the map (db_viewMapProRankCount)
  891. * 4. Get the fastest bonus times (db_viewFastestBonus)
  892. * 5. Get the total amount of players that have finsihed the bonus (db_viewBonusTotalCount)
  893. * 6. Get map tier (db_selectMapTier)
  894. * 7. Get record checkpoints (db_viewRecordCheckpointInMap)
  895. * 8. Calculate average run time (db_CalcAvgRunTime)
  896. * 9. Calculate averate bonus time (db_CalcAvgRunTimeBonus)
  897. * 10. Calculate player count (db_CalculatePlayerCount)
  898. * 11. Calculate player count with points (db_CalculatePlayersCountGreater0)
  899. * 12. Get spawn locations (db_selectSpawnLocations)
  900. * 13. Clear latest records (db_ClearLatestRecords)
  901. * 14. Get dynamic timelimit (db_GetDynamicTimelimit)
  902. * -> loadAllClientSettings
  903. */
  904. if (!g_bRenaming && !g_bInTransactionChain)
  905. db_selectMapZones();
  906.  
  907. //workshop fix
  908. char mapPieces[6][128];
  909. int lastPiece = ExplodeString(g_szMapName, "/", mapPieces, sizeof(mapPieces), sizeof(mapPieces[]));
  910. Format(g_szMapName, sizeof(g_szMapName), "%s", mapPieces[lastPiece - 1]);
  911. //get map tag
  912. ExplodeString(g_szMapName, "_", g_szMapPrefix, 2, 32);
  913. //sv_pure 1 could lead to problems with the ckSurf models
  914. ServerCommand("sv_pure 0");
  915.  
  916. //reload language files
  917. LoadTranslations("ckSurf.phrases");
  918.  
  919. // load configs
  920. loadHiddenChatCommands();
  921. loadCustomTitles();
  922.  
  923. CheatFlag("bot_zombie", false, true);
  924. for (int i = 0; i < MAXZONEGROUPS; i++)
  925. {
  926. g_bTierFound[i] = false;
  927. g_fBonusFastest[i] = 9999999.0;
  928. g_bCheckpointRecordFound[i] = false;
  929. }
  930.  
  931. //precache
  932. InitPrecache();
  933. SetCashState();
  934.  
  935. //timers
  936. CreateTimer(0.1, CKTimer1, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE | TIMER_REPEAT);
  937. CreateTimer(1.0, CKTimer2, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE | TIMER_REPEAT);
  938. CreateTimer(60.0, AttackTimer, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE | TIMER_REPEAT);
  939. CreateTimer(600.0, PlayerRanksTimer, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE | TIMER_REPEAT);
  940. g_hZoneTimer = CreateTimer(g_fChecker, BeamBoxAll, _, TIMER_REPEAT);
  941.  
  942.  
  943. if (g_bAutoRespawn)
  944. ServerCommand("mp_respawn_on_death_ct 1;mp_respawn_on_death_t 1;mp_respawnwavetime_ct 3.0;mp_respawnwavetime_t 3.0");
  945. else
  946. ServerCommand("mp_respawn_on_death_ct 0;mp_respawn_on_death_t 0");
  947. ServerCommand("sv_infinite_ammo 2;mp_endmatch_votenextmap 0;mp_do_warmup_period 0;mp_warmuptime 0;mp_match_can_clinch 0;mp_match_end_changelevel 1;mp_match_restart_delay 10;mp_endmatch_votenextleveltime 10;mp_endmatch_votenextmap 0;mp_halftime 0; bot_zombie 1;mp_do_warmup_period 0;mp_maxrounds 1");
  948.  
  949. //AutoBhop?
  950. if (g_bAutoBhopConVar)
  951. g_bAutoBhop = true;
  952. else
  953. g_bAutoBhop = false;
  954.  
  955.  
  956. //main cfg
  957. CreateTimer(1.0, DelayedStuff, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE);
  958.  
  959.  
  960. if (g_bLateLoaded)
  961. {
  962. OnAutoConfigsBuffered();
  963. }
  964.  
  965. g_Advert = 0;
  966. CreateTimer(180.0, AdvertTimer, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE | TIMER_REPEAT);
  967.  
  968. int iEnt;
  969. for (int i = 0; i < sizeof(EntityList); i++)
  970. {
  971. while ((iEnt = FindEntityByClassname(iEnt, EntityList[i])) != -1)
  972. {
  973. AcceptEntityInput(iEnt, "Disable");
  974. AcceptEntityInput(iEnt, "Kill");
  975. }
  976. }
  977.  
  978. // PushFix by Mev, George, & Blacky
  979. // https://forums.alliedmods.net/showthread.php?t=267131
  980. iEnt = -1;
  981. while ((iEnt = FindEntityByClassname(iEnt, "trigger_push")) != -1)
  982. {
  983. SDKHook(iEnt, SDKHook_Touch, OnTouchPushTrigger);
  984. }
  985.  
  986. OnConfigsExecuted();
  987.  
  988. // Set default values
  989. g_insertingInformation = false;
  990. g_fMapStartTime = GetGameTime();
  991. g_bRoundEnd = false;
  992.  
  993. for (int i = 0; i < MAXPLAYERS+1; i++)
  994. g_szUsedVoteExtend[i][0] = '\0';
  995.  
  996. g_VoteExtends = 0;
  997. }
  998.  
  999. public void OnMapEnd()
  1000. {
  1001. g_bServerDataLoaded = false;
  1002. for (int i = 0; i < MAXZONEGROUPS; i++)
  1003. Format(g_sTierString[i], 512, "");
  1004.  
  1005. g_RecordBot = -1;
  1006. g_BonusBot = -1;
  1007. db_Cleanup();
  1008. if (g_hSkillGroups != null)
  1009. CloseHandle(g_hSkillGroups);
  1010.  
  1011. g_hSkillGroups = null;
  1012.  
  1013. Format(g_szMapName, sizeof(g_szMapName), "");
  1014. }
  1015.  
  1016. public void OnConfigsExecuted()
  1017. {
  1018. if (!g_bMultiServerMapcycle)
  1019. readMapycycle();
  1020. else
  1021. readMultiServerMapcycle();
  1022.  
  1023. // Count the amount of bonuses and then set skillgroups
  1024. if (!g_bRenaming && !g_bInTransactionChain)
  1025. db_selectBonusCount();
  1026.  
  1027. ServerCommand("sv_pure 0");
  1028. }
  1029.  
  1030.  
  1031. public void OnAutoConfigsBuffered()
  1032. {
  1033. //just to be sure that it's not empty
  1034. char szMap[128];
  1035. char szPrefix[2][32];
  1036. GetCurrentMap(szMap, 128);
  1037. char mapPieces[6][128];
  1038. int lastPiece = ExplodeString(szMap, "/", mapPieces, sizeof(mapPieces), sizeof(mapPieces[]));
  1039. Format(szMap, sizeof(szMap), "%s", mapPieces[lastPiece - 1]);
  1040. ExplodeString(szMap, "_", szPrefix, 2, 32);
  1041.  
  1042.  
  1043. //map config
  1044. char szPath[256];
  1045. Format(szPath, sizeof(szPath), "sourcemod/ckSurf/map_types/%s_.cfg", szPrefix[0]);
  1046. char szPath2[256];
  1047. Format(szPath2, sizeof(szPath2), "cfg/%s", szPath);
  1048. if (FileExists(szPath2))
  1049. ServerCommand("exec %s", szPath);
  1050. else
  1051. SetFailState("<ckSurf> %s not found.", szPath2);
  1052.  
  1053. SetServerTags();
  1054. }
  1055.  
  1056. public void OnClientPutInServer(int client)
  1057. {
  1058. if (!IsValidClient(client))
  1059. return;
  1060.  
  1061. //defaults
  1062. SetClientDefaults(client);
  1063.  
  1064. //SDKHooks/Dhooks
  1065. SDKHook(client, SDKHook_SetTransmit, Hook_SetTransmit);
  1066. SDKHook(client, SDKHook_PostThinkPost, Hook_PostThinkPost);
  1067. SDKHook(client, SDKHook_OnTakeDamage, Hook_OnTakeDamage);
  1068. SDKHook(client, SDKHook_PreThink, OnPlayerThink);
  1069. SDKHook(client, SDKHook_PreThinkPost, OnPlayerThink);
  1070. SDKHook(client, SDKHook_Think, OnPlayerThink);
  1071. SDKHook(client, SDKHook_PostThink, OnPlayerThink);
  1072. SDKHook(client, SDKHook_PostThinkPost, OnPlayerThink);
  1073.  
  1074. if (IsFakeClient(client))
  1075. {
  1076. g_hRecordingAdditionalTeleport[client] = CreateArray(view_as<int>(AdditionalTeleport));
  1077. CS_SetMVPCount(client, 1);
  1078. return;
  1079. }
  1080. else
  1081. g_MVPStars[client] = 0;
  1082.  
  1083. //client country
  1084. GetCountry(client);
  1085.  
  1086. if (LibraryExists("dhooks"))
  1087. DHookEntity(g_hTeleport, false, client);
  1088.  
  1089. //get client steamID
  1090. GetClientAuthId(client, AuthId_Steam2, g_szSteamID[client], MAX_NAME_LENGTH, true);
  1091.  
  1092. // ' char fix
  1093. FixPlayerName(client);
  1094.  
  1095. //position restoring
  1096. if (g_bRestore && !g_bRenaming && !g_bInTransactionChain)
  1097. db_selectLastRun(client);
  1098.  
  1099. //console info
  1100. PrintConsoleInfo(client);
  1101.  
  1102. if (g_bLateLoaded && IsPlayerAlive(client))
  1103. PlayerSpawn(client);
  1104.  
  1105. if (g_bTierFound[0])
  1106. AnnounceTimer[client] = CreateTimer(20.0, AnnounceMap, client, TIMER_FLAG_NO_MAPCHANGE);
  1107.  
  1108. if (!g_bRenaming && !g_bInTransactionChain && g_bServerDataLoaded && !g_bSettingsLoaded[client] && !g_bLoadingSettings[client])
  1109. {
  1110. /**
  1111. Start loading client settings
  1112. 1. Load client map record (db_viewPersonalRecords)
  1113. 2. Load client rank in map (db_viewMapRankPro)
  1114. 3. Load client bonus record (db_viewPersonalBonusRecords)
  1115. 4. Load client points (db_viewPlayerPoints)
  1116. 5. Load player rank in server (db_GetPlayerRank)
  1117. 6. Load client options (db_viewPlayerOptions)
  1118. 7. Load client titles (db_viewPersonalFlags)
  1119. 8. Load client checkpoints (db_viewCheckpoints)
  1120. */
  1121. g_bLoadingSettings[client] = true;
  1122. db_viewPersonalRecords(client, g_szSteamID[client], g_szMapName);
  1123. }
  1124. }
  1125.  
  1126. public void OnClientAuthorized(int client)
  1127. {
  1128. if (g_bConnectMsg && !IsFakeClient(client))
  1129. {
  1130. char s_Country[32], s_clientName[32], s_address[32];
  1131. GetClientIP(client, s_address, 32);
  1132. GetClientName(client, s_clientName, 32);
  1133. Format(s_Country, 100, "Unknown");
  1134. GeoipCountry(s_address, s_Country, 100);
  1135. if (!strcmp(s_Country, NULL_STRING))
  1136. Format(s_Country, 100, "Unknown", s_Country);
  1137. else
  1138. if (StrContains(s_Country, "United", false) != -1 ||
  1139. StrContains(s_Country, "Republic", false) != -1 ||
  1140. StrContains(s_Country, "Federation", false) != -1 ||
  1141. StrContains(s_Country, "Island", false) != -1 ||
  1142. StrContains(s_Country, "Netherlands", false) != -1 ||
  1143. StrContains(s_Country, "Isle", false) != -1 ||
  1144. StrContains(s_Country, "Bahamas", false) != -1 ||
  1145. StrContains(s_Country, "Maldives", false) != -1 ||
  1146. StrContains(s_Country, "Philippines", false) != -1 ||
  1147. StrContains(s_Country, "Vatican", false) != -1)
  1148. {
  1149. Format(s_Country, 100, "The %s", s_Country);
  1150. }
  1151.  
  1152. if (StrEqual(s_Country, "Unknown", false) || StrEqual(s_Country, "Localhost", false))
  1153. {
  1154. for (int i = 1; i <= MaxClients; i++)
  1155. if (IsValidClient(i) && i != client)
  1156. PrintToChat(i, "%t", "Connected1", WHITE, MOSSGREEN, s_clientName, WHITE);
  1157. }
  1158. else
  1159. {
  1160. for (int i = 1; i <= MaxClients; i++)
  1161. if (IsValidClient(i) && i != client)
  1162. PrintToChat(i, "%t", "Connected2", WHITE, MOSSGREEN, s_clientName, WHITE, GREEN, s_Country);
  1163. }
  1164. }
  1165. }
  1166.  
  1167. public void OnClientDisconnect(int client)
  1168. {
  1169. if (IsFakeClient(client) && g_hRecordingAdditionalTeleport[client] != null)
  1170. CloseHandle(g_hRecordingAdditionalTeleport[client]);
  1171.  
  1172. g_fPlayerLastTime[client] = -1.0;
  1173. if (g_fStartTime[client] != -1.0 && g_bTimeractivated[client])
  1174. {
  1175. if (g_bPause[client])
  1176. {
  1177. g_fPauseTime[client] = GetGameTime() - g_fStartPauseTime[client];
  1178. g_fPlayerLastTime[client] = GetGameTime() - g_fStartTime[client] - g_fPauseTime[client];
  1179. }
  1180. else
  1181. g_fPlayerLastTime[client] = g_fCurrentRunTime[client];
  1182. }
  1183.  
  1184. SDKUnhook(client, SDKHook_SetTransmit, Hook_SetTransmit);
  1185. SDKUnhook(client, SDKHook_PostThinkPost, Hook_PostThinkPost);
  1186. SDKUnhook(client, SDKHook_OnTakeDamage, Hook_OnTakeDamage);
  1187. SDKUnhook(client, SDKHook_PreThink, OnPlayerThink);
  1188. SDKUnhook(client, SDKHook_PreThinkPost, OnPlayerThink);
  1189. SDKUnhook(client, SDKHook_Think, OnPlayerThink);
  1190. SDKUnhook(client, SDKHook_PostThink, OnPlayerThink);
  1191. SDKUnhook(client, SDKHook_PostThinkPost, OnPlayerThink);
  1192.  
  1193. if (client == g_RecordBot)
  1194. {
  1195. StopPlayerMimic(client);
  1196. g_RecordBot = -1;
  1197. return;
  1198. }
  1199. if (client == g_BonusBot)
  1200. {
  1201. StopPlayerMimic(client);
  1202. g_BonusBot = -1;
  1203. return;
  1204. }
  1205.  
  1206. // Stop trail
  1207. g_bTrailOn[client] = false;
  1208.  
  1209.  
  1210. //Database
  1211. if (IsValidClient(client) && !g_bRenaming)
  1212. {
  1213. if (!g_bIgnoreZone[client] && !g_bPracticeMode[client])
  1214. db_insertLastPosition(client, g_szMapName, g_Stage[g_iClientInZone[client][2]][client], g_iClientInZone[client][2]);
  1215.  
  1216. db_updatePlayerOptions(client);
  1217. }
  1218.  
  1219. // Stop recording
  1220. if (g_hRecording[client] != null)
  1221. StopRecording(client);
  1222. }
  1223.  
  1224. public void OnSettingChanged(Handle convar, const char[] oldValue, const char[] newValue)
  1225. {
  1226. if (convar == g_hGoToServer)
  1227. {
  1228. g_bGoToServer = view_as<bool>(StringToInt(newValue[0]));
  1229. }
  1230. else if (convar == g_hCommandToEnd)
  1231. {
  1232. g_bCommandToEnd = view_as<bool>(StringToInt(newValue[0]));
  1233. }
  1234. else if (convar == g_hChallengePoints)
  1235. {
  1236. g_bChallengePoints = view_as<bool>(StringToInt(newValue[0]));
  1237. }
  1238. else if (convar == g_hNoClipS)
  1239. {
  1240. g_bNoClipS = view_as<bool>(StringToInt(newValue[0]));
  1241. }
  1242. else if (convar == g_hReplayBot)
  1243. {
  1244. g_bReplayBot = view_as<bool>(StringToInt(newValue[0]));
  1245. if (g_bReplayBot)
  1246. {
  1247. LoadReplays();
  1248. }
  1249. else
  1250. {
  1251. for (int i = 1; i <= MaxClients; i++)
  1252. if (IsValidClient(i))
  1253. {
  1254. if (i == g_RecordBot)
  1255. {
  1256. StopPlayerMimic(i);
  1257. KickClient(i);
  1258. g_bTrailOn[i] = false;
  1259. }
  1260. else
  1261. {
  1262. if (!g_bBonusReplay) // if both bots are off, no need to record
  1263. if (g_hRecording[i] != null)
  1264. StopRecording(i);
  1265. }
  1266. }
  1267. if (g_bInfoBot && g_bBonusReplay)
  1268. ServerCommand("bot_quota 2");
  1269. else
  1270. if (g_bInfoBot || g_bBonusReplay)
  1271. ServerCommand("bot_quota 1");
  1272. else
  1273. ServerCommand("bot_quota 0");
  1274. }
  1275. }
  1276. else if (convar == g_hBonusBot)
  1277. {
  1278. g_bBonusReplay = view_as<bool>(StringToInt(newValue[0]));
  1279. if (g_bBonusReplay)
  1280. {
  1281. LoadReplays();
  1282. }
  1283. else
  1284. {
  1285. for (int i = 1; i <= MaxClients; i++)
  1286. if (IsValidClient(i))
  1287. {
  1288. if (i == g_BonusBot)
  1289. {
  1290. StopPlayerMimic(i);
  1291. KickClient(i);
  1292. g_bTrailOn[i] = false;
  1293. }
  1294. else
  1295. {
  1296. if (!g_bReplayBot) // if both bots are off
  1297. if (g_hRecording[i] != null)
  1298. StopRecording(i);
  1299. }
  1300. }
  1301. if (g_bInfoBot && g_bReplayBot)
  1302. ServerCommand("bot_quota 2");
  1303. else
  1304. if (g_bInfoBot || g_bReplayBot)
  1305. ServerCommand("bot_quota 1");
  1306. else
  1307. ServerCommand("bot_quota 0");
  1308. }
  1309. }
  1310. else if (convar == g_hAdminClantag)
  1311. {
  1312. g_bAdminClantag = view_as<bool>(StringToInt(newValue[0]));
  1313. if (g_bAdminClantag)
  1314. {
  1315. for (int i = 1; i <= MaxClients; i++)
  1316. if (IsValidClient(i))
  1317. CreateTimer(0.0, SetClanTag, i, TIMER_FLAG_NO_MAPCHANGE);
  1318. }
  1319. else
  1320. {
  1321. for (int i = 1; i <= MaxClients; i++)
  1322. if (IsValidClient(i))
  1323. CreateTimer(0.0, SetClanTag, i, TIMER_FLAG_NO_MAPCHANGE);
  1324. }
  1325. }
  1326. else if (convar == g_hAutoTimer)
  1327. {
  1328. g_bAutoTimer = view_as<bool>(StringToInt(newValue[0]));
  1329. }
  1330. else if (convar == g_hColoredNames)
  1331. {
  1332. g_bColoredNames = view_as<bool>(StringToInt(newValue[0]));
  1333. }
  1334. else if (convar == g_hPauseServerside)
  1335. {
  1336. g_bPauseServerside = view_as<bool>(StringToInt(newValue[0]));
  1337. }
  1338. else if (convar == g_hDynamicTimelimit)
  1339. {
  1340. g_bDynamicTimelimit = view_as<bool>(StringToInt(newValue[0]));
  1341. }
  1342. else if (convar == g_hAutohealing_Hp)
  1343. g_Autohealing_Hp = StringToInt(newValue[0]);
  1344.  
  1345. else if (convar == g_hAutoRespawn)
  1346. {
  1347. g_bAutoRespawn = view_as<bool>(StringToInt(newValue[0]));
  1348. if (g_bAutoRespawn)
  1349. {
  1350. ServerCommand("mp_respawn_on_death_ct 1;mp_respawn_on_death_t 1;mp_respawnwavetime_ct 3.0;mp_respawnwavetime_t 3.0");
  1351. }
  1352. else
  1353. {
  1354. ServerCommand("mp_respawn_on_death_ct 0;mp_respawn_on_death_t 0");
  1355. }
  1356. }
  1357. else if (convar == g_hRadioCommands)
  1358. {
  1359. g_bRadioCommands = view_as<bool>(StringToInt(newValue[0]));
  1360. }
  1361. else if (convar == g_hcvarRestore)
  1362. {
  1363. g_bRestore = view_as<bool>(StringToInt(newValue[0]));
  1364. }
  1365. else if (convar == g_hMapEnd)
  1366. {
  1367. g_bMapEnd = view_as<bool>(StringToInt(newValue[0]));
  1368. }
  1369. else if (convar == g_hConnectMsg)
  1370. {
  1371. g_bConnectMsg = view_as<bool>(StringToInt(newValue[0]));
  1372. }
  1373. else if (convar == g_hDisconnectMsg)
  1374. {
  1375. g_bDisconnectMsg = view_as<bool>(StringToInt(newValue[0]));
  1376. }
  1377. else if (convar == g_hPlayerSkinChange)
  1378. {
  1379. g_bPlayerSkinChange = view_as<bool>(StringToInt(newValue[0]));
  1380. if (g_bPlayerSkinChange)
  1381. {
  1382. for (int i = 1; i <= MaxClients; i++)
  1383. if (IsValidClient(i))
  1384. {
  1385. if (i == g_RecordBot)
  1386. {
  1387. SetEntPropString(i, Prop_Send, "m_szArmsModel", g_sReplayBotPlayerModel);
  1388. SetEntityModel(i, g_sReplayBotPlayerModel);
  1389. }
  1390. else
  1391. {
  1392. SetEntPropString(i, Prop_Send, "m_szArmsModel", g_sArmModel);
  1393. SetEntityModel(i, g_sPlayerModel);
  1394. }
  1395. }
  1396. }
  1397. }
  1398. else if (convar == g_hPointSystem)
  1399. {
  1400. g_bPointSystem = view_as<bool>(StringToInt(newValue[0]));
  1401. if (g_bPointSystem)
  1402. {
  1403. for (int i = 1; i <= MaxClients; i++)
  1404. if (IsValidClient(i))
  1405. CreateTimer(0.0, SetClanTag, i, TIMER_FLAG_NO_MAPCHANGE);
  1406. }
  1407. else
  1408. {
  1409. for (int i = 1; i <= MaxClients; i++)
  1410. if (IsValidClient(i))
  1411. {
  1412. Format(g_pr_rankname[i], 128, "");
  1413. CreateTimer(0.0, SetClanTag, i, TIMER_FLAG_NO_MAPCHANGE);
  1414. }
  1415. }
  1416. }
  1417. else if (convar == g_hcvarNoBlock)
  1418. {
  1419. g_bNoBlock = view_as<bool>(StringToInt(newValue[0]));
  1420. if (g_bNoBlock)
  1421. {
  1422. for (int client = 1; client <= MAXPLAYERS; client++)
  1423. if (IsValidEntity(client))
  1424. SetEntData(client, FindSendPropInfo("CBaseEntity", "m_CollisionGroup"), 2, 4, true);
  1425.  
  1426. }
  1427. else
  1428. {
  1429. for (int client = 1; client <= MAXPLAYERS; client++)
  1430. if (IsValidEntity(client))
  1431. SetEntData(client, FindSendPropInfo("CBaseEntity", "m_CollisionGroup"), 5, 4, true);
  1432. }
  1433. }
  1434. else if (convar == g_hAttackSpamProtection)
  1435. {
  1436. g_bAttackSpamProtection = view_as<bool>(StringToInt(newValue[0]));
  1437. }
  1438. else if (convar == g_hCleanWeapons)
  1439. {
  1440. g_bCleanWeapons = view_as<bool>(StringToInt(newValue[0]));
  1441. if (g_bCleanWeapons)
  1442. {
  1443. char szclass[32];
  1444. for (int i = 1; i <= MaxClients; i++)
  1445. {
  1446. if (IsValidClient(i) && IsPlayerAlive(i))
  1447. {
  1448. for (int j = 0; j < 4; j++)
  1449. {
  1450. int weapon = GetPlayerWeaponSlot(i, j);
  1451. if (weapon != -1 && j != 2)
  1452. {
  1453. GetEdictClassname(weapon, szclass, sizeof(szclass));
  1454. RemovePlayerItem(i, weapon);
  1455. RemoveEdict(weapon);
  1456. int equipweapon = GetPlayerWeaponSlot(i, 2);
  1457. if (equipweapon != -1)
  1458. EquipPlayerWeapon(i, equipweapon);
  1459. }
  1460. }
  1461. }
  1462. }
  1463. }
  1464. }
  1465. else if (convar == g_hAutoBhopConVar)
  1466. {
  1467. g_bAutoBhopConVar = view_as<bool>(StringToInt(newValue[0]));
  1468. g_bAutoBhop = view_as<bool>(StringToInt(newValue[0]));
  1469. }
  1470. else if (convar == g_hCountry)
  1471. {
  1472. g_bCountry = view_as<bool>(StringToInt(newValue[0]));
  1473. if (g_bCountry)
  1474. {
  1475. for (int i = 1; i <= MaxClients; i++)
  1476. {
  1477. if (IsValidClient(i))
  1478. {
  1479. GetCountry(i);
  1480. if (g_bPointSystem)
  1481. CreateTimer(0.5, SetClanTag, i, TIMER_FLAG_NO_MAPCHANGE);
  1482. }
  1483. }
  1484. }
  1485. else
  1486. {
  1487. if (g_bPointSystem)
  1488. for (int i = 1; i <= MaxClients; i++)
  1489. if (IsValidClient(i))
  1490. CreateTimer(0.5, SetClanTag, i, TIMER_FLAG_NO_MAPCHANGE);
  1491. }
  1492. }
  1493. else if (convar == g_hExtraPoints)
  1494. {
  1495. g_ExtraPoints = StringToInt(newValue[0]);
  1496. }
  1497. else if (convar == g_hExtraPoints2)
  1498. {
  1499. g_ExtraPoints2 = StringToInt(newValue[0]);
  1500. }
  1501. else if (convar == g_hcvargodmode)
  1502. {
  1503. g_bgodmode = view_as<bool>(StringToInt(newValue[0]));
  1504. for (int i = 1; i <= MaxClients; i++)
  1505. {
  1506. if (IsValidClient(i))
  1507. {
  1508. if (g_bgodmode)
  1509. SetEntProp(i, Prop_Data, "m_takedamage", 0, 1);
  1510. else
  1511. SetEntProp(i, Prop_Data, "m_takedamage", 2, 1);
  1512. }
  1513. }
  1514. }
  1515. else if (convar == g_hInfoBot)
  1516. {
  1517. g_bInfoBot = view_as<bool>(StringToInt(newValue[0]));
  1518. if (g_bInfoBot)
  1519. {
  1520. LoadInfoBot();
  1521. }
  1522. else
  1523. {
  1524. for (int i = 1; i <= MaxClients; i++)
  1525. if (IsValidClient(i) && IsFakeClient(i))
  1526. {
  1527. if (i == g_InfoBot)
  1528. {
  1529. int count = 0;
  1530. g_InfoBot = -1;
  1531. KickClient(i);
  1532. char szBuffer[64];
  1533. if (g_bMapReplay)
  1534. count++;
  1535. if (g_bMapBonusReplay)
  1536. count++;
  1537. Format(szBuffer, sizeof(szBuffer), "bot_quota %i", count);
  1538. ServerCommand(szBuffer);
  1539. }
  1540. }
  1541. }
  1542. }
  1543. else if (convar == g_hReplayBotPlayerModel)
  1544. {
  1545. Format(g_sReplayBotPlayerModel, 256, "%s", newValue[0]);
  1546. PrecacheModel(newValue[0], true);
  1547. AddFileToDownloadsTable(g_sReplayBotPlayerModel);
  1548. if (g_RecordBot != -1)
  1549. SetEntityModel(g_RecordBot, newValue[0]);
  1550. }
  1551. else if (convar == g_hReplayBotArmModel)
  1552. {
  1553. Format(g_sReplayBotArmModel, 256, "%s", newValue[0]);
  1554. PrecacheModel(newValue[0], true);
  1555. AddFileToDownloadsTable(g_sReplayBotArmModel);
  1556. if (g_RecordBot != -1)
  1557. SetEntPropString(g_RecordBot, Prop_Send, "m_szArmsModel", newValue[0]);
  1558. }
  1559. else if (convar == g_hPlayerModel)
  1560. {
  1561. Format(g_sPlayerModel, 256, "%s", newValue[0]);
  1562. PrecacheModel(newValue[0], true);
  1563. AddFileToDownloadsTable(g_sPlayerModel);
  1564. if (!g_bPlayerSkinChange)
  1565. return;
  1566. for (int i = 1; i <= MaxClients; i++)
  1567. if (IsValidClient(i) && i != g_RecordBot)
  1568. SetEntityModel(i, newValue[0]);
  1569. }
  1570. else if (convar == g_hArmModel)
  1571. {
  1572. Format(g_sArmModel, 256, "%s", newValue[0]);
  1573. PrecacheModel(newValue[0], true);
  1574. AddFileToDownloadsTable(g_sArmModel);
  1575. if (!g_bPlayerSkinChange)
  1576. return;
  1577. for (int i = 1; i <= MaxClients; i++)
  1578. if (IsValidClient(i) && i != g_RecordBot)
  1579. SetEntPropString(i, Prop_Send, "m_szArmsModel", newValue[0]);
  1580. }
  1581. else if (convar == g_hWelcomeMsg)
  1582. {
  1583. Format(g_sWelcomeMsg, 512, "%s", newValue[0]);
  1584. }
  1585. else if (convar == g_hReplayBotColor)
  1586. {
  1587. char color[256];
  1588. Format(color, 256, "%s", newValue[0]);
  1589. GetRGBColor(0, color);
  1590. }
  1591. else if (convar == g_hBonusBotColor)
  1592. {
  1593. char color[256];
  1594. Format(color, 256, "%s", newValue[0]);
  1595. GetRGBColor(1, color);
  1596. }
  1597. else if (convar == g_hReplayBotTrailColor)
  1598. {
  1599. char color[24];
  1600. Format(color, 24, "%s", newValue);
  1601. StringRGBtoInt(color, g_ReplayBotTrailColor);
  1602. }
  1603. else if (convar == g_hBonusBotTrailColor)
  1604. {
  1605. char color[24];
  1606. Format(color, 24, "%s", newValue);
  1607. StringRGBtoInt(color, g_BonusBotTrailColor);
  1608. }
  1609. else if (convar == g_hAllowRoundEndCvar)
  1610. {
  1611. g_bAllowRoundEndCvar = view_as<bool>(StringToInt(newValue[0]));
  1612. if (g_bAllowRoundEndCvar)
  1613. {
  1614. ServerCommand("mp_ignore_round_win_conditions 0");
  1615. }
  1616. else
  1617. {
  1618. ServerCommand("mp_ignore_round_win_conditions 1;mp_maxrounds 1");
  1619. }
  1620. }
  1621. else if (convar == g_hChecker)
  1622. {
  1623. g_fChecker = StringToFloat(newValue[0]);
  1624. }
  1625. else if (convar == g_hZoneDisplayType)
  1626. {
  1627. g_zoneDisplayType = StringToInt(newValue[0]);
  1628. }
  1629. else if (convar == g_hZonesToDisplay)
  1630. {
  1631. g_zonesToDisplay = StringToInt(newValue[0]);
  1632. }
  1633. else if (convar == g_hzoneStartColor)
  1634. {
  1635. char color[24];
  1636. Format(color, 28, "%s", newValue[0]);
  1637. StringRGBtoInt(color, g_zoneStartColor);
  1638. }
  1639. else if (convar == g_hzoneEndColor)
  1640. {
  1641. char color[24];
  1642. Format(color, 28, "%s", newValue[0]);
  1643. StringRGBtoInt(color, g_zoneEndColor);
  1644. }
  1645. else if (convar == g_hzoneCheckerColor)
  1646. {
  1647. char color[24];
  1648. Format(color, 28, "%s", newValue[0]);
  1649. StringRGBtoInt(color, g_zoneCheckerColor);
  1650. }
  1651. else if (convar == g_hzoneBonusStartColor)
  1652. {
  1653. char color[24];
  1654. Format(color, 28, "%s", newValue[0]);
  1655. StringRGBtoInt(color, g_zoneBonusStartColor);
  1656. }
  1657. else if (convar == g_hzoneBonusEndColor)
  1658. {
  1659. char color[24];
  1660. Format(color, 28, "%s", newValue[0]);
  1661. StringRGBtoInt(color, g_zoneBonusEndColor);
  1662. }
  1663. else if (convar == g_hzoneStageColor)
  1664. {
  1665. char color[24];
  1666. Format(color, 28, "%s", newValue[0]);
  1667. StringRGBtoInt(color, g_zoneStageColor);
  1668. }
  1669. else if (convar == g_hzoneCheckpointColor)
  1670. {
  1671. char color[24];
  1672. Format(color, 28, "%s", newValue[0]);
  1673. StringRGBtoInt(color, g_zoneCheckpointColor);
  1674. }
  1675. else if (convar == g_hzoneSpeedColor)
  1676. {
  1677. char color[24];
  1678. Format(color, 28, "%s", newValue[0]);
  1679. StringRGBtoInt(color, g_zoneSpeedColor);
  1680. }
  1681. else if (convar == g_hzoneTeleToStartColor)
  1682. {
  1683. char color[24];
  1684. Format(color, 28, "%s", newValue[0]);
  1685. StringRGBtoInt(color, g_zoneTeleToStartColor);
  1686. }
  1687. else if (convar == g_hzoneValidatorColor)
  1688. {
  1689. char color[24];
  1690. Format(color, 28, "%s", newValue[0]);
  1691. StringRGBtoInt(color, g_zoneValidatorColor);
  1692. }
  1693. else if (convar == g_hzoneStopColor)
  1694. {
  1695. char color[24];
  1696. Format(color, 28, "%s", newValue[0]);
  1697. StringRGBtoInt(color, g_zoneStopColor);
  1698. }
  1699. else if (convar == g_hStartPreSpeed) {
  1700. g_fStartPreSpeed = StringToFloat(newValue[0]);
  1701. }
  1702. else if (convar == g_hSpeedPreSpeed) {
  1703. g_fSpeedPreSpeed = StringToFloat(newValue[0]);
  1704. }
  1705. else if (convar == g_hBonusPreSpeed) {
  1706. g_fBonusPreSpeed = StringToFloat(newValue[0]);
  1707. }
  1708. else if (convar == g_hSpawnToStartZone) {
  1709. bSpawnToStartZone = view_as<bool>(StringToInt(newValue[0]));
  1710. }
  1711. else if (convar == g_hSoundEnabled) {
  1712. bSoundEnabled = view_as<bool>(StringToInt(newValue[0]));
  1713. }
  1714. else if (convar == g_hSoundPath) {
  1715. strcopy(sSoundPath, sizeof(sSoundPath), newValue);
  1716. }
  1717. else if (convar == g_hAnnounceRank) {
  1718. g_AnnounceRank = StringToInt(newValue[0]);
  1719. }
  1720. else if (convar == g_hAnnounceRecord) {
  1721. g_iAnnounceRecord = StringToInt(newValue[0]);
  1722. }
  1723. else if (convar == g_hForceCT) {
  1724. g_bForceCT = view_as<bool>(StringToInt(newValue[0]));
  1725. }
  1726. else if (convar == g_hChatSpamFilter) {
  1727. g_fChatSpamFilter = StringToFloat(newValue[0]);
  1728. }
  1729. else if (convar == g_henableChatProcessing) {
  1730. g_benableChatProcessing = view_as<bool>(StringToInt(newValue[0]));
  1731. }
  1732. else if (convar == g_hMultiServerMapcycle)
  1733. {
  1734. g_bMultiServerMapcycle = view_as<bool>(StringToInt(newValue[0]));
  1735. }
  1736. else if (convar == g_hRecordBotTrail) {
  1737. g_bRecordBotTrailEnabled = view_as<bool>(StringToInt(newValue[0]));
  1738. }
  1739. else if (convar == g_hBonusBotTrail) {
  1740. g_bBonusReplayTrailEnabled = view_as<bool>(StringToInt(newValue[0]));
  1741. }
  1742. else if (convar == g_hTriggerPushFixEnable) {
  1743. g_bTriggerPushFixEnable = view_as<bool>(StringToInt(newValue));
  1744. }
  1745. else if (convar == g_hSlopeFixEnable) {
  1746. g_bSlopeFixEnable = view_as<bool>(StringToInt(newValue));
  1747. }
  1748. else if (convar == g_hAutoVIPFlag) {
  1749. AdminFlag flag;
  1750. g_bAutoVIPFlag = FindFlagByChar(newValue[0], flag);
  1751. g_AutoVIPFlag = FlagToBit(flag);
  1752. if (!g_bAutoVIPFlag)
  1753. PrintToServer("[ckSurf] Invalid flag for ck_autovip_flag");
  1754. }
  1755. else if (convar == g_hZoneMenuFlag) {
  1756. AdminFlag flag;
  1757. bool validFlag;
  1758. validFlag = FindFlagByChar(newValue[0], flag);
  1759.  
  1760. if (!validFlag)
  1761. {
  1762. PrintToServer("[ckSurf] Invalid flag for ck_zonemenu_flag");
  1763. g_ZoneMenuFlag = ADMFLAG_ROOT;
  1764. }
  1765. else
  1766. g_ZoneMenuFlag = FlagToBit(flag);
  1767. }
  1768. else if (convar == g_hAdminMenuFlag) {
  1769. AdminFlag flag;
  1770. bool validFlag;
  1771. validFlag = FindFlagByChar(newValue[0], flag);
  1772.  
  1773. if (!validFlag)
  1774. {
  1775. PrintToServer("[ckSurf] Invalid flag for ck_adminmenu_flag");
  1776. g_AdminMenuFlag = ADMFLAG_GENERIC;
  1777. }
  1778. else
  1779. g_AdminMenuFlag = FlagToBit(flag);
  1780. }
  1781. else if (convar == g_hVoteExtendTime) {
  1782. g_fVoteExtendTime = StringToFloat(newValue[0]);
  1783. }
  1784. else if (convar == g_hMaxVoteExtends) {
  1785. g_MaxVoteExtends = StringToInt(newValue[0]);
  1786. }
  1787. else if (convar == g_hDoubleRestartCommand) {
  1788. g_bDoubleRestartCommand = view_as<bool>(StringToInt(newValue));
  1789. }
  1790. else if (convar == g_hServerVipCommand) {
  1791. g_bServerVipCommand = view_as<bool>(StringToInt(newValue));
  1792. }
  1793.  
  1794. if (g_hZoneTimer != INVALID_HANDLE)
  1795. {
  1796. KillTimer(g_hZoneTimer);
  1797. g_hZoneTimer = INVALID_HANDLE;
  1798. }
  1799.  
  1800.  
  1801. g_hZoneTimer = CreateTimer(g_fChecker, BeamBoxAll, _, TIMER_REPEAT);
  1802.  
  1803. }
  1804.  
  1805. public void OnPluginStart()
  1806. {
  1807. g_bServerDataLoaded = false;
  1808.  
  1809. //Get Server Tickate
  1810. float fltickrate = 1.0 / GetTickInterval();
  1811. if (fltickrate > 65)
  1812. if (fltickrate < 103)
  1813. g_Server_Tickrate = 102;
  1814. else
  1815. g_Server_Tickrate = 128;
  1816. else
  1817. g_Server_Tickrate = 64;
  1818.  
  1819. //language file
  1820. LoadTranslations("ckSurf.phrases");
  1821.  
  1822. CreateConVar("ckSurf_version", VERSION, "ckSurf Version.", FCVAR_DONTRECORD | FCVAR_SPONLY | FCVAR_REPLICATED | FCVAR_NOTIFY);
  1823.  
  1824. g_hConnectMsg = CreateConVar("ck_connect_msg", "1", "on/off - Enables a player connect message with country", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  1825. g_bConnectMsg = GetConVarBool(g_hConnectMsg);
  1826. HookConVarChange(g_hConnectMsg, OnSettingChanged);
  1827.  
  1828. g_hAllowRoundEndCvar = CreateConVar("ck_round_end", "0", "on/off - Allows to end the current round", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  1829. g_bAllowRoundEndCvar = GetConVarBool(g_hAllowRoundEndCvar);
  1830. HookConVarChange(g_hAllowRoundEndCvar, OnSettingChanged);
  1831.  
  1832. g_hDisconnectMsg = CreateConVar("ck_disconnect_msg", "1", "on/off - Enables a player disconnect message in chat", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  1833. g_bDisconnectMsg = GetConVarBool(g_hDisconnectMsg);
  1834. HookConVarChange(g_hDisconnectMsg, OnSettingChanged);
  1835.  
  1836. g_hMapEnd = CreateConVar("ck_map_end", "1", "on/off - Allows map changes after the timelimit has run out (mp_timelimit must be greater than 0)", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  1837. g_bMapEnd = GetConVarBool(g_hMapEnd);
  1838. HookConVarChange(g_hMapEnd, OnSettingChanged);
  1839.  
  1840. g_hColoredNames = CreateConVar("ck_colored_chatnames", "0", "on/off Colors players names based on their rank in chat.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  1841. g_bColoredNames = GetConVarBool(g_hColoredNames);
  1842. HookConVarChange(g_hColoredNames, OnSettingChanged);
  1843.  
  1844. g_hReplayBot = CreateConVar("ck_replay_bot", "1", "on/off - Bots mimic the local map record", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  1845. g_bReplayBot = GetConVarBool(g_hReplayBot);
  1846. HookConVarChange(g_hReplayBot, OnSettingChanged);
  1847.  
  1848. g_hBonusBot = CreateConVar("ck_bonus_bot", "1", "on/off - Bots mimic the local bonus record", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  1849. g_bBonusReplay = GetConVarBool(g_hBonusBot);
  1850. HookConVarChange(g_hBonusBot, OnSettingChanged);
  1851.  
  1852. g_hInfoBot = CreateConVar("ck_info_bot", "0", "on/off - provides information about nextmap and timeleft in his player name", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  1853. g_bInfoBot = GetConVarBool(g_hInfoBot);
  1854. HookConVarChange(g_hInfoBot, OnSettingChanged);
  1855.  
  1856. g_hNoClipS = CreateConVar("ck_noclip", "1", "on/off - Allows players to use noclip", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  1857. g_bNoClipS = GetConVarBool(g_hNoClipS);
  1858. HookConVarChange(g_hNoClipS, OnSettingChanged);
  1859.  
  1860. g_hAdminClantag = CreateConVar("ck_admin_clantag", "1", "on/off - Admin clan tag (necessary flag: b - z)", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  1861. g_bAdminClantag = GetConVarBool(g_hAdminClantag);
  1862. HookConVarChange(g_hAdminClantag, OnSettingChanged);
  1863.  
  1864. g_hAutoTimer = CreateConVar("ck_auto_timer", "0", "on/off - Timer automatically starts when a player joins a team, dies or uses !start/!r", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  1865. g_bAutoTimer = GetConVarBool(g_hAutoTimer);
  1866. HookConVarChange(g_hAutoTimer, OnSettingChanged);
  1867.  
  1868. g_hGoToServer = CreateConVar("ck_goto", "1", "on/off - Allows players to use the !goto command", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  1869. g_bGoToServer = GetConVarBool(g_hGoToServer);
  1870. HookConVarChange(g_hGoToServer, OnSettingChanged);
  1871.  
  1872. g_hCommandToEnd = CreateConVar("ck_end", "1", "on/off - Allows players to use the !end command", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  1873. g_bCommandToEnd = GetConVarBool(g_hCommandToEnd);
  1874. HookConVarChange(g_hCommandToEnd, OnSettingChanged);
  1875.  
  1876. g_hcvargodmode = CreateConVar("ck_godmode", "1", "on/off - unlimited hp", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  1877. g_bgodmode = GetConVarBool(g_hcvargodmode);
  1878. HookConVarChange(g_hcvargodmode, OnSettingChanged);
  1879.  
  1880. g_hPauseServerside = CreateConVar("ck_pause", "1", "on/off - Allows players to use the !pause command", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  1881. g_bPauseServerside = GetConVarBool(g_hPauseServerside);
  1882. HookConVarChange(g_hPauseServerside, OnSettingChanged);
  1883.  
  1884. g_hcvarRestore = CreateConVar("ck_restore", "1", "on/off - Restoring of time and last position after reconnect", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  1885. g_bRestore = GetConVarBool(g_hcvarRestore);
  1886. HookConVarChange(g_hcvarRestore, OnSettingChanged);
  1887.  
  1888. g_hcvarNoBlock = CreateConVar("ck_noblock", "1", "on/off - Player no blocking", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  1889. g_bNoBlock = GetConVarBool(g_hcvarNoBlock);
  1890. HookConVarChange(g_hcvarNoBlock, OnSettingChanged);
  1891.  
  1892. g_hAttackSpamProtection = CreateConVar("ck_attack_spam_protection", "1", "on/off - max 40 shots; +5 new/extra shots per minute; 1 he/flash counts like 9 shots", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  1893. g_bAttackSpamProtection = GetConVarBool(g_hAttackSpamProtection);
  1894. HookConVarChange(g_hAttackSpamProtection, OnSettingChanged);
  1895.  
  1896. g_hAutoRespawn = CreateConVar("ck_autorespawn", "1", "on/off - Auto respawn", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  1897. g_bAutoRespawn = GetConVarBool(g_hAutoRespawn);
  1898. HookConVarChange(g_hAutoRespawn, OnSettingChanged);
  1899.  
  1900. g_hRadioCommands = CreateConVar("ck_use_radio", "0", "on/off - Allows players to use radio commands", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  1901. g_bRadioCommands = GetConVarBool(g_hRadioCommands);
  1902. HookConVarChange(g_hRadioCommands, OnSettingChanged);
  1903.  
  1904. g_hAutohealing_Hp = CreateConVar("ck_autoheal", "50", "Sets HP amount for autohealing (requires ck_godmode 0)", FCVAR_NOTIFY, true, 0.0, true, 100.0);
  1905. g_Autohealing_Hp = GetConVarInt(g_hAutohealing_Hp);
  1906. HookConVarChange(g_hAutohealing_Hp, OnSettingChanged);
  1907.  
  1908. g_hCleanWeapons = CreateConVar("ck_clean_weapons", "1", "on/off - Removes all weapons on the ground", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  1909. g_bCleanWeapons = GetConVarBool(g_hCleanWeapons);
  1910. HookConVarChange(g_hCleanWeapons, OnSettingChanged);
  1911.  
  1912. g_hCountry = CreateConVar("ck_country_tag", "1", "on/off - Country clan tag", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  1913. g_bCountry = GetConVarBool(g_hCountry);
  1914. HookConVarChange(g_hCountry, OnSettingChanged);
  1915.  
  1916. g_hChallengePoints = CreateConVar("ck_challenge_points", "1", "on/off - Allows players to bet points on their challenges", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  1917. g_bChallengePoints = GetConVarBool(g_hChallengePoints);
  1918. HookConVarChange(g_hChallengePoints, OnSettingChanged);
  1919.  
  1920. g_hAutoBhopConVar = CreateConVar("ck_auto_bhop", "1", "on/off - AutoBhop on surf_ maps", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  1921. g_bAutoBhopConVar = GetConVarBool(g_hAutoBhopConVar);
  1922. HookConVarChange(g_hAutoBhopConVar, OnSettingChanged);
  1923.  
  1924. g_hDynamicTimelimit = CreateConVar("ck_dynamic_timelimit", "0", "on/off - Sets a suitable timelimit by calculating the average run time (This method requires ck_map_end 1, greater than 5 map times and a default timelimit in your server config for maps with less than 5 times", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  1925. g_bDynamicTimelimit = GetConVarBool(g_hDynamicTimelimit);
  1926. HookConVarChange(g_hDynamicTimelimit, OnSettingChanged);
  1927.  
  1928. g_hExtraPoints = CreateConVar("ck_ranking_extra_points_improvements", "15.0", "Gives players x extra points for improving their time.", FCVAR_NOTIFY, true, 0.0, true, 100.0);
  1929. g_ExtraPoints = GetConVarInt(g_hExtraPoints);
  1930. HookConVarChange(g_hExtraPoints, OnSettingChanged);
  1931.  
  1932. g_hExtraPoints2 = CreateConVar("ck_ranking_extra_points_firsttime", "50.0", "Gives players x extra points for finishing a map for the first time.", FCVAR_NOTIFY, true, 0.0, true, 100.0);
  1933. g_ExtraPoints2 = GetConVarInt(g_hExtraPoints2);
  1934. HookConVarChange(g_hExtraPoints2, OnSettingChanged);
  1935.  
  1936. g_hPointSystem = CreateConVar("ck_point_system", "1", "on/off - Player point system", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  1937. g_bPointSystem = GetConVarBool(g_hPointSystem);
  1938. HookConVarChange(g_hPointSystem, OnSettingChanged);
  1939.  
  1940. g_hPlayerSkinChange = CreateConVar("ck_custom_models", "1", "on/off - Allows ckSurf to change the models of players and bots", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  1941. g_bPlayerSkinChange = GetConVarBool(g_hPlayerSkinChange);
  1942. HookConVarChange(g_hPlayerSkinChange, OnSettingChanged);
  1943.  
  1944. g_hReplayBotPlayerModel = CreateConVar("ck_replay_bot_skin", "models/player/tm_professional_var1.mdl", "Replay pro bot skin", FCVAR_NOTIFY);
  1945. GetConVarString(g_hReplayBotPlayerModel, g_sReplayBotPlayerModel, 256);
  1946. HookConVarChange(g_hReplayBotPlayerModel, OnSettingChanged);
  1947.  
  1948. g_hReplayBotArmModel = CreateConVar("ck_replay_bot_arm_skin", "models/weapons/t_arms_professional.mdl", "Replay pro bot arm skin", FCVAR_NOTIFY);
  1949. GetConVarString(g_hReplayBotArmModel, g_sReplayBotArmModel, 256);
  1950. HookConVarChange(g_hReplayBotArmModel, OnSettingChanged);
  1951.  
  1952. g_hPlayerModel = CreateConVar("ck_player_skin", "models/player/ctm_sas_varianta.mdl", "Player skin", FCVAR_NOTIFY);
  1953. GetConVarString(g_hPlayerModel, g_sPlayerModel, 256);
  1954. HookConVarChange(g_hPlayerModel, OnSettingChanged);
  1955.  
  1956. g_hArmModel = CreateConVar("ck_player_arm_skin", "models/weapons/ct_arms_sas.mdl", "Player arm skin", FCVAR_NOTIFY);
  1957. GetConVarString(g_hArmModel, g_sArmModel, 256);
  1958. HookConVarChange(g_hArmModel, OnSettingChanged);
  1959.  
  1960.  
  1961. g_hWelcomeMsg = CreateConVar("ck_welcome_msg", " {yellow}>>{default} {grey}Welcome! This server is using {lime}ckSurf", "Welcome message (supported color tags: {default}, {darkred}, {green}, {lightgreen}, {blue} {olive}, {lime}, {red}, {purple}, {grey}, {yellow}, {lightblue}, {steelblue}, {darkblue}, {pink}, {lightred})", FCVAR_NOTIFY);
  1962. GetConVarString(g_hWelcomeMsg, g_sWelcomeMsg, 512);
  1963. HookConVarChange(g_hWelcomeMsg, OnSettingChanged);
  1964.  
  1965. g_hReplayBotColor = CreateConVar("ck_replay_bot_color", "52 91 248", "The default replay bot color - Format: \"red green blue\" from 0 - 255.", FCVAR_NOTIFY);
  1966. HookConVarChange(g_hReplayBotColor, OnSettingChanged);
  1967. char szRBotColor[256];
  1968. GetConVarString(g_hReplayBotColor, szRBotColor, 256);
  1969. GetRGBColor(0, szRBotColor);
  1970.  
  1971. g_hBonusBotColor = CreateConVar("ck_bonus_bot_color", "255 255 20", "The bonus replay bot color - Format: \"red green blue\" from 0 - 255.", FCVAR_NOTIFY);
  1972. HookConVarChange(g_hBonusBotColor, OnSettingChanged);
  1973. szRBotColor = "";
  1974. GetConVarString(g_hBonusBotColor, szRBotColor, 256);
  1975. GetRGBColor(1, szRBotColor);
  1976.  
  1977. g_hReplayBotTrailColor = CreateConVar("ck_replay_bot_trail_color", "52 91 248", "The trail color for the replay bot - Format: \"red green blue\" from 0 - 255.", FCVAR_NOTIFY);
  1978. HookConVarChange(g_hReplayBotTrailColor, OnSettingChanged);
  1979. char szTrailColor[24];
  1980. GetConVarString(g_hReplayBotTrailColor, szTrailColor, 24);
  1981. StringRGBtoInt(szTrailColor, g_ReplayBotTrailColor);
  1982.  
  1983. g_hBonusBotTrailColor = CreateConVar("ck_bonus_bot_trail_color", "255 255 20", "The trail color for the bonus bot - Format: \"red green blue\" from 0 - 255.", FCVAR_NOTIFY);
  1984. HookConVarChange(g_hBonusBotTrailColor, OnSettingChanged);
  1985. szTrailColor = "";
  1986. GetConVarString(g_hBonusBotTrailColor, szTrailColor, 24);
  1987. StringRGBtoInt(szTrailColor, g_BonusBotTrailColor);
  1988.  
  1989. g_hChecker = CreateConVar("ck_zone_checker", "5.0", "The duration in seconds when the beams around zones are refreshed.", FCVAR_NOTIFY);
  1990. g_fChecker = GetConVarFloat(g_hChecker);
  1991. HookConVarChange(g_hChecker, OnSettingChanged);
  1992.  
  1993. g_hZoneDisplayType = CreateConVar("ck_zone_drawstyle", "1", "0 = Do not display zones, 1 = display the lower edges of zones, 2 = display whole zones", FCVAR_NOTIFY);
  1994. g_zoneDisplayType = GetConVarInt(g_hZoneDisplayType);
  1995. HookConVarChange(g_hZoneDisplayType, OnSettingChanged);
  1996.  
  1997. g_hZonesToDisplay = CreateConVar("ck_zone_drawzones", "1", "Which zones are visible for players. 1 = draw start & end zones, 2 = draw start, end, stage and bonus zones, 3 = draw all zones.", FCVAR_NOTIFY);
  1998. g_zonesToDisplay = GetConVarInt(g_hZonesToDisplay);
  1999. HookConVarChange(g_hZonesToDisplay, OnSettingChanged);
  2000.  
  2001. g_hzoneStartColor = CreateConVar("ck_zone_startcolor", "000 255 000", "The color of START zones \"red green blue\" from 0 - 255", FCVAR_NOTIFY);
  2002. GetConVarString(g_hzoneStartColor, g_szzoneStartColor, 24);
  2003. StringRGBtoInt(g_szzoneStartColor, g_zoneStartColor);
  2004. HookConVarChange(g_hzoneStartColor, OnSettingChanged);
  2005.  
  2006. g_hzoneEndColor = CreateConVar("ck_zone_endcolor", "255 000 000", "The color of END zones \"red green blue\" from 0 - 255", FCVAR_NOTIFY);
  2007. GetConVarString(g_hzoneEndColor, g_szzoneEndColor, 24);
  2008. StringRGBtoInt(g_szzoneEndColor, g_zoneEndColor);
  2009. HookConVarChange(g_hzoneEndColor, OnSettingChanged);
  2010.  
  2011. g_hzoneCheckerColor = CreateConVar("ck_zone_checkercolor", "255 255 000", "The color of CHECKER zones \"red green blue\" from 0 - 255", FCVAR_NOTIFY);
  2012. GetConVarString(g_hzoneCheckerColor, g_szzoneCheckerColor, 24);
  2013. StringRGBtoInt(g_szzoneCheckerColor, g_zoneCheckerColor);
  2014. HookConVarChange(g_hzoneCheckerColor, OnSettingChanged);
  2015.  
  2016. g_hzoneBonusStartColor = CreateConVar("ck_zone_bonusstartcolor", "000 255 255", "The color of BONUS START zones \"red green blue\" from 0 - 255", FCVAR_NOTIFY);
  2017. GetConVarString(g_hzoneBonusStartColor, g_szzoneBonusStartColor, 24);
  2018. StringRGBtoInt(g_szzoneBonusStartColor, g_zoneBonusStartColor);
  2019. HookConVarChange(g_hzoneBonusStartColor, OnSettingChanged);
  2020.  
  2021. g_hzoneBonusEndColor = CreateConVar("ck_zone_bonusendcolor", "255 000 255", "The color of BONUS END zones \"red green blue\" from 0 - 255", FCVAR_NOTIFY);
  2022. GetConVarString(g_hzoneBonusEndColor, g_szzoneBonusEndColor, 24);
  2023. StringRGBtoInt(g_szzoneBonusEndColor, g_zoneBonusEndColor);
  2024. HookConVarChange(g_hzoneBonusEndColor, OnSettingChanged);
  2025.  
  2026. g_hzoneStageColor = CreateConVar("ck_zone_stagecolor", "000 000 255", "The color of STAGE zones \"red green blue\" from 0 - 255", FCVAR_NOTIFY);
  2027. GetConVarString(g_hzoneStageColor, g_szzoneStageColor, 24);
  2028. StringRGBtoInt(g_szzoneStageColor, g_zoneStageColor);
  2029. HookConVarChange(g_hzoneStageColor, OnSettingChanged);
  2030.  
  2031. g_hzoneCheckpointColor = CreateConVar("ck_zone_checkpointcolor", "000 000 255", "The color of CHECKPOINT zones \"red green blue\" from 0 - 255", FCVAR_NOTIFY);
  2032. GetConVarString(g_hzoneCheckpointColor, g_szzoneCheckpointColor, 24);
  2033. StringRGBtoInt(g_szzoneCheckpointColor, g_zoneCheckpointColor);
  2034. HookConVarChange(g_hzoneCheckpointColor, OnSettingChanged);
  2035.  
  2036. g_hzoneSpeedColor = CreateConVar("ck_zone_speedcolor", "255 000 000", "The color of SPEED zones \"red green blue\" from 0 - 255", FCVAR_NOTIFY);
  2037. GetConVarString(g_hzoneSpeedColor, g_szzoneSpeedColor, 24);
  2038. StringRGBtoInt(g_szzoneSpeedColor, g_zoneSpeedColor);
  2039. HookConVarChange(g_hzoneSpeedColor, OnSettingChanged);
  2040.  
  2041. g_hzoneTeleToStartColor = CreateConVar("ck_zone_teletostartcolor", "255 255 000", "The color of TELETOSTART zones \"red green blue\" from 0 - 255", FCVAR_NOTIFY);
  2042. GetConVarString(g_hzoneTeleToStartColor, g_szzoneTeleToStartColor, 24);
  2043. StringRGBtoInt(g_szzoneTeleToStartColor, g_zoneTeleToStartColor);
  2044. HookConVarChange(g_hzoneTeleToStartColor, OnSettingChanged);
  2045.  
  2046. g_hzoneValidatorColor = CreateConVar("ck_zone_validatorcolor", "255 255 255", "The color of VALIDATOR zones \"red green blue\" from 0 - 255", FCVAR_NOTIFY);
  2047. GetConVarString(g_hzoneValidatorColor, g_szzoneValidatorColor, 24);
  2048. StringRGBtoInt(g_szzoneValidatorColor, g_zoneValidatorColor);
  2049. HookConVarChange(g_hzoneValidatorColor, OnSettingChanged);
  2050.  
  2051. g_hzoneStopColor = CreateConVar("ck_zone_stopcolor", "000 000 000", "The color of CHECKER zones \"red green blue\" from 0 - 255", FCVAR_NOTIFY);
  2052. GetConVarString(g_hzoneStopColor, g_szzoneStopColor, 24);
  2053. StringRGBtoInt(g_szzoneStopColor, g_zoneStopColor);
  2054. HookConVarChange(g_hzoneStopColor, OnSettingChanged);
  2055.  
  2056. g_hStartPreSpeed = CreateConVar("ck_pre_start_speed", "320.0", "The maximum prespeed for start zones. 0.0 = No cap", FCVAR_NOTIFY, true, 0.0, true, 3500.0);
  2057. g_fStartPreSpeed = GetConVarFloat(g_hStartPreSpeed);
  2058. HookConVarChange(g_hStartPreSpeed, OnSettingChanged);
  2059.  
  2060. g_hSpeedPreSpeed = CreateConVar("ck_pre_speed_speed", "3000.0", "The maximum prespeed for speed start zones. 0.0 = No cap", FCVAR_NOTIFY, true, 0.0, true, 3500.0);
  2061. g_fSpeedPreSpeed = GetConVarFloat(g_hSpeedPreSpeed);
  2062. HookConVarChange(g_hSpeedPreSpeed, OnSettingChanged);
  2063.  
  2064. g_hBonusPreSpeed = CreateConVar("ck_pre_bonus_speed", "320.0", "The maximum prespeed for bonus start zones. 0.0 = No cap", FCVAR_NOTIFY, true, 0.0, true, 3500.0);
  2065. g_fBonusPreSpeed = GetConVarFloat(g_hBonusPreSpeed);
  2066. HookConVarChange(g_hBonusPreSpeed, OnSettingChanged);
  2067.  
  2068. g_hSpawnToStartZone = CreateConVar("ck_spawn_to_start_zone", "1.0", "1 = Automatically spawn to the start zone when the client joins the team.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  2069. bSpawnToStartZone = GetConVarBool(g_hSpawnToStartZone);
  2070. HookConVarChange(g_hSpawnToStartZone, OnSettingChanged);
  2071.  
  2072. g_hSoundEnabled = CreateConVar("ck_startzone_sound_enabled", "1.0", "Enable the sound after leaving the start zone.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  2073. bSoundEnabled = GetConVarBool(g_hSoundEnabled);
  2074. HookConVarChange(g_hSoundEnabled, OnSettingChanged);
  2075.  
  2076. g_hSoundPath = CreateConVar("ck_startzone_sound_path", "buttons\\button3.wav", "The path to the sound file that plays after the client leaves the start zone..", FCVAR_NOTIFY);
  2077. GetConVarString(g_hSoundPath, sSoundPath, sizeof(sSoundPath));
  2078. HookConVarChange(g_hSoundPath, OnSettingChanged);
  2079.  
  2080. g_hAnnounceRank = CreateConVar("ck_min_rank_announce", "0", "Higher ranks than this won't be announced to the everyone on the server. 0 = Announce all records.", FCVAR_NOTIFY, true, 0.0);
  2081. g_AnnounceRank = GetConVarInt(g_hAnnounceRank);
  2082. HookConVarChange(g_hAnnounceRank, OnSettingChanged);
  2083.  
  2084. g_hAnnounceRecord = CreateConVar("ck_chat_record_type", "0", "0: Announce all times to chat, 1: Only announce PB's to chat, 2: Only announce SR's to chat", FCVAR_NOTIFY, true, 0.0, true, 2.0);
  2085. g_iAnnounceRecord = GetConVarInt(g_hAnnounceRecord);
  2086. HookConVarChange(g_hAnnounceRecord, OnSettingChanged);
  2087.  
  2088. g_hForceCT = CreateConVar("ck_force_players_ct", "0", "Forces all players to join the CT team.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  2089. g_bForceCT = GetConVarBool(g_hForceCT);
  2090. HookConVarChange(g_hForceCT, OnSettingChanged);
  2091.  
  2092. g_hChatSpamFilter = CreateConVar("ck_chat_spamprotection_time", "1.0", "The frequency in seconds that players are allowed to send chat messages. 0.0 = No chat cap.", FCVAR_NOTIFY, true, 0.0);
  2093. g_fChatSpamFilter = GetConVarFloat(g_hChatSpamFilter);
  2094. HookConVarChange(g_hChatSpamFilter, OnSettingChanged);
  2095.  
  2096. g_henableChatProcessing = CreateConVar("ck_chat_enable", "1", "(1 / 0) Enable or disable ckSurfs chat processing.", FCVAR_NOTIFY);
  2097. g_benableChatProcessing = GetConVarBool(g_henableChatProcessing);
  2098. HookConVarChange(g_henableChatProcessing, OnSettingChanged);
  2099.  
  2100. g_hMultiServerMapcycle = CreateConVar("ck_multi_server_mapcycle", "0", "0 = Use mapcycle.txt to load servers maps, 1 = use configs/ckSurf/multi_server_mapcycle.txt to load maps", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  2101. g_bMultiServerMapcycle = GetConVarBool(g_hMultiServerMapcycle);
  2102. HookConVarChange(g_hMultiServerMapcycle, OnSettingChanged);
  2103.  
  2104. g_hBonusBotTrail = CreateConVar("ck_bonus_bot_trail", "1", "(1 / 0) Enables a trail on the bonus bot.", FCVAR_NOTIFY);
  2105. g_bBonusReplayTrailEnabled = GetConVarBool(g_hBonusBotTrail);
  2106. HookConVarChange(g_hBonusBotTrail, OnSettingChanged);
  2107.  
  2108. g_hRecordBotTrail = CreateConVar("ck_record_bot_trail", "1", "(1 / 0) Enables a trail on the record bot.", FCVAR_NOTIFY);
  2109. g_bRecordBotTrailEnabled = GetConVarBool(g_hRecordBotTrail);
  2110. HookConVarChange(g_hRecordBotTrail, OnSettingChanged);
  2111.  
  2112. g_hTriggerPushFixEnable = CreateConVar("ck_triggerpushfix_enable", "1", "Enables trigger push fix.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  2113. g_bTriggerPushFixEnable = GetConVarBool(g_hTriggerPushFixEnable);
  2114. HookConVarChange(g_hTriggerPushFixEnable, OnSettingChanged);
  2115.  
  2116. g_hSlopeFixEnable = CreateConVar("ck_slopefix_enable", "1", "Enables slope fix.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  2117. g_bSlopeFixEnable = GetConVarBool(g_hSlopeFixEnable);
  2118. HookConVarChange(g_hSlopeFixEnable, OnSettingChanged);
  2119.  
  2120. g_hAutoVIPFlag = CreateConVar("ck_autovip_flag", "a", "Automatically give players with this admin flag the VIP title. Invalid or not set, disables auto VIP.", FCVAR_NOTIFY);
  2121. char szFlag[24];
  2122. AdminFlag bufferFlag;
  2123. GetConVarString(g_hAutoVIPFlag, szFlag, 24);
  2124. g_bAutoVIPFlag = FindFlagByChar(szFlag[0], bufferFlag);
  2125. g_AutoVIPFlag = FlagToBit(bufferFlag);
  2126. HookConVarChange(g_hAutoVIPFlag, OnSettingChanged);
  2127.  
  2128. g_hVoteExtendTime = CreateConVar("ck_vote_extend_time", "10.0", "The time in minutes that is added to the remaining map time if a vote extend is successful.", FCVAR_NOTIFY, true, 0.0);
  2129. g_fVoteExtendTime = GetConVarFloat(g_hVoteExtendTime);
  2130. HookConVarChange(g_hVoteExtendTime, OnSettingChanged);
  2131.  
  2132. g_hMaxVoteExtends = CreateConVar("ck_max_vote_extends", "999", "The max number of VIP vote extends", FCVAR_NOTIFY, true, 0.0);
  2133. g_MaxVoteExtends = GetConVarInt(g_hMaxVoteExtends);
  2134. HookConVarChange(g_hMaxVoteExtends, OnSettingChanged);
  2135.  
  2136. g_hDoubleRestartCommand = CreateConVar("ck_double_restart_command", "1", "(1 / 0) Requires 2 successive !r commands to restart the player to prevent accidental usage.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  2137. g_bDoubleRestartCommand = GetConVarBool(g_hDoubleRestartCommand);
  2138. HookConVarChange(g_hDoubleRestartCommand, OnSettingChanged);
  2139.  
  2140. bool validFlag;
  2141. g_hAdminMenuFlag = CreateConVar("ck_adminmenu_flag", "b", "Admin flag required to open the !ckadmin menu. Invalid or not set, requires flag b.", FCVAR_NOTIFY);
  2142. GetConVarString(g_hAdminMenuFlag, szFlag, 24);
  2143. validFlag = FindFlagByChar(szFlag[0], bufferFlag);
  2144. if (!validFlag)
  2145. {
  2146. PrintToServer("[ckSurf] Invalid flag for ck_adminmenu_flag.");
  2147. g_AdminMenuFlag = ADMFLAG_GENERIC;
  2148. }
  2149. else
  2150. g_AdminMenuFlag = FlagToBit(bufferFlag);
  2151. HookConVarChange(g_hAdminMenuFlag, OnSettingChanged);
  2152.  
  2153.  
  2154. g_hZoneMenuFlag = CreateConVar("ck_zonemenu_flag", "z", "Admin flag required to open the !zones menu. Invalid or not set, requires flag z.", FCVAR_NOTIFY);
  2155. GetConVarString(g_hZoneMenuFlag, szFlag, 24);
  2156. validFlag = FindFlagByChar(szFlag[0], bufferFlag);
  2157. if (!validFlag)
  2158. {
  2159. PrintToServer("[ckSurf] Invalid flag for ck_zonemenu_flag.");
  2160. g_ZoneMenuFlag = ADMFLAG_ROOT;
  2161. }
  2162. else
  2163. g_ZoneMenuFlag = FlagToBit(bufferFlag);
  2164.  
  2165. HookConVarChange(g_hZoneMenuFlag, OnSettingChanged);
  2166.  
  2167. g_hServerVipCommand = CreateConVar("ck_enable_vip", "1", "(0 / 1) Enables the !vip command. Requires a server restart.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
  2168. g_bServerVipCommand = GetConVarBool(g_hServerVipCommand);
  2169. HookConVarChange(g_hServerVipCommand, OnSettingChanged);
  2170.  
  2171. db_setupDatabase();
  2172.  
  2173. //client commands
  2174. RegConsoleCmd("sm_usp", Client_Usp, "[ckSurf] spawns a usp silencer");
  2175. RegConsoleCmd("sm_avg", Client_Avg, "[ckSurf] prints in chat the average time of the current map");
  2176. RegConsoleCmd("sm_accept", Client_Accept, "[ckSurf] allows you to accept a challenge request");
  2177. RegConsoleCmd("sm_hidechat", Client_HideChat, "[ckSurf] hides your ingame chat");
  2178. RegConsoleCmd("sm_hideweapon", Client_HideWeapon, "[ckSurf] hides your weapon model");
  2179. RegConsoleCmd("sm_disarm", Client_HideWeapon, "[ckSurf] hides your weapon model");
  2180. RegConsoleCmd("sm_goto", Client_GoTo, "[ckSurf] teleports you to a selected player");
  2181. RegConsoleCmd("sm_sound", Client_QuakeSounds, "[ckSurf] on/off quake sounds");
  2182. RegConsoleCmd("sm_surrender", Client_Surrender, "[ckSurf] surrender your current challenge");
  2183. RegConsoleCmd("sm_bhop", Client_AutoBhop, "[ckSurf] on/off autobhop");
  2184. RegConsoleCmd("sm_help2", Client_RankingSystem, "[ckSurf] Explanation of the ckSurf ranking system");
  2185. RegConsoleCmd("sm_flashlight", Client_Flashlight, "[ckSurf] on/off flashlight");
  2186. RegConsoleCmd("sm_maptop", Client_MapTop, "[ckSurf] displays local map top for a given map");
  2187. RegConsoleCmd("sm_hidespecs", Client_HideSpecs, "[ckSurf] hides spectators from menu/panel");
  2188. RegConsoleCmd("sm_compare", Client_Compare, "[ckSurf] compare your challenge results");
  2189. RegConsoleCmd("sm_wr", Client_Wr, "[ckSurf] prints records in chat");
  2190. RegConsoleCmd("sm_abort", Client_Abort, "[ckSurf] abort your current challenge");
  2191. RegConsoleCmd("sm_spec", Client_Spec, "[ckSurf] chooses a player who you want to spectate and switch you to spectators");
  2192. RegConsoleCmd("sm_watch", Client_Spec, "[ckSurf] chooses a player who you want to spectate and switch you to spectators");
  2193. RegConsoleCmd("sm_spectate", Client_Spec, "[ckSurf] chooses a player who you want to spectate and switch you to spectators");
  2194. RegConsoleCmd("sm_challenge", Client_Challenge, "[ckSurf] allows you to start a race against others");
  2195. RegConsoleCmd("sm_helpmenu", Client_Help, "[ckSurf] help menu which displays all ckSurf commands");
  2196. RegConsoleCmd("sm_help", Client_Help, "[ckSurf] help menu which displays all ckSurf commands");
  2197. RegConsoleCmd("sm_profile", Client_Profile, "[ckSurf] opens a player profile");
  2198. RegConsoleCmd("sm_rank", Client_Profile, "[ckSurf] opens a player profile");
  2199. RegConsoleCmd("sm_options", Client_OptionMenu, "[ckSurf] opens options menu");
  2200. RegConsoleCmd("sm_top", Client_Top, "[ckSurf] displays top rankings (Top 100 Players, Top 50 overall)");
  2201. RegConsoleCmd("sm_topSurfers", Client_Top, "[ckSurf] displays top rankings (Top 100 Players, Top 50 overall)");
  2202. RegConsoleCmd("sm_bonustop", Client_BonusTop, "[ckSurf] displays top rankings of the bonus");
  2203. RegConsoleCmd("sm_btop", Client_BonusTop, "[ckSurf] displays top rankings of the bonus");
  2204. RegConsoleCmd("sm_stop", Client_Stop, "[ckSurf] stops your timer");
  2205. RegConsoleCmd("sm_ranks", Client_Ranks, "[ckSurf] prints in chat the available player ranks");
  2206. RegConsoleCmd("sm_pause", Client_Pause, "[ckSurf] on/off pause (timer on hold and movement frozen)");
  2207. RegConsoleCmd("sm_showsettings", Client_Showsettings, "[ckSurf] shows ckSurf server settings");
  2208. RegConsoleCmd("sm_latest", Client_Latest, "[ckSurf] shows latest map records");
  2209. RegConsoleCmd("sm_showtime", Client_Showtime, "[ckSurf] on/off - timer text in panel/menu");
  2210. RegConsoleCmd("sm_hide", Client_Hide, "[ckSurf] on/off - hides other players");
  2211. RegConsoleCmd("sm_togglecheckpoints", ToggleCheckpoints, "[ckSurf] on/off - Enable player checkpoints");
  2212. RegConsoleCmd("+noclip", NoClip, "[ckSurf] Player noclip on");
  2213. RegConsoleCmd("-noclip", UnNoClip, "[ckSurf] Player noclip off");
  2214. RegConsoleCmd("sm_nc", Command_ckNoClip, "[ckSurf] Player noclip on/off");
  2215.  
  2216. // Teleportation commands
  2217. RegConsoleCmd("sm_stages", Command_SelectStage, "[ckSurf] Opens up the stage selector");
  2218. RegConsoleCmd("sm_r", Command_Restart, "[ckSurf] Teleports player back to the start");
  2219. RegConsoleCmd("sm_restart", Command_Restart, "[ckSurf] Teleports player back to the start");
  2220. RegConsoleCmd("sm_start", Command_Restart, "[ckSurf] Teleports player back to the start");
  2221. RegConsoleCmd("sm_b", Command_ToBonus, "[ckSurf] Teleports player back to the start");
  2222. RegConsoleCmd("sm_bonus", Command_ToBonus, "[ckSurf] Teleports player back to the start");
  2223. RegConsoleCmd("sm_bonuses", Command_ListBonuses, "[ckSurf] Displays a list of bonuses in current map");
  2224. RegConsoleCmd("sm_s", Command_ToStage, "[ckSurf] Teleports player to the selected stage");
  2225. RegConsoleCmd("sm_stage", Command_ToStage, "[ckSurf] Teleports player to the selected stage");
  2226. RegConsoleCmd("sm_end", Command_ToEnd, "[ckSurf] Teleports player to the end zone");
  2227.  
  2228. // Titles
  2229. RegConsoleCmd("sm_title", Command_SetTitle, "[ckSurf] Displays player's titles");
  2230. RegConsoleCmd("sm_titles", Command_SetTitle, "[ckSurf] Displays player's titles");
  2231.  
  2232. if(g_bServerVipCommand)
  2233. {
  2234. RegConsoleCmd("sm_vip", Command_Vip, "[ckSurf] VIP's commands and effects.");
  2235. RegConsoleCmd("sm_effects", Command_Vip, "[ckSurf] VIP's commands and effects.");
  2236. RegConsoleCmd("sm_effect", Command_Vip, "[ckSurf] VIP's commands and effects.");
  2237. }
  2238.  
  2239. // MISC
  2240. RegConsoleCmd("sm_tier", Command_Tier, "[ckSurf] Prints information on the current map");
  2241. RegConsoleCmd("sm_maptier", Command_Tier, "[ckSurf] Prints information on the current map");
  2242. RegConsoleCmd("sm_mapinfo", Command_Tier, "[ckSurf] Prints information on the current map");
  2243. RegConsoleCmd("sm_mi", Command_Tier, "[ckSurf] Prints information on the current map");
  2244. RegConsoleCmd("sm_m", Command_Tier, "[ckSurf] Prints information on the current map");
  2245. RegConsoleCmd("sm_difficulty", Command_Tier, "[ckSurf] Prints information on the current map");
  2246. RegConsoleCmd("sm_btier", Command_bTier, "[ckSurf] Prints tier information on current map's bonuses");
  2247. RegConsoleCmd("sm_bonusinfo", Command_bTier, "[ckSurf] Prints tier information on current map's bonuses");
  2248. RegConsoleCmd("sm_bi", Command_bTier, "[ckSurf] Prints tier information on current map's bonuses");
  2249. RegConsoleCmd("sm_howto", Command_HowTo, "[ckSurf] Displays a youtube video on how to surf");
  2250. RegConsoleCmd("sm_ve", Command_VoteExtend, "[ckSurf] Vote to extend the map");
  2251.  
  2252. // Teleport to the start of the stage
  2253. RegConsoleCmd("sm_stuck", Command_Teleport, "[ckSurf] Teleports player back to the start of the stage");
  2254. RegConsoleCmd("sm_back", Command_Teleport, "[ckSurf] Teleports player back to the start of the stage");
  2255. RegConsoleCmd("sm_rs", Command_Teleport, "[ckSurf] Teleports player back to the start of the stage");
  2256. RegConsoleCmd("sm_play", Command_Teleport, "[ckSurf] Teleports player back to the start");
  2257. RegConsoleCmd("sm_spawn", Command_Teleport, "[ckSurf] Teleports player back to the start");
  2258.  
  2259. // Player Checkpoints
  2260. RegConsoleCmd("sm_teleport", Command_goToPlayerCheckpoint, "[ckSurf] Teleports player to his last checkpoint");
  2261. RegConsoleCmd("sm_tele", Command_goToPlayerCheckpoint, "[ckSurf] Teleports player to his last checkpoint");
  2262. RegConsoleCmd("sm_prac", Command_goToPlayerCheckpoint, "[ckSurf] Teleports player to his last checkpoint");
  2263. RegConsoleCmd("sm_practice", Command_goToPlayerCheckpoint, "[ckSurf] Teleports player to his last checkpoint");
  2264.  
  2265. RegConsoleCmd("sm_cp", Command_createPlayerCheckpoint, "[ckSurf] Creates a checkpoint, where the player can teleport back to");
  2266. RegConsoleCmd("sm_checkpoint", Command_createPlayerCheckpoint, "[ckSurf] Creates a eckpoint, where the player can teleport back to");
  2267. RegConsoleCmd("sm_undo", Command_undoPlayerCheckpoint, "[ckSurf] Undoes the players lchast checkpoint.");
  2268. RegConsoleCmd("sm_normal", Command_normalMode, "[ckSurf] Switches player back to normal mode.");
  2269. RegConsoleCmd("sm_n", Command_normalMode, "[ckSurf] Switches player back to normal mode.");
  2270.  
  2271. RegAdminCmd("sm_ckadmin", Admin_ckPanel, g_AdminMenuFlag, "[ckSurf] Displays the ckSurf menu panel");
  2272. RegAdminCmd("sm_refreshprofile", Admin_RefreshProfile, g_AdminMenuFlag, "[ckSurf] Recalculates player profile for given steam id");
  2273. RegAdminCmd("sm_resetchallenges", Admin_DropChallenges, ADMFLAG_ROOT, "[ckSurf] Resets all player challenges (drops table challenges) - requires z flag");
  2274. RegAdminCmd("sm_resettimes", Admin_DropAllMapRecords, ADMFLAG_ROOT, "[ckSurf] Resets all player times (drops table playertimes) - requires z flag");
  2275. RegAdminCmd("sm_resetranks", Admin_DropPlayerRanks, ADMFLAG_ROOT, "[ckSurf] Resets the all player points (drops table playerrank - requires z flag)");
  2276. RegAdminCmd("sm_resetmaptimes", Admin_ResetMapRecords, ADMFLAG_ROOT, "[ckSurf] Resets player times for given map - requires z flag");
  2277. RegAdminCmd("sm_resetplayerchallenges", Admin_ResetChallenges, ADMFLAG_ROOT, "[ckSurf] Resets (won) challenges for given steamid - requires z flag");
  2278. RegAdminCmd("sm_resetplayertimes", Admin_ResetRecords, ADMFLAG_ROOT, "[ckSurf] Resets pro map times (+extrapoints) for given steamid with or without given map - requires z flag");
  2279. RegAdminCmd("sm_resetplayermaptime", Admin_ResetMapRecord, ADMFLAG_ROOT, "[ckSurf] Resets pro map time for given steamid and map - requires z flag");
  2280. RegAdminCmd("sm_deleteproreplay", Admin_DeleteMapReplay, ADMFLAG_ROOT, "[ckSurf] Deletes pro replay for a given map - requires z flag");
  2281. RegAdminCmd("sm_resetextrapoints", Admin_ResetExtraPoints, ADMFLAG_ROOT, "[ckSurf] Resets given extra points for all players with or without given steamid");
  2282. RegAdminCmd("sm_deletecheckpoints", Admin_DeleteCheckpoints, ADMFLAG_ROOT, "[ckSurf] Reset checkpoints on the current map");
  2283. RegAdminCmd("sm_insertmaptiers", Admin_InsertMapTiers, ADMFLAG_ROOT, "[ckSurf] Insert premade maptier information into the database (ONLY RUN THIS ONCE)");
  2284. RegAdminCmd("sm_insertmapzones", Admin_InsertMapZones, ADMFLAG_ROOT, "[ckSurf] Insert premade map zones into the database (ONLY RUN THIS ONCE)");
  2285. RegAdminCmd("sm_zones", Command_Zones, g_ZoneMenuFlag, "[ckSurf] Opens up the zone creation menu.");
  2286. RegAdminCmd("sm_admintitles", Admin_giveTitle, ADMFLAG_ROOT, "[ckSurf] Gives a player a title");
  2287. RegAdminCmd("sm_admintitle", Admin_giveTitle, ADMFLAG_ROOT, "[ckSurf] Gives a player a title");
  2288. RegAdminCmd("sm_givetitle", Admin_giveTitle, ADMFLAG_ROOT, "[ckSurf] Gives a player a title");
  2289. RegAdminCmd("sm_removetitles", Admin_deleteTitles, ADMFLAG_ROOT, "[ckSurf] Removes player's all titles");
  2290. RegAdminCmd("sm_removetitle", Admin_deleteTitle, ADMFLAG_ROOT, "[ckSurf] Removes specific title from a player");
  2291.  
  2292. RegAdminCmd("sm_addmaptier", Admin_insertMapTier, g_AdminMenuFlag, "[ckSurf] Changes maps tier");
  2293. RegAdminCmd("sm_amt", Admin_insertMapTier, g_AdminMenuFlag, "[ckSurf] Changes maps tier");
  2294. RegAdminCmd("sm_addspawn", Admin_insertSpawnLocation, g_AdminMenuFlag, "[ckSurf] Changes the position !r takes players to");
  2295. RegAdminCmd("sm_delspawn", Admin_deleteSpawnLocation, g_AdminMenuFlag, "[ckSurf] Removes custom !r position");
  2296. RegAdminCmd("sm_clearassists", Admin_ClearAssists, g_AdminMenuFlag, "[ckSurf] Clears assist points (map progress) from all players");
  2297.  
  2298.  
  2299. //chat command listener
  2300. AddCommandListener(Say_Hook, "say");
  2301. HookUserMessage(GetUserMessageId("SayText2"), SayText2, true);
  2302. AddCommandListener(Say_Hook, "say_team");
  2303.  
  2304. //exec ckSurf.cfg
  2305. AutoExecConfig(true, "ckSurf");
  2306.  
  2307. //mic
  2308. g_ownerOffset = FindSendPropInfo("CBaseCombatWeapon", "m_hOwnerEntity");
  2309. g_ragdolls = FindSendPropInfo("CCSPlayer", "m_hRagdoll");
  2310.  
  2311. //add to admin menu
  2312. Handle tpMenu;
  2313. if (LibraryExists("adminmenu") && ((tpMenu = GetAdminTopMenu()) != null))
  2314. OnAdminMenuReady(tpMenu);
  2315.  
  2316. //hooks
  2317. HookEvent("player_spawn", Event_OnPlayerSpawn, EventHookMode_Post);
  2318. HookEvent("player_death", Event_OnPlayerDeath);
  2319. HookEvent("round_start", Event_OnRoundStart, EventHookMode_PostNoCopy);
  2320. HookEvent("round_end", Event_OnRoundEnd, EventHookMode_Pre);
  2321. HookEvent("player_hurt", Event_OnPlayerHurt);
  2322. //HookEvent("player_jump", Event_OnJump, EventHookMode_Pre);
  2323. HookEvent("weapon_fire", Event_OnFire, EventHookMode_Pre);
  2324. HookEvent("player_team", Event_OnPlayerTeam, EventHookMode_Post);
  2325. //HookEvent("jointeam_failed", Event_JoinTeamFailed, EventHookMode_Pre);
  2326. HookEvent("player_disconnect", Event_PlayerDisconnect, EventHookMode_Pre);
  2327.  
  2328. //mapcycle array
  2329. int arraySize = ByteCountToCells(PLATFORM_MAX_PATH);
  2330. g_MapList = CreateArray(arraySize);
  2331.  
  2332. //add command listeners
  2333. AddCommandListener(Command_JoinTeam, "jointeam");
  2334. AddCommandListener(Command_ext_Menu, "radio1");
  2335. AddCommandListener(Command_ext_Menu, "radio2");
  2336. AddCommandListener(Command_ext_Menu, "radio3");
  2337.  
  2338. //hook radio commands
  2339. for (int g; g < sizeof(RadioCMDS); g++)
  2340. AddCommandListener(BlockRadio, RadioCMDS[g]);
  2341.  
  2342. //button sound hook
  2343. //AddNormalSoundHook(NormalSHook_callback);
  2344.  
  2345. //nav files
  2346. CreateNavFiles();
  2347.  
  2348. // Botmimic 2
  2349. // https://forums.alliedmods.net/showthread.php?t=180114
  2350. // Optionally setup a hook on CBaseEntity::Teleport to keep track of sudden place changes
  2351. CheatFlag("bot_zombie", false, true);
  2352. CheatFlag("bot_mimic", false, true);
  2353. g_hLoadedRecordsAdditionalTeleport = CreateTrie();
  2354. Handle hGameData = LoadGameConfigFile("sdktools.games");
  2355. if (hGameData == null)
  2356. {
  2357. SetFailState("GameConfigFile sdkhooks.games was not found.");
  2358. return;
  2359. }
  2360. int iOffset = GameConfGetOffset(hGameData, "Teleport");
  2361. CloseHandle(hGameData);
  2362. if (iOffset == -1)
  2363. return;
  2364.  
  2365. if (LibraryExists("dhooks"))
  2366. {
  2367. g_hTeleport = DHookCreate(iOffset, HookType_Entity, ReturnType_Void, ThisPointer_CBaseEntity, DHooks_OnTeleport);
  2368. if (g_hTeleport == null)
  2369. return;
  2370. DHookAddParam(g_hTeleport, HookParamType_VectorPtr);
  2371. DHookAddParam(g_hTeleport, HookParamType_ObjectPtr);
  2372. DHookAddParam(g_hTeleport, HookParamType_VectorPtr);
  2373. DHookAddParam(g_hTeleport, HookParamType_Bool);
  2374. }
  2375.  
  2376. // Forwards
  2377. g_MapFinishForward = CreateGlobalForward("ckSurf_OnMapFinished", ET_Event, Param_Cell, Param_Float, Param_String, Param_Cell, Param_Cell);
  2378. g_BonusFinishForward = CreateGlobalForward("ckSurf_OnBonusFinished", ET_Event, Param_Cell, Param_Float, Param_String, Param_Cell, Param_Cell, Param_Cell);
  2379. g_PracticeFinishForward = CreateGlobalForward("ckSurf_OnPracticeFinished", ET_Event, Param_Cell, Param_Float, Param_String);
  2380.  
  2381. if (g_bLateLoaded)
  2382. {
  2383. CreateTimer(3.0, LoadPlayerSettings, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE);
  2384. }
  2385.  
  2386. Format(szWHITE, 12, "%c", WHITE);
  2387. Format(szDARKRED, 12, "%c", DARKRED);
  2388. Format(szPURPLE, 12, "%c", PURPLE);
  2389. Format(szGREEN, 12, "%c", GREEN);
  2390. Format(szMOSSGREEN, 12, "%c", MOSSGREEN);
  2391. Format(szLIMEGREEN, 12, "%c", LIMEGREEN);
  2392. Format(szRED, 12, "%c", RED);
  2393. Format(szGRAY, 12, "%c", GRAY);
  2394. Format(szYELLOW, 12, "%c", YELLOW);
  2395. Format(szDARKGREY, 12, "%c", DARKGREY);
  2396. Format(szBLUE, 12, "%c", BLUE);
  2397. Format(szDARKBLUE, 12, "%c", DARKBLUE);
  2398. Format(szLIGHTBLUE, 12, "%c", LIGHTBLUE);
  2399. Format(szPINK, 12, "%c", PINK);
  2400. Format(szLIGHTRED, 12, "%c", LIGHTRED);
  2401. Format(szORANGE, 12, "%c", ORANGE);
  2402. }
  2403.  
  2404. /*===== End of Events ======*/
  2405.  
  2406.  
  2407.  
  2408.  
  2409. /*===============================
  2410. = Natives =
  2411. ===============================*/
  2412.  
  2413. public int Native_GetTimerStatus(Handle plugin, int numParams)
  2414. {
  2415. return g_bTimeractivated[GetNativeCell(1)];
  2416. }
  2417.  
  2418. public int Native_StopTimer(Handle plugin, int numParams)
  2419. {
  2420. Client_Stop(GetNativeCell(1), 0);
  2421. }
  2422.  
  2423. public int Native_GetCurrentTime(Handle plugin, int numParams)
  2424. {
  2425. return view_as<int>(g_fCurrentRunTime[GetNativeCell(1)]);
  2426. }
  2427.  
  2428. public int Native_EmulateStartButtonPress(Handle plugin, int numParams)
  2429. {
  2430. CL_OnStartTimerPress(GetNativeCell(1));
  2431. }
  2432.  
  2433. public int Native_EmulateStopButtonPress(Handle plugin, int numParams)
  2434. {
  2435. CL_OnEndTimerPress(GetNativeCell(1));
  2436. }
  2437.  
  2438. public int Native_ClientIsVIP(Handle plugin, int numParams)
  2439. {
  2440. return view_as<bool>(g_bflagTitles[GetNativeCell(1)][0]);
  2441. }
  2442.  
  2443. public int Native_GetServerRank(Handle plugin, int numParams)
  2444. {
  2445. return g_PlayerRank[GetNativeCell(1)];
  2446. }
  2447.  
  2448. public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
  2449. {
  2450. RegPluginLibrary("ckSurf");
  2451. CreateNative("ckSurf_GetTimerStatus", Native_GetTimerStatus);
  2452. CreateNative("ckSurf_StopTimer", Native_StopTimer);
  2453. CreateNative("ckSurf_EmulateStartButtonPress", Native_EmulateStartButtonPress);
  2454. CreateNative("ckSurf_EmulateStopButtonPress", Native_EmulateStopButtonPress);
  2455. CreateNative("ckSurf_GetCurrentTime", Native_GetCurrentTime);
  2456. CreateNative("ckSurf_ClientIsVIP", Native_ClientIsVIP);
  2457. CreateNative("ckSurf_GetServerRank", Native_GetServerRank);
  2458.  
  2459. g_bLateLoaded = late;
  2460. return APLRes_Success;
  2461. }
  2462.  
  2463. /*===== End of Natives ======*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement