hlmod.hu
https://hlmod.hu/

Színes Sebesség Mérőt
https://hlmod.hu/viewtopic.php?f=29&t=28394
Oldal: 1 / 1

Szerző:  rusky18 [ 2017.11.03. 12:04 ]
Hozzászólás témája:  Színes Sebesség Mérőt

Üdv erre a pluginra szeretném hogy váltogassa a színeket 0-500 gold 500-1000 lila 1000-2000 narancs 2000-20000 világos kék.
Aki segít megy a gomb!

Csatolmányok:
merov1.sma [2.23 KiB]
Letöltve 130 alkalommal.

Szerző:  Pika [ 2017.11.03. 12:24 ]
Hozzászólás témája:  Re: Színes Sebesség Mérőt

rusky18 írta:
Üdv erre a pluginra szeretném hogy váltogassa a színeket 0-500 gold 500-1000 lila 1000-2000 narancs 2000-20000 világos kék.
Aki segít megy a gomb!


Ebbe hiába írod bele, ha nincs lekérve az arany. Ezt a plugint átkell írnod abba, ahol lekérted az arany-at.
Ezután if-ekkel ellenörzöd, és használod ezeket az RGB kódokat.
http://www.rapidtables.com/web/color/RGB_Color.htm

Szerző:  Krisznitro [ 2017.11.04. 10:03 ]
Hozzászólás témája:  Re: Színes Sebesség Mérőt

Én switch-ekkel oldottam meg most, bár if-ekkel is meglehet. (Mind2 feltételelágazás). Remélem a színeket már testre tudod szabni.

  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.         switch(speed)
  78.         {
  79.             case 0..500: {
  80.                 set_hudmessage(r, g, b, -1.0, 0.7, 0, 0.0, FREQ, 0.01, 0.0)
  81.                 ShowSyncHudMsg(i, SyncHud, "%3.Gan[G]sta'S^n%3.2f Sebesseg", speed, speedh)
  82.             }
  83.             case 501..1000: {
  84.                 set_hudmessage(r, g, b, -1.0, 0.7, 0, 0.0, FREQ, 0.01, 0.0)
  85.                 ShowSyncHudMsg(i, SyncHud, "%3.Gan[G]sta'S^n%3.2f Sebesseg", speed, speedh)
  86.             }
  87.             case 1001..2000: {
  88.                 set_hudmessage(r, g, b, -1.0, 0.7, 0, 0.0, FREQ, 0.01, 0.0)
  89.                 ShowSyncHudMsg(i, SyncHud, "%3.Gan[G]sta'S^n%3.2f Sebesseg", speed, speedh)
  90.             }
  91.             case 2001..20000: {
  92.                 set_hudmessage(r, g, b, -1.0, 0.7, 0, 0.0, FREQ, 0.01, 0.0)
  93.                 ShowSyncHudMsg(i, SyncHud, "%3.Gan[G]sta'S^n%3.2f Sebesseg", speed, speedh)
  94.             }
  95.         }
  96.     }
  97. }
  98. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  99. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1038\\ f0\\ fs16 \n\\ par }
  100. */

Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team

Header size: 612 bytes
Code size: 162512 bytes
Data size: 876 bytes
Stack/heap size: 16384 bytes; estimated max. usage=43 cells (172 bytes)
Total requirements: 180384 bytes
Done.


UI.:
Pika írta:
Ebbe hiába írod bele, ha nincs lekérve az arany. Ezt a plugint átkell írnod abba, ahol lekérted az arany-at.


Szerintem ő aranyra nem mint változóként gondolt, hanem színként:)

Szerző:  rusky18 [ 2017.11.04. 11:41 ]
Hozzászólás témája:  Re: Színes Sebesség Mérőt

valamiért nem fordul le.

Csatolmányok:
merosv1.sma [3.21 KiB]
Letöltve 106 alkalommal.

Szerző:  Krisznitro [ 2017.11.04. 14:32 ]
Hozzászólás témája:  Re: Színes Sebesség Mérőt

rusky18 írta:
valamiért nem fordul le.

A végén volt valami hülyeség, sztem azt is hozzámásoltad a forráskódhoz. Feltöltöttem csatolmányként most már. A fordító még max. figyelmeztetést ír, de azzal együtt is jónak kell lennie.

Csatolmányok:
merosv12.sma [2.91 KiB]
Letöltve 149 alkalommal.

Szerző:  rusky18 [ 2017.11.07. 12:51 ]
Hozzászólás témája:  Re: Színes Sebesség Mérőt

Ezt Írja ki
stray key in process_key: item_getiteminfo 61
Segmentation fault

Szerző:  Pika [ 2017.11.07. 12:54 ]
Hozzászólás témája:  Re: Színes Sebesség Mérőt

rusky18 írta:
Ezt Írja ki
stray key in process_key: item_getiteminfo 61
Segmentation fault


amxmodx studio? :o
Ezt másik plugin okozza szerintem.

Szerző:  The Peace [ 2017.11.07. 14:09 ]
Hozzászólás témája:  Re: Színes Sebesség Mérőt

  1. case 0-500: {
  2.             set_hudmessage(255, 215, 0, FREQ, 0.01, 0.0)
  3.             ShowSyncHudMsg(i, SyncHud, "%3.Gan[G]sta'S^n%3.2f Sebesseg", speed, speedh)
  4.         }
  5.         case 500-1000: {
  6.             set_hudmessage(255, 20, 147, FREQ, 0.01, 0.0)
  7.             ShowSyncHudMsg(i, SyncHud, "%3.Gan[G]sta'S^n%3.2f Sebesseg", speed, speedh)
  8.         }
  9.         case 1000-2000: {
  10.             set_hudmessage(0, 255, 154, FREQ, 0.01, 0.0)
  11.             ShowSyncHudMsg(i, SyncHud, "%3.Gan[G]sta'S^n%3.2f Sebesseg", speed, speedh)
  12.         }
  13.         case 2000-20000: {
  14.             set_hudmessage(0, 178, 238, FREQ, 0.01, 0.0)
  15.             ShowSyncHudMsg(i, SyncHud, "%3.Gan[G]sta'S^n%3.2f Sebesseg", speed, speedh)
  16.         }


?

Szerző:  Jucika [ 2017.11.29. 15:36 ]
Hozzászólás témája:  Re: Színes Sebesség Mérőt

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

Szerző:  Zoe [ 2017.11.29. 17:28 ]
Hozzászólás témája:  Re: Színes Sebesség Mérőt

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

te ugye vagod hogy mar ez kb 1 honapja meg lett valaszolva ? meg nem es ezt kerte...

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