Advertisement
Guest User

Untitled

a guest
Oct 9th, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.42 KB | None | 0 0
  1. #pragma semicolon 1
  2.  
  3. #define PLUGIN_AUTHOR "Rachnus"
  4. #define PLUGIN_VERSION "1.03"
  5.  
  6. #include <sourcemod>
  7. #include <sdktools>
  8. #include <cstrike>
  9. #include <superheromod>
  10.  
  11. #pragma newdecls required
  12.  
  13. EngineVersion g_Game;
  14.  
  15. ConVar g_MorpheusLevel;
  16. ConVar g_MorpheusGravity;
  17. ConVar g_MorpheusFireRate;
  18.  
  19. int g_iHeroIndex;
  20. bool g_bHasMorpheus[MAXPLAYERS + 1];
  21.  
  22. public Plugin myinfo =
  23. {
  24. name = "SuperHero Mod CS:GO Hero - Morpheus",
  25. author = PLUGIN_AUTHOR,
  26. description = "Morpheus hero",
  27. version = PLUGIN_VERSION,
  28. url = "https://github.com/Rachnus"
  29. };
  30.  
  31. public void OnPluginStart()
  32. {
  33. g_Game = GetEngineVersion();
  34. if(g_Game != Engine_CSGO)
  35. {
  36. SetFailState("This plugin is for CSGO only.");
  37. }
  38. g_MorpheusLevel = CreateConVar("superheromod_morpheus_level", "8");
  39. g_MorpheusGravity = CreateConVar("superheromod_morpheus_gravity", "0.35", "Amount of gravity morpheus has");
  40. g_MorpheusFireRate = CreateConVar("superheromod_morpheus_attack_speed", "1.5", "Amount of times fire rate morpheus mp5 should have");
  41. AutoExecConfig(true, "morpheus", "sourcemod/superheromod");
  42.  
  43. HookEvent("weapon_fire", Event_WeaponFire, EventHookMode_Post);
  44.  
  45. g_iHeroIndex = SuperHero_CreateHero("Morpheus", g_MorpheusLevel.IntValue);
  46. SuperHero_SetHeroInfo(g_iHeroIndex, "Dual MP7's", "Lower Gravity/Dual MP7's/Unlimited Ammo");
  47. SuperHero_SetHeroPrimaryWeapon(g_iHeroIndex, view_as<int>(CSGOWeaponID_MP7));
  48. SuperHero_SetHeroGravity(g_iHeroIndex, g_MorpheusGravity.FloatValue);
  49. }
  50.  
  51. public void OnConfigsExecuted()
  52. {
  53. SuperHero_SetHeroAvailableLevel(g_iHeroIndex, g_MorpheusLevel.IntValue);
  54. SuperHero_SetHeroGravity(g_iHeroIndex, g_MorpheusGravity.FloatValue);
  55. }
  56.  
  57. public Action Event_WeaponFire(Event event, const char[] name, bool dontBroadcast)
  58. {
  59. RequestFrame(SetNextPrimaryAttack, event.GetInt("userid"));
  60. }
  61.  
  62. public void SetNextPrimaryAttack(any data)
  63. {
  64. int client = GetClientOfUserId(data);
  65.  
  66. if(!IsValidClient(client))
  67. return;
  68.  
  69. if(!g_bHasMorpheus[client])
  70. return;
  71.  
  72. int weapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
  73. if(weapon != INVALID_ENT_REFERENCE)
  74. {
  75. char szClassName[32];
  76. GetEntityClassname(weapon, szClassName, sizeof(szClassName));
  77. if(StrEqual(szClassName, "weapon_mp7"))
  78. {
  79. float nextAttack = GetGameTime() - GetEntPropFloat(weapon, Prop_Send, "m_flNextPrimaryAttack");
  80. nextAttack = FloatAbs(nextAttack);
  81. SetEntPropFloat(weapon, Prop_Send, "m_flNextPrimaryAttack", GetGameTime() + (nextAttack / g_MorpheusFireRate.FloatValue));
  82. SetEntProp(weapon, Prop_Send, "m_iClip1", 30);
  83. }
  84. }
  85. }
  86.  
  87. public void SuperHero_OnHeroInitialized(int client, int heroIndex, int mode)
  88. {
  89. if(heroIndex != g_iHeroIndex)
  90. return;
  91.  
  92. switch(mode)
  93. {
  94. case SH_HERO_ADD:
  95. {
  96. g_bHasMorpheus[client] = true;
  97. //Change model
  98. if(SuperHero_GetHighestPrimaryWeaponLevel(client) == view_as<int>(CSGOWeaponID_MP7))
  99. {
  100. StripPrimary(client);
  101. GivePlayerItem(client, "weapon_mp7");
  102. }
  103.  
  104. }
  105. case SH_HERO_DROP:
  106. {
  107. g_bHasMorpheus[client] = false;
  108. }
  109. }
  110. }
  111.  
  112. public void SuperHero_OnPlayerSpawned(int client, bool newroundspawn)
  113. {
  114. if(!g_bHasMorpheus[client])
  115. return;
  116.  
  117. if(SuperHero_GetHighestPrimaryWeaponLevel(client) == view_as<int>(CSGOWeaponID_MP7))
  118. {
  119. StripPrimary(client);
  120. GivePlayerItem(client, "weapon_mp7");
  121. }
  122. }
  123.  
  124. public bool OnClientConnect(int client, char[]rejectmsg, int maxlen)
  125. {
  126. g_bHasMorpheus[client] = false;
  127. return true;
  128. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement