HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /*
  2.   Fordította: BBk
  3. */
  4.  
  5. // Original Script from Peagus
  6. // http://forums.alliedmods.net/showthread.php?p=895212
  7.  
  8. #include <sourcemod>
  9. #include <sdktools>
  10. #include <sdkhooks>
  11. #define PLUGIN_VERSION "1.3OPRC"
  12.  
  13. new g_iJumps[MAXPLAYERS+1]
  14. new g_iJumpMax
  15. new g_fLastButtons[MAXPLAYERS+1]
  16. new g_fLastFlags[MAXPLAYERS+1]
  17. new clientlevel[MAXPLAYERS+1]
  18. new Handle:g_cvJumpBoost = INVALID_HANDLE
  19. new Handle:g_cvJumpEnable = INVALID_HANDLE
  20. new Handle:g_cvJumpMax = INVALID_HANDLE
  21. new Handle:g_cvJumpKnife = INVALID_HANDLE
  22. new bool:g_bDoubleJump = true
  23. new Float:g_flBoost = 250.0
  24.  
  25. public Plugin:myinfo =
  26. {
  27. name = "CS:GO Double Jump",
  28. author = "Darkranger,(original Script from Peagus)",
  29. description = "Dupla Ugras minden jatekos szamara!",
  30. version = PLUGIN_VERSION,
  31. url = "http://dark.asmodis.at"
  32. }
  33.  
  34. public OnPluginStart()
  35. {
  36. CreateConVar("csgo_doublejump_version", PLUGIN_VERSION, "CS:GO Double Jump Version", FCVAR_PLUGIN | FCVAR_REPLICATED | FCVAR_NOTIFY | FCVAR_DONTRECORD)
  37. g_cvJumpKnife = CreateConVar("csgo_doublejump_knife", "1", "Dupla ugras csak Kes szinten engedelyezese/letiltasa (AR (GunGame))",FCVAR_PLUGIN, true, 0.0, true, 1.0)
  38. g_cvJumpEnable = CreateConVar("csgo_doublejump_enabled", "1", "Dupla ugras engedelyezese/letiltasa",FCVAR_PLUGIN)
  39. g_cvJumpBoost = CreateConVar("csgo_doublejump_boost", "300.0", "Az az ertek, ami ugrasnal felemeli a jatekost",FCVAR_PLUGIN, true, 260.0, true, 500.0)
  40. g_cvJumpMax = CreateConVar("csgo_doublejump_max", "1", "Maximalis ugrasok szama, amig a jatekos a levegobe van",FCVAR_PLUGIN, true, 1.0, true, 5.0)
  41. AutoExecConfig(true, "csgo_doublejump", "csgo_doublejump")
  42.  
  43. HookConVarChange(g_cvJumpBoost, convar_ChangeBoost)
  44. HookConVarChange(g_cvJumpEnable, convar_ChangeEnable)
  45. HookConVarChange(g_cvJumpMax, convar_ChangeMax)
  46. g_bDoubleJump = GetConVarBool(g_cvJumpEnable)
  47. g_flBoost = GetConVarFloat(g_cvJumpBoost)
  48. g_iJumpMax = GetConVarInt(g_cvJumpMax)
  49. HookEventEx("player_spawn", OnPlayerSpawn, EventHookMode_Post)
  50. }
  51.  
  52.  
  53. public OnClientPutInServer(client)
  54. {
  55. SDKHook(client, SDKHook_WeaponEquipPost, OnWeaponEquipPost)
  56. CreateTimer(20.0, Announce, client, TIMER_FLAG_NO_MAPCHANGE)
  57. CreateTimer(35.0, Announce, client, TIMER_FLAG_NO_MAPCHANGE)
  58. }
  59.  
  60. public OnWeaponEquipPost(client, weapon)
  61. {
  62. clientlevel[client] = 0
  63. if (g_cvJumpKnife)
  64. {
  65. if(LastLevel(client) == true)
  66. {
  67. clientlevel[client] = 1
  68. }
  69. }
  70. }
  71.  
  72. public OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
  73. {
  74. new client = GetClientOfUserId(GetEventInt(event, "userid"))
  75. clientlevel[client] = 0
  76. if (GetConVarInt(g_cvJumpKnife) == 1)
  77. {
  78. if(LastLevel(client) == true)
  79. {
  80. clientlevel[client] = 1
  81. }
  82. }
  83. }
  84.  
  85. public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
  86. {
  87. if (g_bDoubleJump)
  88. //if ((g_bDoubleJump) && (buttons & IN_FORWARD))
  89. {
  90. if ((g_cvJumpKnife) && ((clientlevel[client]) == 1))
  91. {
  92. DoubleJump(client)
  93. }
  94. if (GetConVarInt(g_cvJumpKnife) == 0)
  95. {
  96. DoubleJump(client)
  97. }
  98. }
  99. }
  100.  
  101.  
  102. stock DoubleJump(const any:client)
  103. {
  104. new fCurFlags = GetEntityFlags(client), fCurButtons = GetClientButtons(client)
  105. if (g_fLastFlags[client] & FL_ONGROUND)
  106. {
  107. if (!(fCurFlags & FL_ONGROUND) && !(g_fLastButtons[client] & IN_JUMP) && fCurButtons & IN_JUMP)
  108. {
  109. OriginalJump(client)
  110. }
  111. }
  112. else if (fCurFlags & FL_ONGROUND)
  113. {
  114. Landed(client)
  115. }
  116. else if (!(g_fLastButtons[client] & IN_JUMP) && fCurButtons & IN_JUMP)
  117. {
  118. ReJump(client)
  119. }
  120. g_fLastFlags[client] = fCurFlags
  121. g_fLastButtons[client] = fCurButtons
  122. }
  123.  
  124. stock OriginalJump(const any:client)
  125. {
  126. g_iJumps[client]++
  127. }
  128.  
  129. stock Landed(const any:client)
  130. {
  131. g_iJumps[client] = 0
  132. }
  133.  
  134. stock ReJump(const any:client)
  135. {
  136. if ( 1 <= g_iJumps[client] <= g_iJumpMax)
  137. {
  138. g_iJumps[client]++
  139. decl Float:vVel[3]
  140. GetEntPropVector(client, Prop_Data, "m_vecVelocity", vVel)
  141. vVel[2] = g_flBoost
  142. TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, vVel)
  143. }
  144. }
  145.  
  146. public convar_ChangeBoost(Handle:convar, const String:oldVal[], const String:newVal[])
  147. {
  148. g_flBoost = StringToFloat(newVal)
  149. }
  150.  
  151. public convar_ChangeEnable(Handle:convar, const String:oldVal[], const String:newVal[])
  152. {
  153. if (StringToInt(newVal) >= 1)
  154. {
  155. g_bDoubleJump = true
  156. }
  157. else
  158. {
  159. g_bDoubleJump = false
  160. }
  161. }
  162.  
  163. public convar_ChangeMax(Handle:convar, const String:oldVal[], const String:newVal[])
  164. {
  165. g_iJumpMax = StringToInt(newVal)
  166. }
  167.  
  168. public bool:LastLevel(client)
  169. {
  170. if(IsValidClient(client) && IsPlayerAlive(client))
  171. {
  172. new weapon_count = 0
  173. for(new i = 0; i <= 4; i++)
  174. {
  175. new wpn = GetPlayerWeaponSlot(client, i)
  176. if(wpn != -1)
  177. {
  178. weapon_count++
  179. }
  180. }
  181. if(weapon_count == 1)
  182. {
  183. // hat nur das Messer!
  184. return true
  185. }
  186. else
  187. {
  188. // noch weitere Waffen!
  189. return false
  190. }
  191. }
  192. return false
  193. }
  194.  
  195. public bool:IsValidClient(client)
  196. {
  197. if ( !( 1 <= client <= MaxClients ) || !IsClientInGame(client) )
  198. {
  199. return false
  200. }
  201. return true
  202. }
  203.  
  204. public Action:Announce(Handle:timer, any:client)
  205. {
  206. if (GetConVarInt(g_cvJumpKnife) == 1)
  207. {
  208. if(IsClientInGame(client) && !IsFakeClient(client))
  209. PrintToChat(client, "Dupla Ugras Kes Szinten Engedelyezve!")
  210. }
  211. if (GetConVarInt(g_cvJumpKnife) == 0)
  212. {
  213. if(IsClientInGame(client) && !IsFakeClient(client))
  214. PrintToChat(client, "Dupla Ugras Engedelyezve!")
  215. }
  216. return Plugin_Handled
  217. }
  218.