hlmod.hu
https://hlmod.hu/

Sebi mérő
https://hlmod.hu/viewtopic.php?f=9&t=17335
Oldal: 1 / 2

Szerző:  NuD[!]e [ 2014.09.15. 19:41 ]
Hozzászólás témája:  Sebi mérő

Vki meg tudna nekem csinálni 1 olyan sebességmérő-t hogy Sebbeséged:1000
KM/H:21

Szerző:  beautifuL [ 2014.09.17. 16:48 ]
Hozzászólás témája:  Re: Sebi mérő

Ez?
SMA Forráskód: [ Mindet kijelol ]
  1. new colors[16], red[4], green[4], blue[4]
  2. get_pcvar_string(color, colors, sizeof colors - 1)
  3. parse(colors, red, 3, green, 3, blue, 3)
  4. r = str_to_num(red)
  5. g = str_to_num(green)
  6. b = str_to_num(blue)
  7. }
  8.  
  9. public Think(ent)
  10. {
  11. if(ent == TaskEnt)
  12. {
  13. SpeedTask()
  14. set_pev(ent, pev_nextthink, get_gametime() + FREQ)
  15. }
  16. }
  17.  
  18. public client_putinserver(id)
  19. {
  20. plrSpeed[id] = showspeed > 0 ? true : false
  21. }
  22.  
  23. public toogleSpeed(id)
  24. {
  25. plrSpeed[id] = plrSpeed[id] ? false : true
  26. return PLUGIN_HANDLED
  27. }
  28.  
  29. SpeedTask()
  30. {
  31. static i, target
  32. static Float:velocity[3]
  33. static Float:speed, Float:speedh
  34.  
  35. for(i=1; i<=maxplayers; i++)
  36. {
  37. if(!is_user_connected(i)) continue
  38. if(!plrSpeed[i]) continue
  39.  
  40. target = pev(i, pev_iuser1) == 4 ? pev(i, pev_iuser2) : i
  41. pev(target, pev_velocity, velocity)
  42.  
  43. speed = vector_length(velocity)
  44. speedh = floatsqroot(floatpower(velocity[0], 2.0) + floatpower(velocity[1], 2.0))
  45.  
  46. set_hudmessage(r, g, b, -1.0, 0.7, 0, 0.0, FREQ, 0.01, 0.0)
  47. ShowSyncHudMsg(i, SyncHud, "%3.2f Sebesseg^n%3.2f km/h", speedh, speedh / 16)
  48. }
  49. }
  50. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  51.   *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1038\\ f0\\ fs16 \n\\ par }
  52.   */
  53.  

Szerző:  IrOn [ 2014.09.17. 18:03 ]
Hozzászólás témája:  Re: Sebi mérő

https://www.google.hu/search?q=1km+in+y ... 3&ie=UTF-8
:) ennyivel ossz :D

Szerző:  NuD[!]e [ 2014.09.17. 18:15 ]
Hozzászólás témája:  Re: Sebi mérő

Nem erre gondoltam!:S

Szerző:  V!rusHD [ 2014.09.19. 12:56 ]
Hozzászólás témája:  Re: Sebi mérő

Tessék:
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", "0 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, Float: kmh
  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. kmh = speedh / 60
  77.  
  78. set_hudmessage(r, g, b, -1.0, 0.7, 0, 0.0, FREQ, 0.01, 0.0)
  79. ShowSyncHudMsg(i, SyncHud, " [B]om[B]a^n%3.2f Sebesseg^n%.0f KM/H", speed, kmh)
  80. }
  81. }
  82.  
  83. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  84. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1038\\ f0\\ fs16 \n\\ par }
  85. */
  86.  

Szerző:  NuD[!]e [ 2014.09.19. 13:49 ]
Hozzászólás témája:  Re: Sebi mérő

Nem mutatja a KM/h-t! :SS 0-át ir!

Szerző:  V!rusHD [ 2014.09.19. 14:22 ]
Hozzászólás témája:  Re: Sebi mérő

Nekem ez így müködik...talán valamit elírtál benne és azzért nemjó.

Szerző:  fuck604 [ 2014.09.27. 02:44 ]
Hozzászólás témája:  Re: Sebi mérő

V!rusHD írta:
Nekem ez így müködik...talán valamit elírtál benne és azzért nemjó.


elég régóta nem láttam pawn kódót de kétlem hogy ez jó

SMA Forráskód: [ Mindet kijelol ]
  1. ShowSyncHudMsg(i, SyncHud, " [B]om[B]a^n%3.2f Sebesseg^n%.0f KM/H", speed, kmh)


nem értem h ezek mik akarnak lennni benne

SMA Forráskód: [ Mindet kijelol ]
  1. %3.2f
  2. %.0f

Szerző:  CrB [ 2014.09.27. 07:32 ]
Hozzászólás témája:  Re: Sebi mérő

kiki írta:
%.0f -> Lebegopontos szám, és a tizedesjegyek mérete. (1 ha 1 tizedsjegyet jelzünk ki, és így tovább...) *
* Ezt akkor használjuk, ha egy lebegopontos változónál nem akarjuk a tizedesjegyeket kijelezni, tehát a "166.5453453453453" helyett csak "166" -ot ír ki, nem keverendo össze a %d -vel, hisz az nem képes a "Float:" változók fogadására

Szerző:  Somterno [ 2014.09.27. 22:03 ]
Hozzászólás témája:  Re: Sebi mérő

Ennek jónak kell lennie.

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 Sebesség^n%3.2f km/h", speedh, speedh / 16)
  79. }
  80. }
  81. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  82. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1038\\ f0\\ fs16 \n\\ par }
  83. */
  84.  
  85. stock print_color(const id, const input[], any:...)
  86. {
  87. new count = 1, players[32]
  88. static msg[191]
  89. vformat(msg, 190, input, 3)
  90.  
  91. replace_all(msg, 190, "!g", "^4")
  92. replace_all(msg, 190, "!y", "^1")
  93. replace_all(msg, 190, "!t", "^3")
  94. replace_all(msg, 190, "á", "á")
  95. replace_all(msg, 190, "é", "Ă©")
  96. replace_all(msg, 190, "í", "Ă­")
  97. replace_all(msg, 190, "ó", "Ăł")
  98. replace_all(msg, 190, "ö", "ö")
  99. replace_all(msg, 190, "ő", "Ĺ‘")
  100. replace_all(msg, 190, "ú", "Ăş")
  101. replace_all(msg, 190, "ü", "ĂĽ")
  102. replace_all(msg, 190, "ű", "ű")
  103. replace_all(msg, 190, "Á", "Á")
  104. replace_all(msg, 190, "É", "É")
  105. replace_all(msg, 190, "Í", "ĂŤ")
  106. replace_all(msg, 190, "Ó", "Ă“")
  107. replace_all(msg, 190, "Ö", "Ă–")
  108. replace_all(msg, 190, "Ő", "Ő")
  109. replace_all(msg, 190, "Ú", "Ăš")
  110. replace_all(msg, 190, "Ü", "Ăś")
  111. replace_all(msg, 190, "Ű", "Ĺ°")
  112.  
  113. if (id) players[0] = id; else get_players(players, count, "ch")
  114. {
  115. for (new i = 0; i < count; i++)
  116. {
  117. if (is_user_connected(players[i]))
  118. {
  119. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
  120. write_byte(players[i])
  121. write_string(msg)
  122. message_end()
  123. }
  124. }
  125. }
  126. return PLUGIN_HANDLED
  127. }
  128.  

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