Advertisement
Guest User

Untitled

a guest
Dec 14th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.12 KB | None | 0 0
  1. #include <sdktools>
  2. #include <sdkhooks>
  3. #include <sourcemod>
  4. #include <geoip>
  5.  
  6. #define PLUGIN_VERSION "1.4e2 css:go"
  7. #define PLAYER_MANAGER "cs_player_manager"
  8. #define STEALTHTEAM 1
  9. #define QUIT_MESSAGE_CSGO "Gracz %N opuścił grę (Disconnect)"
  10. #define PREFIX "\x01\x0B \x02[cs-placzabaw.pl]\x01"
  11. #define EF_BONEMERGE (1 << 0)
  12. #define EF_NOSHADOW (1 << 4)
  13. #define EF_NORECEIVESHADOW (1 << 6)
  14. #define PLUGIN_NAME "ESP & STEALTH"
  15. #define HEADSCALE 1.0
  16. #define HEADPROP "models/player/holiday/facemasks/facemask_tf2_spy_model.mdl"
  17. #define HEADATTACH "facemask"
  18.  
  19. #define NORMATTACH "primary"
  20.  
  21. ConVar cColor[2];
  22. ConVar cLifeState;
  23. ConVar cNotify;
  24. ConVar cTeam;
  25. ConVar cModel;
  26. ConVar sv_force_transmit_players;
  27.  
  28. bool isUsingESP[MAXPLAYERS+1];
  29. bool canSeeESP[MAXPLAYERS+1];
  30. bool:g_bIsInvisible[MAXPLAYERS + 1] = {false, ...};
  31. int colors[2][4]
  32. int playersInESP = 0;
  33. int playerModels[MAXPLAYERS+1] = {INVALID_ENT_REFERENCE,...};
  34. int playerModelsIndex[MAXPLAYERS+1] = {-1,...};
  35. int playerTeam[MAXPLAYERS+1] = {0,...};
  36. int g_iOldTeam[MAXPLAYERS+1];
  37. int serverVer;
  38. new Float:nextPing[MAXPLAYERS+1];
  39. Handle:g_hHostname;
  40.  
  41.  
  42. public Plugin myinfo = {
  43. name = PLUGIN_NAME,
  44. author = "Mitch / necavi and Naydef / edit+merge = SUPER TIMOR",
  45. description = "Allow admins to use a server side ESP/WH + set admin invisibility when going /stealth.",
  46. version = PLUGIN_VERSION,
  47. url = "mtch.tech / sourcemod.net / cs-placzabaw.pl"
  48. };
  49. public OnPluginStart() {
  50. sv_force_transmit_players = FindConVar("sv_force_transmit_players");
  51. CreateConVar("sm_advanced_esp_version", PLUGIN_VERSION, PLUGIN_NAME, FCVAR_NOTIFY|FCVAR_DONTRECORD);
  52. cColor[0] = CreateConVar("sm_advanced_esp_tcolor", "144 120 72", "R G B ze spacjami dla TT", 0);
  53. cColor[1] = CreateConVar("sm_advanced_esp_ctcolor", "72 96 144", "R G B ze spacjami dla CT", 0);
  54. cLifeState = CreateConVar("sm_advanced_esp_lifestate", "0", "Set to 1 if admins should only see esp when dead, 2 to only see esp while alive, 0 dead or alive.", 0);
  55. cNotify = CreateConVar("sm_advanced_esp_notify", "0", "Set to 1 if giving and setting esp should notify the rest of the server.", 0);
  56. cTeam = CreateConVar("sm_advanced_esp_team", "0", "0 - Display all teams, 1 - Display enemy, 2 - Display teammates", 0);
  57. cModel = CreateConVar("sm_advanced_esp_model", "0", "0 - Use current model (full body glow), 1 - Use facemask model on head", 0);
  58. CreateConVar("sm_adminstealth_version", PLUGIN_VERSION, "Admin-Stealth version cvar", FCVAR_NOTIFY|FCVAR_SPONLY|FCVAR_DONTRECORD);
  59. RegAdminCmd("sm_stealth", Command_Stealth, ADMFLAG_KICK, "ON/OFF STEALTH");
  60. AutoExecConfig(true, "csgo_advanced_esp");
  61. cColor[0].AddChangeHook(ConVarChange);
  62. cColor[1].AddChangeHook(ConVarChange);
  63. cLifeState.AddChangeHook(ConVarChange);
  64. cTeam.AddChangeHook(ConVarChange);
  65. cModel.AddChangeHook(ConVarChange);
  66. for(int i = 0; i <= 1; i++)
  67. {
  68. retrieveColorValue(i);
  69. }
  70.  
  71. LoadTranslations("common.phrases");
  72. LoadTranslations("esp.phrases");
  73.  
  74. HookEvent("player_spawn", Event_PlayerSpawn);
  75. HookEvent("player_death", Event_PlayerDeath);
  76. HookEvent("round_end", Event_RoundEnd);
  77. AddCommandListener(Command_JoinTeam, "jointeam");
  78. AddCommandListener(Command_JoinTeam, "autoteam");
  79. AddCommandListener(Command_Status, "status");
  80. AddCommandListener(Command_Ping, "ping");
  81. g_hHostname = FindConVar("hostname");
  82. serverVer=GetSteamINFNum();
  83. HookEventEx("player_disconnect", Event_HandleStealthAdmins, EventHookMode_Pre);
  84. HookEventEx("player_team", Event_HandleStealthAdmins, EventHookMode_Pre);
  85. HookEvent("player_team", Event_PlayerTeam, EventHookMode_Post);
  86. playersInESP = 0;
  87.  
  88. for(new i=1; i<=MaxClients; i++)
  89. {
  90. if(ValidPlayer(i))
  91. {
  92. SDKHook(i, SDKHook_SetTransmit, Hook_Transmit);
  93. SDKHook(i, SDKHook_WeaponCanUse, Event_WeaponCanUse);
  94. }
  95. }
  96. new PlayerManager=FindEntityByClassname(-1, PLAYER_MANAGER);
  97. if(IsValidEntity(PlayerManager))
  98. {
  99. SDKHook(PlayerManager, SDKHook_ThinkPost, Hook_PlayerManagetThinkPost);
  100. }
  101. }
  102. public OnClientPostAdminCheck(client)
  103. {
  104. SDKHook(client, SDKHook_SetTransmit, Hook_Transmit);
  105. SDKHook(client, SDKHook_WeaponCanUse, Event_WeaponCanUse);
  106. }
  107. public Action Command_JoinTeam(int client, char[] command, int args)
  108. {
  109. char sTeamName[8];
  110. GetCmdArg(1, sTeamName, sizeof(sTeamName)) ;
  111. int iTeam = StringToInt(sTeamName);
  112.  
  113. if (iTeam == 1 && (GetUserFlagBits(client) & ADMFLAG_KICK) && !g_bIsInvisible[client])
  114. toggleGlow(client, true);
  115.  
  116. else if (iTeam != 1 && (GetUserFlagBits(client) & ADMFLAG_KICK) && !g_bIsInvisible[client])
  117. toggleGlow(client, false);
  118.  
  119. if(g_bIsInvisible[client])
  120. {
  121. PrintToChat(client, "%s Nie ma powrotu! Disconnectuj :)", PREFIX);
  122. return Plugin_Handled;
  123. }
  124. else
  125. return Plugin_Continue;
  126. }
  127. public void ConVarChange(ConVar convar, const char[] oldValue, const char[] newValue) {
  128. for(int i = 0; i <= 1; i++) {
  129. if(convar == cColor[i]) {
  130. retrieveColorValue(i);
  131. }
  132. }
  133. checkGlows();
  134. }
  135.  
  136. public void retrieveColorValue(int index) {
  137. char pieces[4][16];
  138. char color[64];
  139. cColor[index].GetString(color, sizeof(color));
  140. if(ExplodeString(color, " ", pieces, sizeof(pieces), sizeof(pieces[])) >= 3) {
  141. for(int j = 0; j < 3; j++) {
  142. colors[index][j] = StringToInt(pieces[j]);
  143. }
  144. }
  145. }
  146. public Action Command_ESP(client, args) {
  147. if(!client || !IsClientInGame(client)) {
  148. return Plugin_Handled;
  149. }
  150. bool value = false;
  151. if(args > 0) {
  152. char arg1[32];
  153. GetCmdArg(1, arg1, sizeof(arg1));
  154. toggleGlow(client, (StringToInt(arg1) != 0));
  155. } else {
  156. toggleGlow(client, !isUsingESP[client]);
  157. }
  158. char targetName[64];
  159. GetClientName(client, targetName, sizeof(targetName));
  160. notifyServer(client, targetName, (args > 1) ? (value ? 1 : 0) : 2);
  161. return Plugin_Handled;
  162. }
  163. public void notifyServer(int client, char[] targetName, int status) {
  164. if(cNotify.BoolValue) {
  165. switch(status) {
  166. case 0: ShowActivity(client, "%t", "ESP Off", targetName);
  167. case 1: ShowActivity(client, "%t", "ESP On", targetName);
  168. default: ShowActivity(client, "%t", "ESP Toggle", targetName);
  169. }
  170. }
  171. }
  172. public OnPluginEnd() {
  173. destoryGlows();
  174. }
  175.  
  176. public void OnMapStart() {
  177. PrecacheModel(HEADPROP);
  178. resetPlayerVars(0);
  179. }
  180.  
  181. public void OnClientDisconnect(int client) {
  182. resetPlayerVars(client);
  183. SDKUnhook(client, SDKHook_WeaponCanUse, Event_WeaponCanUse);
  184. SDKUnhook(client, SDKHook_SetTransmit, Hook_Transmit);
  185. g_bIsInvisible[client]=false;
  186. }
  187.  
  188. public void OnClientPutInServer(int client) {
  189. resetPlayerVars(client);
  190. }
  191.  
  192. public void Event_PlayerTeam(Event event, const char[] name, bool dontBroadcast) {
  193. int client = GetClientOfUserId(event.GetInt("userid"));
  194. if(client <= 0 || client > MaxClients || !IsClientInGame(client)) {
  195. return;
  196. }
  197. playerTeam[client] = GetClientTeam(client);
  198.  
  199. if(g_bIsInvisible[client])
  200. {
  201. ChangeClientTeam(client, STEALTHTEAM);
  202. }
  203. }
  204.  
  205. public void Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast)
  206. {
  207. int client = GetClientOfUserId(event.GetInt("userid"));
  208. if(client <= 0 || client > MaxClients || !IsClientInGame(client))
  209. {
  210. return;
  211. }
  212.  
  213. checkGlows();
  214. }
  215.  
  216. public void Event_PlayerDeath(Event event, const char[] name, bool dontBroadcast)
  217. {
  218. checkGlows();
  219. }
  220.  
  221. public void Event_RoundEnd(Event event, const char[] name, bool dontBroadcast)
  222. {
  223. destoryGlows();
  224. }
  225.  
  226. public void toggleGlow(int client, bool value)
  227. {
  228. isUsingESP[client] = value;
  229. checkGlows();
  230. }
  231.  
  232. public void resetPlayerVars(int client) {
  233. if(client == 0) {
  234. for(int i = 1; i <= MaxClients; i++) {
  235. resetPlayerVars(i);
  236. }
  237. return;
  238. }
  239. isUsingESP[client] = false;
  240. playerTeam[client] = 0;
  241. g_bIsInvisible[client] = false;
  242. if(IsClientInGame(client)) {
  243. playerTeam[client] = GetClientTeam(client);
  244. }
  245. }
  246.  
  247. public bool getCanSeeEsp(int client, int lifestate) {
  248. switch(lifestate) {
  249. case 1: return !IsPlayerAlive(client);
  250. case 2: return IsPlayerAlive(client);
  251. }
  252. return true;
  253. }
  254.  
  255. public void checkGlows() {
  256. playersInESP = 0;
  257. int lifestate = cLifeState.IntValue;
  258. for(int client = 1; client <= MaxClients; client++) {
  259. if(!IsClientInGame(client) || !isUsingESP[client]) {
  260. isUsingESP[client] = false;
  261. canSeeESP[client] = false;
  262. continue;
  263. }
  264. canSeeESP[client] = getCanSeeEsp(client, lifestate);
  265. if(canSeeESP[client]) {
  266. playersInESP++;
  267. }
  268. }
  269. destoryGlows();
  270. if(playersInESP > 0) {
  271. sv_force_transmit_players.SetString("1", true, false);
  272. createGlows();
  273. } else {
  274. sv_force_transmit_players.SetString("0", true, false);
  275. }
  276. }
  277.  
  278. public void destoryGlows() {
  279. for(int client = 1; client <= MaxClients; client++) {
  280. if(IsClientInGame(client)) {
  281. RemoveSkin(client);
  282. }
  283. }
  284. }
  285.  
  286. public void createGlows() {
  287. char model[PLATFORM_MAX_PATH];
  288. char attachment[PLATFORM_MAX_PATH];
  289. int skin = -1;
  290.  
  291. float scale = 1.0;
  292. attachment = NORMATTACH;
  293.  
  294. for(int client = 1; client <= MaxClients; client++)
  295. {
  296. if(!IsClientInGame(client) || !IsPlayerAlive(client))
  297. continue;
  298.  
  299. playerTeam[client] = GetClientTeam(client);
  300. if(playerTeam[client] <= 1)
  301. continue;
  302.  
  303. GetClientModel(client, model, sizeof(model));
  304. skin = CreatePlayerModelProp(client, model, attachment, true, scale);
  305. if(skin > MaxClients)
  306. {
  307. playerTeam[client] = GetClientTeam(client);
  308. if(SDKHookEx(skin, SDKHook_SetTransmit, OnSetTransmit_All))
  309. setGlowTeam(skin, playerTeam[client]);
  310. }
  311. }
  312. }
  313.  
  314. public setGlowTeam(int skin, int team) {
  315. if(team >= 2) {
  316. SetupGlow(skin, colors[team-2]);
  317. }
  318. }
  319.  
  320. public Action OnSetTransmit_All(int entity, int client) {
  321. if(canSeeESP[client] && playerModelsIndex[client] != entity) {
  322. return Plugin_Continue;
  323. }
  324. return Plugin_Stop;
  325. }
  326. public void SetupGlow(int entity, int color[4]) {
  327. static offset;
  328. if (!offset && (offset = GetEntSendPropOffs(entity, "m_clrGlow")) == -1) {
  329. LogError("Unable to find property offset: \"m_clrGlow\"!");
  330. return;
  331. }
  332. SetEntProp(entity, Prop_Send, "m_bShouldGlow", true);
  333. SetEntProp(entity, Prop_Send, "m_nGlowStyle", 0);
  334. SetEntPropFloat(entity, Prop_Send, "m_flGlowMaxDist", 10000.0);
  335.  
  336. for(int i=0;i<3;i++) {
  337. SetEntData(entity, offset + i, color[i], _, true);
  338. }
  339. }
  340.  
  341. public int CreatePlayerModelProp(int client, char[] sModel, char[] attachment, bool bonemerge, float scale) {
  342. RemoveSkin(client);
  343. int skin = CreateEntityByName("prop_dynamic_glow");
  344. DispatchKeyValue(skin, "model", sModel);
  345. DispatchKeyValue(skin, "solid", "0");
  346. DispatchKeyValue(skin, "fademindist", "1");
  347. DispatchKeyValue(skin, "fademaxdist", "1");
  348. DispatchKeyValue(skin, "fadescale", "2.0");
  349. SetEntProp(skin, Prop_Send, "m_CollisionGroup", 0);
  350. DispatchSpawn(skin);
  351. SetEntityRenderMode(skin, RENDER_GLOW);
  352. SetEntityRenderColor(skin, 0, 0, 0, 0);
  353. if(bonemerge) {
  354. SetEntProp(skin, Prop_Send, "m_fEffects", EF_BONEMERGE);
  355. }
  356. if(scale != 1.0) {
  357. SetEntPropFloat(skin, Prop_Send, "m_flModelScale", scale);
  358. }
  359. SetVariantString("!activator");
  360. AcceptEntityInput(skin, "SetParent", client, skin);
  361. SetVariantString(attachment);
  362. AcceptEntityInput(skin, "SetParentAttachment", skin, skin, 0);
  363. SetVariantString("OnUser1 !self:Kill::0.1:-1");
  364. AcceptEntityInput(skin, "AddOutput");
  365. playerModels[client] = EntIndexToEntRef(skin);
  366. playerModelsIndex[client] = skin;
  367. return skin;
  368. }
  369.  
  370. public void RemoveSkin(int client) {
  371. int index = EntRefToEntIndex(playerModels[client]);
  372. if(index > MaxClients && IsValidEntity(index)) {
  373. SetEntProp(index, Prop_Send, "m_bShouldGlow", false);
  374. AcceptEntityInput(index, "FireUser1");
  375. }
  376. playerModels[client] = INVALID_ENT_REFERENCE;
  377. playerModelsIndex[client] = -1;
  378. }
  379.  
  380. public bool IsValidClient(int client) {
  381. return (1 <= client && client <= MaxClients && IsClientInGame(client));
  382. }
  383. public OnEntityCreated(entity, const String:classname[])
  384. {
  385. if(StrEqual(classname, PLAYER_MANAGER, false))
  386. {
  387. SDKHook(entity, SDKHook_SpawnPost, Hook_SpawnPost);
  388. }
  389. }
  390. public Action:Hook_SpawnPost(entity)
  391. {
  392. if(IsValidEntity(entity))
  393. {
  394. SDKHook(entity, SDKHook_ThinkPost, Hook_PlayerManagetThinkPost);
  395. }
  396. return Plugin_Continue;
  397. }
  398. public Hook_PlayerManagetThinkPost(entity)
  399. {
  400. for(new i=1; i<=MaxClients; i++)
  401. {
  402. if(ValidPlayer(i) && g_bIsInvisible[i])
  403. {
  404. SetEntProp(entity, Prop_Send, "m_bConnected", false, _, i);
  405. }
  406. }
  407. }
  408. public Action:Event_HandleStealthAdmins(Handle:event, const String:name[], bool:dontBroadcast)
  409. {
  410. new client=GetClientOfUserId(GetEventInt(event, "userid"));
  411. if(ValidPlayer(client) && g_bIsInvisible[client]) return Plugin_Handled;
  412. return Plugin_Continue;
  413. }
  414. public Action:Event_WeaponCanUse(client, weapon)
  415. {
  416. if(g_bIsInvisible[client])
  417. {
  418. return Plugin_Handled;
  419. }
  420. return Plugin_Continue;
  421. }
  422. public Action:Command_Status(client, const String:command[], args)
  423. {
  424. if(CheckCommandAccess(client, "sm_stealth", 0))
  425. {
  426. return Plugin_Continue;
  427. }
  428. new String:buffer[64];
  429. GetConVarString(g_hHostname, buffer, sizeof(buffer));
  430. PrintToConsole(client, "hostname: %s", buffer);
  431. PrintToConsole(client, "version : %i/24 %i secure", serverVer, serverVer);
  432. GetCurrentMap(buffer, sizeof(buffer));
  433. new Float:vec[3];
  434. GetClientAbsOrigin(client, vec);
  435. PrintToConsole(client,"map : %s", buffer);
  436. PrintToConsole(client,"players : %d (%d max)", GetClientCount() - GetInvisCount(), MaxClients);
  437. PrintToConsole(client,"# userid name uniqueid connected ping loss state");
  438. new String:name[MAX_NAME_LENGTH];
  439. new String:steamID[21];
  440. new String:time[10];
  441. for(new i; i <= MaxClients; i++)
  442. {
  443. if(ValidPlayer(i))
  444. {
  445. if(!g_bIsInvisible[i])
  446. {
  447. Format(name, sizeof(name), "%N", i);
  448. GetClientAuthId(i, AuthId_Steam2, steamID, sizeof(steamID));
  449. if(!IsFakeClient(i))
  450. {
  451. FormatShortTime(RoundToFloor(GetClientTime(i)), time,sizeof(time));
  452. PrintToConsole(client,"# %6d %-19s %19s %9s %4d %4d active", GetClientUserId(i),
  453. name, steamID, time, RoundToFloor(GetClientAvgLatency(i,NetFlow_Both) * 1000.0),
  454. RoundToFloor(GetClientAvgLoss(i, NetFlow_Both) * 100.0));
  455. }
  456. else
  457. {
  458. PrintToConsole(client, "# %6d %-19s %19s active", GetClientUserId(i), name, steamID);
  459. }
  460. }
  461. }
  462. }
  463. PrintToConsole(client, "#end");
  464. return Plugin_Stop;
  465. }
  466. public Action:Command_Ping(client, const String:command[], args)
  467. {
  468. if(!ValidPlayer(client) || CheckCommandAccess(client, "sm_stealth", 0)) // Console will now work!!!
  469. {
  470. return Plugin_Continue;
  471. }
  472. if(nextPing[client]<=GetGameTime())
  473. {
  474. PrintToConsole(client, "Client ping times:");
  475. for(new i=1; i<=MaxClients; i++)
  476. {
  477. if(ValidPlayer(i) && !g_bIsInvisible[i] && !IsFakeClient(i))
  478. {
  479. PrintToConsole(client, " %i ms : %N", RoundToFloor(GetClientAvgLatency(i, NetFlow_Both) * 1000.0), i);
  480. }
  481. }
  482. nextPing[client]=GetGameTime()+0.2;
  483. }
  484. return Plugin_Handled;
  485. }
  486. public Action:Hook_Transmit(entity, client)
  487. {
  488. if(ValidPlayer(entity) && g_bIsInvisible[entity] && entity != client)
  489. {
  490. return Plugin_Handled;
  491. }
  492. return Plugin_Continue;
  493.  
  494. }
  495. public Action:Command_Stealth(client, args)
  496. {
  497. ToggleInvis(client);
  498. return Plugin_Handled;
  499. }
  500. ToggleInvis(client)
  501. {
  502. if(!g_bIsInvisible[client])
  503. {
  504. InvisOn(client);
  505. }
  506. else
  507. {
  508. PrintToChat(client, "%s Prosiliśmy! Nie wracaj tylko disconnectuj!", PREFIX);
  509. }
  510. }
  511. InvisOn(client)
  512. {
  513. CreateTimer(0.1, zmiana_bool, client);
  514. g_iOldTeam[client] = GetEntProp(client, Prop_Send, "m_iTeamNum");
  515. SetEntProp(client, Prop_Send, "m_lifeState", 2);
  516. ChangeClientTeam(client, STEALTHTEAM);
  517. SetEntProp(client, Prop_Data, "m_takedamage", 0);
  518. SetEntityMoveType(client, MOVETYPE_NOCLIP);
  519. RemoveAllWeapons(client);
  520. PrintConDisMessg(client, false);
  521. toggleGlow(client, true);
  522. PrintToChat(client, "%s Jesteś na stealthu! Obserwuj grę, ale komendy wpisuj w konsoli albo z /. Jak skończysz - wyjdź z serwera!", PREFIX);
  523. }
  524. public Action:zmiana_bool(Handle timer, any client)
  525. {
  526. if(!IsClientInGame(client))
  527. return Plugin_Continue;
  528. g_bIsInvisible[client] = true;
  529. return Plugin_Continue;
  530. }
  531. RemoveAllWeapons(client)
  532. {
  533. new weaponIndex;
  534. for (new i = 0; i <= 5; i++)
  535. {
  536. while((weaponIndex = GetPlayerWeaponSlot(client, i)) != -1)
  537. {
  538. RemovePlayerItem(client, weaponIndex);
  539. RemoveEdict(weaponIndex);
  540. }
  541. }
  542. }
  543. bool:ValidPlayer(client)
  544. {
  545. if(client > 0 && client <= MaxClients && IsClientInGame(client))
  546. {
  547. return true;
  548. }
  549. return false;
  550. }
  551. public bool:IsStealthed(client) // In case some plugin wants to make a call to the plugin via reflection!
  552. {
  553. return g_bIsInvisible[client];
  554. }
  555. FormatShortTime(time, String:outTime[], size)
  556. {
  557. new temp;
  558. temp = time % 60;
  559. Format(outTime, size,"%02d",temp);
  560. temp = (time % 3600) / 60;
  561. Format(outTime, size,"%02d:%s", temp, outTime);
  562. temp = (time % 86400) / 3600;
  563. if(temp > 0)
  564. {
  565. Format(outTime, size, "%d%:s", temp, outTime);
  566. }
  567. }
  568. GetInvisCount()
  569. {
  570. new count = 0;
  571. for(new i; i <= MaxClients; i++)
  572. {
  573. if(ValidPlayer(i) && g_bIsInvisible[i])
  574. {
  575. count++;
  576. }
  577. }
  578. return count;
  579. }
  580. //To-do: Use the new fake event function in Sourcemod 1.8
  581. bool:PrintConDisMessg(client, bool:connect)
  582. {
  583. if(!ValidPlayer(client))
  584. {
  585. return false;
  586. }
  587. if(!connect)
  588. {
  589. PrintToChatAll(QUIT_MESSAGE_CSGO, client);
  590. }
  591. return true;
  592. }
  593.  
  594. stock GetSteamINFNum(String:search[]="ServerVersion")
  595. {
  596. new String:file[16]="./steam.inf", String:inf_buffer[64];
  597. new Handle:file_h=OpenFile(file, "r");
  598.  
  599. do
  600. {
  601. if(!ReadFileLine(file_h, inf_buffer, sizeof(inf_buffer)))
  602. {
  603. return -1;
  604. }
  605. TrimString(inf_buffer);
  606. }
  607. while(StrContains(inf_buffer, search, false) < 0);
  608. CloseHandle(file_h);
  609. return StringToInt(inf_buffer[strlen(search)+1]);
  610. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement