hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.05.07. 18:56



Jelenlévő felhasználók

Jelenleg 338 felhasználó van jelen :: 1 regisztrált, 0 rejtett és 337 vendég

A legtöbb felhasználó (1565 fő) 2020.11.21. 11:26-kor tartózkodott itt.

Regisztrált felhasználók: Google [Bot] az elmúlt 5 percben aktív felhasználók alapján

Utoljára aktív
Ahhoz hogy lásd ki volt utoljára aktív, be kell jelentkezned.



Az oldal teljeskörű
használatához regisztrálj.

Regisztráció

Kereső


Új téma nyitása  Hozzászólás a témához  [ 2 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: 2 plugin egybe írása
HozzászólásElküldve: 2015.04.18. 23:01 
Offline
Senior Tag

Csatlakozott: 2013.07.29. 13:15
Hozzászólások: 233
Megköszönt másnak: 125 alkalommal
Valaki ebbe a bunny pluginba bele írná a sebesség mérőt?

Bunny ((ebbe kellene a sebesség mérőt bele írni))
SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <engine>
  3. #include <colorchat>
  4.  
  5. #define FL_WATERJUMP (1<<11) // player jumping out of water
  6. #define FL_ONGROUND (1<<9) // At rest / on the ground
  7.  
  8. public plugin_init() {
  9. register_plugin("Super Bunny Hopper", "1.2", "Cheesy Peteza")
  10. register_cvar("sbhopper_version", "1.2", FCVAR_SERVER)
  11.  
  12. register_cvar("bh_enabled", "1")
  13. register_cvar("bh_autojump", "1")
  14. register_cvar("bh_showusage", "1")
  15. }
  16.  
  17. public client_PreThink(id) {
  18. if (!get_cvar_num("bh_enabled"))
  19. return PLUGIN_CONTINUE
  20.  
  21. entity_set_float(id, EV_FL_fuser2, 0.0) // Disable slow down after jumping
  22.  
  23. if (!get_cvar_num("bh_autojump"))
  24. return PLUGIN_CONTINUE
  25.  
  26. // Code from CBasePlayer::Jump (player.cpp) Make a player jump automatically
  27. if (entity_get_int(id, EV_INT_button) & 2) { // If holding jump
  28. new flags = entity_get_int(id, EV_INT_flags)
  29.  
  30. if (flags & FL_WATERJUMP)
  31. return PLUGIN_CONTINUE
  32. if ( entity_get_int(id, EV_INT_waterlevel) >= 2 )
  33. return PLUGIN_CONTINUE
  34. if ( !(flags & FL_ONGROUND) )
  35. return PLUGIN_CONTINUE
  36.  
  37. new Float:velocity[3]
  38. entity_get_vector(id, EV_VEC_velocity, velocity)
  39. velocity[2] += 250.0
  40. entity_set_vector(id, EV_VEC_velocity, velocity)
  41.  
  42. entity_set_int(id, EV_INT_gaitsequence, 6) // Play the Jump Animation
  43. }
  44. return PLUGIN_CONTINUE
  45. }
  46.  
  47. public client_authorized(id)
  48. set_task(30.0, "showUsage", id)
  49.  
  50. public showUsage(id) {
  51. if ( !get_cvar_num("bh_enabled") || !get_cvar_num("bh_showusage") )
  52. return PLUGIN_HANDLED
  53.  
  54. if ( !get_cvar_num("bh_autojump") ) {
  55. client_print(id, print_chat, "[AMXX] A nyulugras be van kapcsolva a szerveren. Ugras utan nem lassulsz le.")
  56. } else {
  57. ColorChat(id, GREEN, "[BHOP]-^1Hasznalata ^4W-A-S-D ^1melett, az ^4ugras ^1lenyomvatartasaval!")
  58. }
  59. return PLUGIN_HANDLED
  60. }


Sebesség mérő (Ezt a sebesség mérő ez kellene bele írni a bunnyhop pluginba)

SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <fakemeta>
  3.  
  4. #define PLUGIN "Speedometer"
  5. #define VERSION "1.2"
  6. #define AUTHOR "AciD"
  7.  
  8. #define FREQ 0.1
  9.  
  10. new bool:plrSpeed[33]
  11.  
  12. new TaskEnt,SyncHud,showspeed,color, maxplayers, r, g, b
  13.  
  14. public plugin_init() {
  15. register_plugin(PLUGIN, VERSION, AUTHOR)
  16. register_cvar("AcidoX", "Speedometer 1.1", FCVAR_SERVER)
  17. register_forward(FM_Think, "Think")
  18.  
  19. TaskEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
  20. set_pev(TaskEnt, pev_classname, "speedometer_think")
  21. set_pev(TaskEnt, pev_nextthink, get_gametime() + 1.01)
  22.  
  23. register_clcmd("say /speed", "toogleSpeed")
  24.  
  25. showspeed = register_cvar("showspeed", "1")
  26. color = register_cvar("speed_colors", "255 255 255")
  27.  
  28. SyncHud = CreateHudSyncObj()
  29.  
  30. maxplayers = get_maxplayers()
  31.  
  32. new colors[16], red[4], green[4], blue[4]
  33. get_pcvar_string(color, colors, sizeof colors - 1)
  34. parse(colors, red, 3, green, 3, blue, 3)
  35. r = str_to_num(red)
  36. g = str_to_num(green)
  37. b = str_to_num(blue)
  38. }
  39.  
  40. public Think(ent)
  41. {
  42. if(ent == TaskEnt)
  43. {
  44. SpeedTask()
  45. set_pev(ent, pev_nextthink, get_gametime() + FREQ)
  46. }
  47. }
  48.  
  49. public client_putinserver(id)
  50. {
  51. plrSpeed[id] = showspeed > 0 ? true : false
  52. }
  53.  
  54. public toogleSpeed(id)
  55. {
  56. plrSpeed[id] = plrSpeed[id] ? false : true
  57. return PLUGIN_HANDLED
  58. }
  59.  
  60. SpeedTask()
  61. {
  62. static i, target
  63. static Float:velocity[3]
  64. static Float:speed, Float:speedh
  65.  
  66. for(i=1; i<=maxplayers; i++)
  67. {
  68. if(!is_user_connected(i)) continue
  69. if(!plrSpeed[i]) continue
  70.  
  71. target = pev(i, pev_iuser1) == 4 ? pev(i, pev_iuser2) : i
  72. pev(target, pev_velocity, velocity)
  73.  
  74. speed = vector_length(velocity)
  75. speedh = floatsqroot(floatpower(velocity[0], 2.0) + floatpower(velocity[1], 2.0))
  76.  
  77. set_hudmessage(r, g, b, -1.0, 0.7, 0, 0.0, FREQ, 0.01, 0.0)
  78. ShowSyncHudMsg(i, SyncHud, "%3.2f Sebesseg^n%3.2f km/h", speedh, speedh / 16)
  79. }
  80. }
  81.  


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: 2 plugin egybe írása
HozzászólásElküldve: 2015.04.18. 23:56 
Offline
Senior Tag
Avatar

Csatlakozott: 2015.03.17. 21:45
Hozzászólások: 200
Megköszönt másnak: 12 alkalommal
Megköszönték neki: 21 alkalommal
SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <fakemeta>
  3. #include <engine>
  4. #include <colorchat>
  5.  
  6. #define PLUGIN "Speedometer"
  7. #define VERSION "1.2"
  8. #define AUTHOR "AciD"
  9.  
  10. #define FREQ 0.1
  11. #define FL_WATERJUMP (1<<11) // player jumping out of water
  12. #define FL_ONGROUND (1<<9) // At rest / on the ground
  13.  
  14. new bool:plrSpeed[33]
  15.  
  16. new TaskEnt,SyncHud,showspeed,color, maxplayers, r, g, b
  17.  
  18. public plugin_init() {
  19. register_plugin(PLUGIN, VERSION, AUTHOR)
  20. register_cvar("AcidoX", "Speedometer 1.1", FCVAR_SERVER)
  21. register_cvar("sbhopper_version", "1.2", FCVAR_SERVER)
  22. register_forward(FM_Think, "Think")
  23. register_cvar("bh_enabled", "1")
  24. register_cvar("bh_autojump", "1")
  25. register_cvar("bh_showusage", "1")
  26.  
  27. TaskEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
  28. set_pev(TaskEnt, pev_classname, "speedometer_think")
  29. set_pev(TaskEnt, pev_nextthink, get_gametime() + 1.01)
  30.  
  31. register_clcmd("say /speed", "toogleSpeed")
  32.  
  33. showspeed = register_cvar("showspeed", "1")
  34. color = register_cvar("speed_colors", "255 255 255")
  35.  
  36. SyncHud = CreateHudSyncObj()
  37.  
  38. maxplayers = get_maxplayers()
  39.  
  40. new colors[16], red[4], green[4], blue[4]
  41. get_pcvar_string(color, colors, sizeof colors - 1)
  42. parse(colors, red, 3, green, 3, blue, 3)
  43. r = str_to_num(red)
  44. g = str_to_num(green)
  45. b = str_to_num(blue)
  46. }
  47.  
  48. public Think(ent)
  49. {
  50. if(ent == TaskEnt)
  51. {
  52. SpeedTask()
  53. set_pev(ent, pev_nextthink, get_gametime() + FREQ)
  54. }
  55. }
  56.  
  57. public client_putinserver(id)
  58. {
  59. plrSpeed[id] = showspeed > 0 ? true : false
  60. }
  61.  
  62. public toogleSpeed(id)
  63. {
  64. plrSpeed[id] = plrSpeed[id] ? false : true
  65. return PLUGIN_HANDLED
  66. }
  67.  
  68. SpeedTask()
  69. {
  70. static i, target
  71. static Float:velocity[3]
  72. static Float:speed, Float:speedh
  73.  
  74. for(i=1; i<=maxplayers; i++)
  75. {
  76. if(!is_user_connected(i)) continue
  77. if(!plrSpeed[i]) continue
  78.  
  79. target = pev(i, pev_iuser1) == 4 ? pev(i, pev_iuser2) : i
  80. pev(target, pev_velocity, velocity)
  81.  
  82. speed = vector_length(velocity)
  83. speedh = floatsqroot(floatpower(velocity[0], 2.0) + floatpower(velocity[1], 2.0))
  84.  
  85. set_hudmessage(r, g, b, -1.0, 0.7, 0, 0.0, FREQ, 0.01, 0.0)
  86. ShowSyncHudMsg(i, SyncHud, "%3.2f Sebesseg^n%3.2f km/h", speedh, speedh / 16)
  87. }
  88. }
  89. public client_PreThink(id) {
  90. if (!get_cvar_num("bh_enabled"))
  91. return PLUGIN_CONTINUE
  92.  
  93. entity_set_float(id, EV_FL_fuser2, 0.0) // Disable slow down after jumping
  94.  
  95. if (!get_cvar_num("bh_autojump"))
  96. return PLUGIN_CONTINUE
  97.  
  98. // Code from CBasePlayer::Jump (player.cpp) Make a player jump automatically
  99. if (entity_get_int(id, EV_INT_button) & 2) { // If holding jump
  100. new flags = entity_get_int(id, EV_INT_flags)
  101.  
  102. if (flags & FL_WATERJUMP)
  103. return PLUGIN_CONTINUE
  104. if ( entity_get_int(id, EV_INT_waterlevel) >= 2 )
  105. return PLUGIN_CONTINUE
  106. if ( !(flags & FL_ONGROUND) )
  107. return PLUGIN_CONTINUE
  108.  
  109. new Float:velocity[3]
  110. entity_get_vector(id, EV_VEC_velocity, velocity)
  111. velocity[2] += 250.0
  112. entity_set_vector(id, EV_VEC_velocity, velocity)
  113.  
  114. entity_set_int(id, EV_INT_gaitsequence, 6) // Play the Jump Animation
  115. }
  116. return PLUGIN_CONTINUE
  117. }
  118.  
  119. public client_authorized(id)
  120. set_task(30.0, "showUsage", id)
  121.  
  122. public showUsage(id) {
  123. if ( !get_cvar_num("bh_enabled") || !get_cvar_num("bh_showusage") )
  124. return PLUGIN_HANDLED
  125.  
  126. if ( !get_cvar_num("bh_autojump") ) {
  127. client_print(id, print_chat, "[AMXX] A nyulugras be van kapcsolva a szerveren. Ugras utan nem lassulsz le.")
  128. } else {
  129. ColorChat(id, GREEN, "[BHOP]-^1Hasznalata ^4W-A-S-D ^1melett, az ^4ugras ^1lenyomvatartasaval!")
  130. }
  131. return PLUGIN_HANDLED
  132. }


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése:  Rendezés  
Új téma nyitása  Hozzászólás a témához  [ 2 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 43 vendég


Nyithatsz új témákat ebben a fórumban.
Válaszolhatsz egy témára ebben a fórumban.
Nem szerkesztheted a hozzászólásaidat ebben a fórumban.
Nem törölheted a hozzászólásaidat ebben a fórumban.
Nem küldhetsz csatolmányokat ebben a fórumban.

Keresés:
Ugrás:  
Powered by phpBB® Forum Software © phpBB Limited
Magyar fordítás © Magyar phpBB Közösség
Portal: Kiss Portal Extension © Michael O'Toole