hlmod.hu
https://hlmod.hu/

Sebességmérő
https://hlmod.hu/viewtopic.php?f=44&t=10259
Oldal: 1 / 1

Szerző:  bboyflikk [ 2013.08.17. 13:40 ]
Hozzászólás témája:  Sebességmérő

Sziasztok láttam sebességmérő pluginokat de az amx-es volt sourcemodon van egy sebességmérő plugin csak minden pályán elindulna azt meg nem szeretném valahogy átlehetne irni hogy km/h-ba mutassa a sebességet és csak bhop_ pályákon induljon el? Köszönöm előre is -->Flikk<--

http://forums.alliedmods.net/showthread.php?p=1335264

Szerző:  Alnilam [ 2013.08.17. 14:15 ]
Hozzászólás témája:  Re: Sebességmérő

Tessék ezt tudod állítani km/h vagy m/h.
Ha van map konfigot akkor oda tedd be az indítóját ;)

Szerző:  bboyflikk [ 2013.08.17. 14:19 ]
Hozzászólás témája:  Re: Sebességmérő

Alnilam írta:
Tessék ezt tudod állítani km/h vagy m/h.
Ha van map konfigot akkor oda tedd be az indítóját ;)

Sajnos nincs map konfigom :S de köszi a plugint

Szerző:  Alnilam [ 2013.08.17. 14:24 ]
Hozzászólás témája:  Re: Sebességmérő

Khmm. ahhoz, hogy csak bhop pályákon aktiválódjon akkor kelleni fog hozzá map konfig.
Ha nincs akkor rconból tudod kezelni.

Szerző:  kiki [ 2013.08.18. 15:24 ]
Hozzászólás témája:  Re: Sebességmérő

Tessék:

SMX Forráskód: [ Mindet kijelol ]
  1. #include <sourcemod>
  2. #include <sdktools>
  3.  
  4. #define PLUGIN_NAME "Speed Meter"
  5. #define PLUGIN_VERSION "1.0.0"
  6. #define PLUGIN_DESCRIPTION "Show current player speed in HUD"
  7. #define PLUGIN_AUTHOR "Petit Renard"
  8. #define PLUGIN_URL "http://css.cooldev.net/"
  9.  
  10. new Handle:g_enable = INVALID_HANDLE;
  11. new Handle:g_unit = INVALID_HANDLE;
  12. new Float:lastPosition[MAXPLAYERS + 1][3];
  13. new g_MaxClients;
  14. new Handle:g_timer = INVALID_HANDLE;
  15.  
  16. public Plugin:myinfo =
  17. {
  18. name = PLUGIN_NAME,
  19. author = PLUGIN_AUTHOR,
  20. description = PLUGIN_DESCRIPTION,
  21. version = PLUGIN_VERSION,
  22. url = PLUGIN_URL
  23. };
  24.  
  25. public OnPluginStart ()
  26. {
  27. decl String:mapnev[64];
  28. GetCurrentMap(mapnev, sizeof(mapnev));
  29.  
  30. if(StrContains(mapnev,"bhop",false)!=-1)
  31. {
  32. LoadTranslations ("speedmeter.phrases");
  33.  
  34. g_enable = CreateConVar ("speedmeter_enable", "1", "Enable SpeedMeter ? (1 = yes, 0 = no)", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  35. g_unit = CreateConVar ("speedmeter_unit", "0", "Unit of length (0 = kilometres, 1 = miles)", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  36.  
  37. CreateConVar ("speedmeter_version", PLUGIN_VERSION, PLUGIN_NAME, FCVAR_PLUGIN | FCVAR_REPLICATED | FCVAR_NOTIFY);
  38. CreateConVar ("speedmeter_credit", PLUGIN_URL, PLUGIN_NAME, FCVAR_PLUGIN | FCVAR_REPLICATED | FCVAR_NOTIFY);
  39.  
  40. HookEvent ("round_start", Event_RoundStart);
  41. HookEvent ("round_end", Event_RoundEnd);
  42. }
  43. }
  44.  
  45. public OnMapStart ()
  46. {
  47. g_MaxClients = GetMaxClients();
  48. }
  49.  
  50. public Action:Event_RoundStart (Handle:event, const String:name[], bool:dontBroadcast)
  51. {
  52. if (IsPluginEnable ())
  53. {
  54. if (g_timer != INVALID_HANDLE)
  55. {
  56. KillTimer (g_timer);
  57. g_timer = INVALID_HANDLE;
  58. }
  59. g_timer = CreateTimer (0.5, Timer_Speed);
  60. }
  61. return Plugin_Continue;
  62. }
  63.  
  64. public Action:Event_RoundEnd (Handle:event, const String:name[], bool:dontBroadcast)
  65. {
  66. if (g_timer != INVALID_HANDLE)
  67. {
  68. KillTimer (g_timer);
  69. g_timer = INVALID_HANDLE;
  70. }
  71. }
  72.  
  73. public Action:Timer_Speed (Handle:timer, any:nothing)
  74. {
  75. for (new i=1; i<=g_MaxClients; i++)
  76. {
  77. speedMeter (i);
  78. }
  79. g_timer = CreateTimer (0.5, Timer_Speed);
  80. }
  81.  
  82. stock speedMeter (client)
  83. {
  84. if (client && IsClientConnected (client) && IsClientInGame (client) && IsPlayerAlive (client))
  85. {
  86. new Float:newPosition[3], Float:distance, Float:speed, String:message[128], unit;
  87.  
  88. // calc speed in kilometer
  89. GetClientAbsOrigin (client, newPosition);
  90. distance = GetVectorDistance (lastPosition[client], newPosition);
  91. speed = distance / 20 * 2;
  92. lastPosition[client] = newPosition;
  93.  
  94. unit = GetConVarInt (g_unit);
  95. switch (unit)
  96. {
  97. case 0:
  98. {
  99. message = "Current speed in kilometers";
  100. }
  101. case 1:
  102. {
  103. // convert kilometer for miles
  104. speed = speed / 1.609347;
  105. message = "Current speed in miles";
  106. }
  107. }
  108.  
  109. PrintHintText (client, "%t", message, RoundToNearest (speed));
  110. }
  111. }
  112.  
  113. stock Bool:IsPluginEnable ()
  114. {
  115. return Bool:GetConVarBool (g_enable);
  116. }


(Most elvileg csak azon a pályán fut a plugin, aminek a nevébe van bhop szó! Persze csak próbálkozás, teszteld le, s jelezd vissza ha jó, illetve ha nem jó!

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