hlmod.hu
https://hlmod.hu/

sebbeség mérő
https://hlmod.hu/viewtopic.php?f=29&t=23453
Oldal: 1 / 1

Szerző:  Troy [ 2016.01.06. 17:35 ]
Hozzászólás témája:  sebbeség mérő

[ablak]
  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.  
  15. public plugin_init() {
  16.     register_plugin(PLUGIN, VERSION, AUTHOR)
  17.     register_cvar("AcidoX", "Speedometer 1.1", FCVAR_SERVER)
  18.    
  19.     register_forward(FM_Think, "Think")
  20.  
  21.    
  22.     TaskEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))  
  23.     set_pev(TaskEnt, pev_classname, "speedometer_think")
  24.     set_pev(TaskEnt, pev_nextthink, get_gametime() + 1.01)
  25.  
  26.     register_clcmd("say /speed", "toogleSpeed")
  27.  
  28.     showspeed = register_cvar("showspeed", "1")
  29.     color = register_cvar("speed_colors", "0 170 255")
  30.  
  31.     SyncHud = CreateHudSyncObj()
  32.  
  33.     maxplayers = get_maxplayers()
  34.  
  35.     new colors[16], red[4], green[4], blue[4]
  36.    
  37.     get_pcvar_string(color, colors, sizeof colors - 1)
  38.     parse(colors, red, 3, green, 3, blue, 3)
  39.     r = str_to_num(red)
  40.     g = str_to_num(green)
  41.     b = str_to_num(blue)
  42. }
  43.  
  44. public Think(ent)
  45. {
  46.    
  47.     if(ent == TaskEnt)
  48.     {
  49.         SpeedTask()
  50.         set_pev(ent, pev_nextthink,  get_gametime() + FREQ)
  51.     }
  52. }
  53.  
  54. public client_putinserver(id)
  55. {
  56.     plrSpeed[id] = showspeed > 0 ? true : false
  57. }
  58.  
  59. public toogleSpeed(id)
  60. {
  61.     plrSpeed[id] = plrSpeed[id] ? false : true
  62.     return PLUGIN_HANDLED
  63. }
  64.  
  65. SpeedTask()
  66. {
  67.     static i, target
  68.     static Float:velocity[3]
  69.     static Float:speed, Float:speedh
  70.  
  71.     for(i=1; i<=maxplayers; i++)
  72.     {
  73.         if(!is_user_connected(i)) continue
  74.         if(!plrSpeed[i]) continue
  75.  
  76.         target = pev(i, pev_iuser1) == 4 ? pev(i, pev_iuser2) : i
  77.         pev(target, pev_velocity, velocity)
  78.  
  79.         speed = vector_length(velocity)
  80.         speedh = floatsqroot(floatpower(velocity[0], 2.0) + floatpower(velocity[1], 2.0))
  81.  
  82.         set_hudmessage(0, 170, 255,  -1.0, 0.7, 1, 0.0, FREQ, 0.01, 0.0)
  83.         ShowSyncHudMsg(i, SyncHud, ".:[H]ar[D]:.^n%.1f SebessĂ©g^n%.0f KM/H", speed, speedh / 15)
  84.     }
  85. }
  86. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  87. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1038\\ f0\\ fs16 \n\\ par }
  88. */
[/ablak]


hy valaki tudna segíteni nekem abban hogy a ct-knek kék legyen a sebbeség mérő a teroristáknak pedig sárga!

Szerző:  kiki [ 2016.01.06. 18:06 ]
Hozzászólás témája:  Re: sebbeség mérő

  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, maxplayers
  13.  
  14.  
  15. public plugin_init() {
  16.     register_plugin(PLUGIN, VERSION, AUTHOR)
  17.     register_cvar("AcidoX", "Speedometer 1.1", FCVAR_SERVER)
  18.    
  19.     register_forward(FM_Think, "Think")
  20.  
  21.    
  22.     TaskEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))  
  23.     set_pev(TaskEnt, pev_classname, "speedometer_think")
  24.     set_pev(TaskEnt, pev_nextthink, get_gametime() + 1.01)
  25.  
  26.     register_clcmd("say /speed", "toogleSpeed")
  27.  
  28.     showspeed = register_cvar("showspeed", "1")
  29.  
  30.     SyncHud = CreateHudSyncObj()
  31.  
  32.     maxplayers = get_maxplayers()
  33. }
  34.  
  35. public Think(ent)
  36. {
  37.    
  38.     if(ent == TaskEnt)
  39.     {
  40.         SpeedTask()
  41.         set_pev(ent, pev_nextthink,  get_gametime() + FREQ)
  42.     }
  43. }
  44.  
  45. public client_putinserver(id)
  46. {
  47.     plrSpeed[id] = showspeed > 0 ? true : false
  48. }
  49.  
  50. public toogleSpeed(id)
  51. {
  52.     plrSpeed[id] = plrSpeed[id] ? false : true
  53.     return PLUGIN_HANDLED
  54. }
  55.  
  56. SpeedTask()
  57. {
  58.     static i, target
  59.     static Float:velocity[3]
  60.     static Float:speed, Float:speedh
  61.  
  62.     for(i=1; i<=maxplayers; i++)
  63.     {
  64.         if(!is_user_connected(i)) continue
  65.         if(!plrSpeed[i]) continue
  66.  
  67.         target = pev(i, pev_iuser1) == 4 ? pev(i, pev_iuser2) : i
  68.         pev(target, pev_velocity, velocity)
  69.  
  70.         speed = vector_length(velocity)
  71.         speedh = floatsqroot(floatpower(velocity[0], 2.0) + floatpower(velocity[1], 2.0))
  72.         new Team = get_user_team(i)
  73.         switch(Team)
  74.         {
  75.             case 1: set_hudmessage(255, 216, 61,  -1.0, 0.7, 1, 0.0, FREQ, 0.01, 0.0)
  76.             case 2: set_hudmessage(0, 0, 255,  -1.0, 0.7, 1, 0.0, FREQ, 0.01, 0.0)
  77.         }  
  78.  
  79.         ShowSyncHudMsg(i, SyncHud, ".:[H]ar[D]:.^n%.1f SebessĂ©g^n%.0f KM/H", speed, speedh / 15)
  80.     }
  81. }

Szerző:  Troy [ 2016.01.06. 19:36 ]
Hozzászólás témája:  Re: sebbeség mérő

köszönöm nagyon jó! Még annyi kérdésem lenne hogy a km/h pl ki iratnám hogy Hard és pl ha 600 főlé megy a sebbesége akkor át vált kékre de ez egy külön hud massege pl 1900 akkor a hard szine az piros legyen! "sry a fogalmazásért xd"

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