hlmod.hu
https://hlmod.hu/

multijump
https://hlmod.hu/viewtopic.php?f=46&t=11416
Oldal: 1 / 1

Szerző:  jamil1986 [ 2013.10.27. 06:43 ]
Hozzászólás témája:  multijump

Helló, egy multijump plugint keresek csshez, valaki tudna lnikelni?

Szerző:  Anonymous1337 [ 2013.10.27. 10:49 ]
Hozzászólás témája:  Re: multijump

SMA Forráskód: [ Mindet kijelol ]
  1. /*
  2.  * Double Jump
  3.  *
  4.  * Description:
  5.  * Allows players to double-jump
  6.  * Original idea: NcB_Sav
  7.  *
  8.  * Convars:
  9.  * sm_doublejump_enabled [bool] : Enables or disable double-jumping. Default: 1
  10.  * sm_doublejump_boost [amount] : Amount to boost the player. Default: 250
  11.  * sm_doublejump_max [jumps] : Maximum number of re-jumps while airborne. Default: 1
  12.  *
  13.  * Changelog:
  14.  * v1.0.1
  15.  * Minor code optimization.
  16.  * v1.0.0
  17.  * Initial release.
  18.  *
  19.  * Known issues:
  20.  * Doesn't register all mouse-wheel triggered +jumps
  21.  *
  22.  * Todo:
  23.  * Employ upcoming OnClientCommand function to remove excess OnGameFrame-age.
  24.  *
  25.  * Contact:
  26.  * Paegus: paegus@gmail.com
  27.  * Hidden:Source: http://www.hidden-source.com
  28.  */
  29. #define PLUGIN_VERSION "1.0.1"
  30.  
  31. #include <sdktools>
  32.  
  33.  
  34. public Plugin:myinfo = {
  35. name = "Double Jump",
  36. author = "Paegus",
  37. description = "Allows double-jumping.",
  38. version = PLUGIN_VERSION,
  39. url = ""
  40. }
  41.  
  42. new
  43. Handle:g_cvJumpBoost = INVALID_HANDLE,
  44. Handle:g_cvJumpEnable = INVALID_HANDLE,
  45. Handle:g_cvJumpMax = INVALID_HANDLE,
  46. Float:g_flBoost = 250.0,
  47. bool:g_bDoubleJump = true,
  48. g_fLastButtons[MAXPLAYERS+1],
  49. g_fLastFlags[MAXPLAYERS+1],
  50. g_iJumps[MAXPLAYERS+1],
  51. g_iJumpMax
  52.  
  53. public OnPluginStart() {
  54. CreateConVar(
  55. "sm_doublejump_version", PLUGIN_VERSION,
  56. "Double Jump Version",
  57. FCVAR_PLUGIN|FCVAR_NOTIFY
  58. )
  59.  
  60. g_cvJumpEnable = CreateConVar(
  61. "sm_doublejump_enabled", "1",
  62. "Enables double-jumping.",
  63. FCVAR_PLUGIN|FCVAR_NOTIFY
  64. )
  65.  
  66. g_cvJumpBoost = CreateConVar(
  67. "sm_doublejump_boost", "250.0",
  68. "The amount of vertical boost to apply to double jumps.",
  69. FCVAR_PLUGIN|FCVAR_NOTIFY
  70. )
  71.  
  72. g_cvJumpMax = CreateConVar(
  73. "sm_doublejump_max", "1",
  74. "The maximum number of re-jumps allowed while already jumping.",
  75. FCVAR_PLUGIN|FCVAR_NOTIFY
  76. )
  77.  
  78. HookConVarChange(g_cvJumpBoost, convar_ChangeBoost)
  79. HookConVarChange(g_cvJumpEnable, convar_ChangeEnable)
  80. HookConVarChange(g_cvJumpMax, convar_ChangeMax)
  81.  
  82. g_bDoubleJump = GetConVarBool(g_cvJumpEnable)
  83. g_flBoost = GetConVarFloat(g_cvJumpBoost)
  84. g_iJumpMax = GetConVarInt(g_cvJumpMax)
  85. }
  86.  
  87. public convar_ChangeBoost(Handle:convar, const String:oldVal[], const String:newVal[]) {
  88. g_flBoost = StringToFloat(newVal)
  89. }
  90.  
  91. public convar_ChangeEnable(Handle:convar, const String:oldVal[], const String:newVal[]) {
  92. if (StringToInt(newVal) >= 1) {
  93. g_bDoubleJump = true
  94. } else {
  95. g_bDoubleJump = false
  96. }
  97. }
  98.  
  99. public convar_ChangeMax(Handle:convar, const String:oldVal[], const String:newVal[]) {
  100. g_iJumpMax = StringToInt(newVal)
  101. }
  102.  
  103. public OnGameFrame() {
  104. if (g_bDoubleJump) { // double jump active
  105. for (new i = 1; i <= MaxClients; i++) { // cycle through players
  106. if (
  107. IsClientInGame(i) && // is in the game
  108. IsPlayerAlive(i) // is alive
  109. ) {
  110. DoubleJump(i) // Check for double jumping
  111. }
  112. }
  113. }
  114. }
  115.  
  116. stock DoubleJump(const any:client) {
  117. new
  118. fCurFlags = GetEntityFlags(client), // current flags
  119. fCurButtons = GetClientButtons(client) // current buttons
  120.  
  121. if (g_fLastFlags[client] & FL_ONGROUND) { // was grounded last frame
  122. if (
  123. !(fCurFlags & FL_ONGROUND) && // becomes airbirne this frame
  124. !(g_fLastButtons[client] & IN_JUMP) && // was not jumping last frame
  125. fCurButtons & IN_JUMP // started jumping this frame
  126. ) {
  127. OriginalJump(client) // process jump from the ground
  128. }
  129. } else if ( // was airborne last frame
  130. fCurFlags & FL_ONGROUND // becomes grounded this frame
  131. ) {
  132. Landed(client) // process landing on the ground
  133. } else if ( // remains airborne this frame
  134. !(g_fLastButtons[client] & IN_JUMP) && // was not jumping last frame
  135. fCurButtons & IN_JUMP // started jumping this frame
  136. ) {
  137. ReJump(client) // process attempt to double-jump
  138. }
  139.  
  140. g_fLastFlags[client] = fCurFlags // update flag state for next frame
  141. g_fLastButtons[client] = fCurButtons // update button state for next frame
  142. }
  143.  
  144. stock OriginalJump(const any:client) {
  145. g_iJumps[client]++ // increment jump count
  146. }
  147.  
  148. stock Landed(const any:client) {
  149. g_iJumps[client] = 0 // reset jumps count
  150. }
  151.  
  152. stock ReJump(const any:client) {
  153. if ( 1 <= g_iJumps[client] <= g_iJumpMax) { // has jumped at least once but hasn't exceeded max re-jumps
  154. g_iJumps[client]++ // increment jump count
  155. decl Float:vVel[3]
  156. GetEntPropVector(client, Prop_Data, "m_vecVelocity", vVel) // get current speeds
  157.  
  158. vVel[2] = g_flBoost
  159. TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, vVel) // boost player
  160. }
  161. }
  162.  
  163.  


A plugin ki/be kapcsolása: "sm_doublejump_enabled", "1", // 63. sor

A maximum jump érték beállítása: "sm_doublejump_max", "1", // 75. sor

Remélem tudtam segíteni ;)

Üdv.
Anonymous1337

jamil1986 írta:
Helló, egy multijump plugint keresek csshez, valaki tudna lnikelni?

Szerző:  jamil1986 [ 2013.10.28. 06:27 ]
Hozzászólás témája:  Re: multijump

Köszi, megy!

Szerző:  hallywood [ 2013.12.18. 19:41 ]
Hozzászólás témája:  Re: multijump

Szia ez általában hostingoknál van a pluginok közt! :)

Szerző:  Alnilam [ 2013.12.19. 10:34 ]
Hozzászólás témája:  Re: multijump

Biztos, hogy nincs.

Oldal: 1 / 1 Minden időpont UTC+02:00 időzóna szerinti
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/