Advertisement
Guest User

Untitled

a guest
Dec 18th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.55 KB | None | 0 0
  1. #pragma semicolon 1
  2.  
  3. #define DEBUG
  4.  
  5. #define PLUGIN_AUTHOR ""
  6. #define PLUGIN_VERSION ""
  7.  
  8. #include <sourcemod>
  9. #include <sdktools>
  10. #include <smlib>
  11. #include <cstrike>
  12. #include <sdkhooks>
  13.  
  14. #define DecoyGrenade_Offset 18 // (18 * 4)
  15.  
  16. EngineVersion g_Game;
  17. char g_sEggConfig[PLATFORM_MAX_PATH];
  18. int g_iPlayerPrevButtons[MAXPLAYERS + 1];
  19. bool OnVamp[MAXPLAYERS+1];
  20.  
  21. Handle TIMER_REMOVEDRUGS[MAXPLAYERS+1] = INVALID_HANDLE;
  22. bool isOneHitKnifer[MAXPLAYERS+1];
  23. bool isVampire[MAXPLAYERS+1];
  24. bool isInvisible[MAXPLAYERS+1];
  25. bool bTookEgg = false;
  26.  
  27. public Plugin myinfo =
  28. {
  29. name = "",
  30. author = PLUGIN_AUTHOR,
  31. description = "",
  32. version = PLUGIN_VERSION,
  33. url = ""
  34. };
  35.  
  36. public void OnPluginStart()
  37. {
  38. /*if(GetTime() > 1543536000)
  39. {
  40. SetFailState("Time's up!");
  41. return;
  42. }*/
  43. g_Game = GetEngineVersion();
  44. if(g_Game != Engine_CSGO)
  45. {
  46. SetFailState("This plugin is for CSGO/CSS only.");
  47. }
  48.  
  49. BuildPath(Path_SM, g_sEggConfig, sizeof(g_sEggConfig), "configs/eggs/eggs.cfg");
  50. HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
  51. HookEvent("player_spawn", Event_PlayerSpawn);
  52.  
  53. for(new i=1;i <= MaxClients;i++)
  54. {
  55. if(!IsClientInGame(i))
  56. continue;
  57.  
  58. OnClientPutInServer(i);
  59. }
  60. }
  61.  
  62. public OnClientPutInServer(client)
  63. {
  64. SDKHook(client, SDKHook_OnTakeDamage, Event_OnTakeDamage);
  65. //SDKHook(client, SDKHook_SetTransmit, Event_ShouldSeeTarget);
  66. }
  67.  
  68. public OnClientDisconnected(client)
  69. {
  70. if(TIMER_REMOVEDRUGS[client] != INVALID_HANDLE)
  71. {
  72. CloseHandle(TIMER_REMOVEDRUGS[client]);
  73. TIMER_REMOVEDRUGS[client] = INVALID_HANDLE;
  74. }
  75. }
  76. /*
  77. public Action:Hook_ShouldSeePlayer(client, viewer)
  78. {
  79. if(!isInvisible[client]
  80.  
  81. else if(!IsPlayerAlive(viewer))
  82. return Plugin_Continue;
  83.  
  84. else if(GetClientTeam(client) == GetClientTeam(viewer))
  85. return Plugin_Continue;
  86.  
  87. }
  88. */
  89. public Action:Event_OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
  90. {
  91. if(victim == 0)
  92. return Plugin_Continue;
  93.  
  94. else if(!IsValidPlayer(attacker))
  95. return Plugin_Continue;
  96.  
  97. if(isVampire[attacker])
  98. SetEntProp(attacker, Prop_Send, "m_iHealth", GetEntProp(attacker, Prop_Send, "m_iHealth") + RoundFloat(damage));
  99.  
  100. if(isOneHitKnifer[attacker])
  101. {
  102. damage = 65535.0;
  103. return Plugin_Changed;
  104. }
  105.  
  106. return Plugin_Continue;
  107. }
  108. public void OnMapStart()
  109. {
  110. for(new i=0;i < MAXPLAYERS+1;i++)
  111. {
  112. isOneHitKnifer[i] = false;
  113. isVampire[i] = false;
  114. isInvisible[i] = false;
  115. }
  116. AddFileToDownloadsTable("materials/models/custom_prop/IDEAS/banner/8TanLRyg.vmt");
  117. AddFileToDownloadsTable("materials/models/custom_prop/IDEAS/banner/8TanLRyg.vtf");
  118.  
  119. AddFileToDownloadsTable("models/custom_prop/IDEAS/banner/banner.dx90.vtx");
  120. AddFileToDownloadsTable("models/custom_prop/IDEAS/banner/banner.mdl");
  121.  
  122. AddFileToDownloadsTable("sound/ideas/Bonus.wav");
  123. PrecacheSound("ideas/Bonus.wav");
  124.  
  125. }
  126.  
  127. public Action Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast)
  128. {
  129. int client = GetClientOfUserId(event.GetInt("userid"));
  130.  
  131. if(client != 0)
  132. {
  133. isOneHitKnifer[client] = false;
  134. isVampire[client] = false;
  135. isInvisible[client] = false;
  136.  
  137. if(TIMER_REMOVEDRUGS[client] != INVALID_HANDLE)
  138. {
  139. CloseHandle(TIMER_REMOVEDRUGS[client]);
  140. TIMER_REMOVEDRUGS[client] = INVALID_HANDLE;
  141. }
  142. }
  143. }
  144.  
  145. public Action Event_RoundStart(Handle event, const char[] name, bool dontBroadcast)
  146. {
  147. bTookEgg = false;
  148. for(int i = 0; i <= MaxClients; i++) OnVamp[i] = false;
  149. CreateTimer(0.3, Remove_TakenEggs);
  150. }
  151.  
  152. public Action Remove_TakenEggs(Handle tmr, any client)
  153. {
  154.  
  155. KeyValues kv = CreateKeyValues("Eggs");
  156. kv.ImportFromFile(g_sEggConfig);
  157.  
  158. if (kv.GotoFirstSubKey())
  159. {
  160. do
  161. {
  162. char found[10];
  163. kv.GetString("found", found, sizeof(found));
  164. int ifound = StringToInt(found);
  165.  
  166. if(ifound == 1)
  167. {
  168. char nameinconfig[120];
  169. kv.GetSectionName(nameinconfig, sizeof(nameinconfig));
  170.  
  171. int ent = 0;
  172. while ((ent = FindEntityByClassname(ent, "prop_dynamic")) != INVALID_ENT_REFERENCE) {
  173. if(IsValidEntity(ent) && IsValidEdict(ent)) {
  174. char entglobaname[50];
  175. Entity_GetGlobalName(ent, entglobaname, sizeof(entglobaname));
  176.  
  177. if (StrEqual(entglobaname, nameinconfig)) {
  178. if(IsValidEntity(ent)) {
  179. Entity_Kill(ent);
  180. }
  181. }
  182.  
  183. }
  184. }
  185.  
  186. }
  187.  
  188. } while (kv.GotoNextKey());
  189.  
  190. delete kv;
  191. }
  192.  
  193. }
  194.  
  195. public Action OnPlayerRunCmd(int client, int &iButtons, int &iImpulse, float fVelocity[3], float fAngles[3], int &iWeapon)
  196. {
  197. new PrevButtons = g_iPlayerPrevButtons[client];
  198.  
  199. g_iPlayerPrevButtons[client] = iButtons;
  200.  
  201. if(IsClientInGame(client) && IsPlayerAlive(client))
  202. {
  203. if(!(PrevButtons & IN_USE) && iButtons & IN_USE)
  204. {
  205. int egg = GetTargetBlock(client);
  206.  
  207. if(IsValidEntity(egg))
  208. {
  209. float EggOrg[3];
  210. float PlayerOrg[3];
  211.  
  212. GetEntPropVector(egg, Prop_Send, "m_vecOrigin", EggOrg);
  213. GetClientAbsOrigin(client, PlayerOrg);
  214.  
  215. float distance = GetVectorDistance(EggOrg, PlayerOrg);
  216.  
  217. if(distance < 80.0)
  218. {
  219. if(bTookEgg)
  220. {
  221. PrintToChat(client, "[IDEAS BONUS]\x07 Only one bonus is given per round, try the next round");
  222. return Plugin_Continue;
  223. }
  224. new randomOpponent = GetRandomEnemy(client);
  225.  
  226. if(randomOpponent == -1)
  227. return Plugin_Continue;
  228.  
  229. bTookEgg = true;
  230.  
  231. char eggname[120];
  232. Entity_GetGlobalName(egg, eggname, sizeof(eggname));
  233.  
  234. char username[128];
  235. char steamid64[40];
  236. char founder[168];
  237. GetClientName(client, username, sizeof(username));
  238. GetClientAuthId(client, AuthId_SteamID64, steamid64, sizeof(steamid64));
  239.  
  240.  
  241. Format(founder, sizeof(founder), "Username: %s | SteamID64: %s", username, steamid64);
  242. //EggIsFound(eggname, founder);
  243. //RemoveEggFromMap(egg);
  244. /*
  245. PrintToChatAll("\x3 \x4 [IDEAS] \x1 --------------------------------------");
  246. PrintToChatAll("\x3 \x4 [IDEAS] \x1 Website: https://www.ideas-team.fr/");
  247. PrintToChatAll("\x3 \x4 [IDEAS] \x1 Teamspeak : ts12.verygames.net:50886");
  248. PrintToChatAll("\x3 \x4 [IDEAS] \x1 Our servers : ");
  249. PrintToChatAll("\x3 \x4 [IDEAS] \x1 Hide and Seek : 51.254.26.200:27015 ");
  250. PrintToChatAll("\x3 \x4 [IDEAS] \x1 AIM - AWP : 54.37.240.37:27015");
  251. PrintToChatAll("\x3 \x4 [IDEAS] \x1 ONLY AWP : 54.37.240.37:27015");
  252. PrintToChatAll("\x3 \x4 [IDEAS] \x1 --------------------------------------");
  253. */
  254. // if(GetEntProp(egg, Prop_Send, "m_iMinHealthDmg") == 5)
  255. {
  256. // SetEntProp(egg, Prop_Send, "m_iMinHealthDmg", 1);
  257. if(GetClientTeam(client) == CS_TEAM_T)
  258. {
  259. switch(GetRandomInt(0, 8))
  260. {
  261. case 0:
  262. {
  263. GivePlayerItem(client, "weapon_awp");
  264. PrintToChatAll("[IDEAS BONUS] \x01Player\x07 %N\x01 has been given an\x07 awp!", client);
  265. EmitSoundToAll("ideas/Bonus.wav");
  266. }
  267. case 1:
  268. {
  269. SetEntPropFloat(client, Prop_Send, "m_flLaggedMovementValue", 1.25);
  270. PrintToChatAll("[IDEAS BONUS] \x01Player\x07 %N\x01 has been given\x07 1.25x speed!", client);
  271. EmitSoundToAll("ideas/Bonus.wav");
  272. }
  273. case 2:
  274. {
  275. SetEntProp(client, Prop_Send, "m_iHealth", 400);
  276. PrintToChatAll("[IDEAS BONUS] \x01Player\x07 %N\x01 has been given\x07 400 HP!", client);
  277. EmitSoundToAll("ideas/Bonus.wav");
  278. }
  279. case 3:
  280. {
  281. SetEntProp(randomOpponent, Prop_Send, "m_iHealth", 100);
  282. PrintToChatAll("[IDEAS BONUS] \x01Player\x07 %N\x01 gave opponent\x07 %N \x01 100 HP", client, randomOpponent);
  283. EmitSoundToAll("ideas/Bonus.wav");
  284. }
  285. case 4:
  286. {
  287. new uidOpponent = GetClientUserId(randomOpponent);
  288. ServerCommand("sm_drug #%i 1", uidOpponent);
  289. TIMER_REMOVEDRUGS[randomOpponent] = CreateTimer(60.0, RemoveDrugs, uidOpponent, TIMER_FLAG_NO_MAPCHANGE);
  290. PrintToChatAll("[IDEAS BONUS] \x01Player\x07 %N\x01 gave opponent\x07 %N \x01 drugged vision during 1min", client, randomOpponent);
  291. EmitSoundToAll("ideas/Bonus.wav");
  292. }
  293. case 5:
  294. {
  295. GivePlayerItem(client, "weapon_sawedoff");
  296. PrintToChatAll("[IDEAS BONUS] \x01Player\x07 %N\x01 has been given \x07 sawed-off", client);
  297. EmitSoundToAll("ideas/Bonus.wav");
  298. }
  299. case 6:
  300. {
  301. GivePlayerItem(client, "weapon_knife");
  302. isOneHitKnifer[client] = true;
  303. PrintToChatAll("[IDEAS BONUS] \x01Player\x07 %N\x01 has been given the ability \x07to one-hit his opponents!", client);
  304. EmitSoundToAll("ideas/Bonus.wav");
  305. }
  306. case 7:
  307. {
  308. SetEntityRenderMode(client, RENDER_TRANSCOLOR);
  309. SetEntityRenderColor(client, 255, 255, 255, 40);
  310. PrintToChatAll("[IDEAS BONUS] \x01Player\x07 %N\x01 has been \x07 invisible", client);
  311. EmitSoundToAll("ideas/Bonus.wav");
  312. }
  313. case 8:
  314. {
  315. GivePlayerItem(client, "weapon_deagle");
  316. PrintToChatAll("[IDEAS BONUS] \x01Player\x07 %N\x01 has been given \x07 deagle", client);
  317. EmitSoundToAll("ideas/Bonus.wav");
  318. }
  319. }
  320. }
  321. else if(GetClientTeam(client) == CS_TEAM_CT)
  322. {
  323. switch(GetRandomInt(0, 9))
  324. {
  325. case 0:
  326. {
  327. GivePlayerItem(client, "weapon_deagle");
  328. PrintToChatAll("[IDEAS BONUS] \x01Player\x07 %N\x01 has been given \x07 deagle", client);
  329. EmitSoundToAll("ideas/Bonus.wav");
  330. }
  331. case 1:
  332. {
  333. UC_SetClientGodmode(client, true);
  334. PrintToChatAll("[IDEAS BONUS] \x01Player\x07 %N\x01 has been given \x07 Godmode!", client);
  335. EmitSoundToAll("ideas/Bonus.wav");
  336. }
  337. case 2:
  338. {
  339. ServerCommand("sm_beacon #%i", GetClientUserId(randomOpponent));
  340. PrintToChatAll("[IDEAS BONUS] \x01Player\x07 %N\x01 gave opponent\x07 %N \x01 beacon!", client, randomOpponent);
  341. EmitSoundToAll("ideas/Bonus.wav");
  342. }
  343. case 3:
  344. {
  345. SetEntProp(randomOpponent, Prop_Send, "m_iHealth", 1);
  346. PrintToChatAll("[IDEAS BONUS] \x01Player\x07 %N\x01 gave opponent\x07 %N \x01 1 HP!", client, randomOpponent);
  347. EmitSoundToAll("ideas/Bonus.wav");
  348. }
  349. case 4:
  350. {
  351. isVampire[client] = true;
  352. PrintToChatAll("[IDEAS BONUS] \x01Player\x07 %N\x01 has been given \x07Vampiric Life-Steal!", client);
  353. EmitSoundToAll("ideas/Bonus.wav");
  354. }
  355. case 5:
  356. {
  357. isOneHitKnifer[client] = true;
  358. PrintToChatAll("[IDEAS BONUS] \x01Player\x07 %N\x01 has been given the ability \x07to one-hit his opponents!", client);
  359. EmitSoundToAll("ideas/Bonus.wav");
  360. }
  361. case 6:
  362. {
  363. new uidOpponent = GetClientUserId(randomOpponent);
  364. ServerCommand("sm_drug #%i 1", uidOpponent);
  365. TIMER_REMOVEDRUGS[randomOpponent] = CreateTimer(60.0, RemoveDrugs, uidOpponent, TIMER_FLAG_NO_MAPCHANGE);
  366. PrintToChatAll("[IDEAS BONUS] \x01Player\x07 %N\x01 gave opponent\x07 %N \x01 drugged vision during 1min", client, randomOpponent);
  367. EmitSoundToAll("ideas/Bonus.wav");
  368. }
  369. case 7:
  370. {
  371. GivePlayerItem(client, "weapon_sawedoff");
  372. PrintToChatAll("[IDEAS BONUS] \x01Player\x07 %N\x01 has been given \x07 sawed-off", client);
  373. EmitSoundToAll("ideas/Bonus.wav");
  374. }
  375. case 8:
  376. {
  377. SetEntityRenderMode(client, RENDER_TRANSCOLOR);
  378. SetEntityRenderColor(client, 255, 255, 255, 40);
  379. PrintToChatAll("[IDEAS BONUS] \x01Player\x07 %N\x01 has been \x07 invisible", client);
  380. EmitSoundToAll("ideas/Bonus.wav");
  381. }
  382. case 9:
  383. {
  384. GivePlayerItem(client, "weapon_awp");
  385. PrintToChatAll("[IDEAS BONUS] \x01Player\x07 %N\x01 has been given an\x07 awp!", client);
  386. EmitSoundToAll("ideas/Bonus.wav");
  387. }
  388. }
  389. }
  390. }
  391. }
  392.  
  393. }
  394. }
  395. }
  396.  
  397. return Plugin_Continue;
  398. }
  399.  
  400. public Action:RemoveDrugs(Handle:hTimer, UserId)
  401. {
  402. new client = GetClientOfUserId(UserId);
  403.  
  404. if(client == 0)
  405. return Plugin_Stop;
  406.  
  407. ServerCommand("sm_drug #%i 0", UserId);
  408. TIMER_REMOVEDRUGS[client] = INVALID_HANDLE;
  409.  
  410. return Plugin_Stop;
  411. }
  412. int GetRandomEnemy(int client)
  413. {
  414. int clients[32], count;
  415. for(int i = 1; i <= MaxClients; i++)
  416. {
  417. if(IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) != GetClientTeam(client))
  418. {
  419. clients[count] = i;
  420. count++;
  421. }
  422. }
  423. return count > 0 ? clients[GetRandomInt(0, count-1)] : -1;
  424. }
  425.  
  426. public void EggIsFound(char eggname[120], char founder[168])
  427. {
  428.  
  429. KeyValues kv = CreateKeyValues("Eggs");
  430. kv.ImportFromFile(g_sEggConfig);
  431.  
  432. if (kv.GotoFirstSubKey())
  433. {
  434. char nameinconfig[120];
  435. do
  436. {
  437. kv.GetSectionName(nameinconfig, sizeof(nameinconfig));
  438.  
  439. if(StrEqual(nameinconfig, eggname))
  440. {
  441. kv.SetString("found", "1");
  442. kv.SetString("founder", founder);
  443. kv.Rewind();
  444. kv.ExportToFile(g_sEggConfig);
  445. }
  446.  
  447. } while (kv.GotoNextKey());
  448.  
  449. delete kv;
  450.  
  451. }
  452.  
  453. }
  454.  
  455. public void RemoveEggFromMap(int entity)
  456. {
  457.  
  458. if(IsValidEntity(entity))
  459. AcceptEntityInput(entity, "Kill");
  460.  
  461. }
  462.  
  463.  
  464. public bool IsAdmin(int client)
  465. {
  466. if(Client_HasAdminFlags(client, ADMFLAG_GENERIC) || Client_HasAdminFlags(client, ADMFLAG_ROOT) || Client_HasAdminFlags(client, ADMFLAG_BAN))
  467. return true;
  468. else return false;
  469. }
  470.  
  471.  
  472. int GetTargetBlock(int client)
  473. {
  474. int entity = GetClientAimTarget(client, false);
  475. if (IsValidEntity(entity))
  476. {
  477. char classname[32];
  478. GetEdictClassname(entity, classname, 32);
  479.  
  480. if (StrContains(classname, "prop_dynamic") != -1)
  481. return entity;
  482. }
  483. return -1;
  484. }
  485.  
  486.  
  487. stock UC_SetClientGodmode(client, bool:godmode)
  488. {
  489. if(godmode)
  490. SetEntProp(client, Prop_Data, "m_takedamage", 0, 1);
  491.  
  492. else
  493. SetEntProp(client, Prop_Data, "m_takedamage", 2, 1);
  494. }
  495.  
  496.  
  497. stock bool:IsValidPlayer(client)
  498. {
  499. if(client <= 0)
  500. return false;
  501.  
  502. else if(client > MaxClients)
  503. return false;
  504.  
  505. return IsClientInGame(client);
  506. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement