hlmod.hu
https://hlmod.hu/

(TÉMA OFF) plugin átírás: UTOLSÓ KÖR (chat -be írja..)
https://hlmod.hu/viewtopic.php?f=10&t=30970
Oldal: 1 / 1

Szerző:  ZiT3K [ 2021.02.18. 14:42 ]
Hozzászólás témája:  (TÉMA OFF) plugin átírás: UTOLSÓ KÖR (chat -be írja..)

Üdv!
Az alábbi SMA-ban, ha jól látom nem chat -be fog írni.
Így azt szeretném kérni, hogy aki tudja légyszíves írja át úgy, hogy chat -be írja az üzeneteket.

SMA:
  1. #include <amxmodx>
  2. #pragma semicolon                1      // force ; usage, just 'cause
  3.    
  4. new g_scTitle[]   = "Last Round";
  5. new g_scVersion[] = "1.0";
  6. new g_scAuthor[]  = "bAnTAi";
  7.    
  8. new bool:g_lastround = false;
  9. new bool:g_changemap = false;
  10. new Float:g_timelimit = 0.0;
  11. new Float:g_maxspeed;
  12.  
  13. #define INITIATE_LAST_ROUND_TASK 545454
  14. #define CHANGE_MAP_TASK 545455
  15. #define DISABLE_PLAYERS_TASK 545456
  16.  
  17. public evRoundStart() {
  18.     if (!get_cvar_num("lastround")) return PLUGIN_CONTINUE;
  19.  
  20.     // Wanted this in init but never got a value
  21.     if (g_timelimit == 0.0)
  22.         g_timelimit = get_cvar_float("mp_timelimit");
  23.  
  24.     if (g_lastround) {
  25.         new Float:roundtime = get_cvar_float("mp_roundtime");
  26.         new Float:c4timer = get_cvar_float("mp_c4timer")/60;
  27.             // Extend the maps time one round + c4timer + some buffer
  28.             set_cvar_float("mp_timelimit", g_timelimit + roundtime + c4timer + 0.5);
  29.                    
  30.         new text[256];
  31.         format(text, 255, "Ez az utolso kor!");
  32.         doTypesay(text, 5, 210, 0, 0);
  33.  
  34.         g_changemap = true;
  35.         g_lastround = false;
  36.     } else if (g_changemap) {
  37.         new nextmap[32];
  38.             get_cvar_string("amx_nextmap", nextmap, 31);
  39.    
  40.         new text[256];
  41.         format(text, 255, "Koszonjuk a jatekot. Kovetkezo palya: %s!", nextmap);
  42.         doTypesay(text, 5, 210, 0, 0);
  43.  
  44.         g_maxspeed = get_cvar_float("sv_maxspeed");
  45.         set_cvar_float("sv_maxspeed", 0.0);
  46.  
  47.                 set_task(0.1, "disablePlayers", DISABLE_PLAYERS_TASK, "", 0, "a", 3);
  48.                 set_task(6.0, "changeMap", CHANGE_MAP_TASK);
  49.     }
  50.  
  51.         return PLUGIN_CONTINUE;
  52. }
  53.  
  54. public initiateLastRound() {
  55.     if (!get_cvar_num("lastround")) return PLUGIN_CONTINUE;
  56.  
  57.     remove_task(INITIATE_LAST_ROUND_TASK);
  58.  
  59.     new text[256];
  60.     format(text, 255, "Utolso kor, gyerunk!!!");
  61.         doTypesay(text, 5, 210, 0, 0);
  62.  
  63.         new Float:roundtime = get_cvar_float("mp_roundtime");
  64.     new Float:c4timer = get_cvar_float("mp_c4timer")/60;
  65.  
  66.     // (2* roundtime since it is possible that the even occurs at the beginning of a round)
  67.     set_cvar_float("mp_timelimit", g_timelimit + (2.0*roundtime) + (2.0*c4timer));
  68.  
  69.     g_lastround = true;
  70.  
  71.     return PLUGIN_CONTINUE;
  72. }
  73.  
  74. public disablePlayers() {
  75.         new players[32], num;
  76.         get_players(players, num, "c");
  77.         for(new i=0;i<num; i++) {
  78.         client_cmd(players[i],"drop");
  79.     }
  80. }
  81.  
  82. public changeMap() {
  83.     remove_task(CHANGE_MAP_TASK);
  84.  
  85.         new nextmap[32];
  86.         get_cvar_string("amx_nextmap", nextmap, 31);
  87.         server_cmd("changelevel %s", nextmap);
  88. }
  89.  
  90. doTypesay(string[], duration, r, g, b) {
  91.         set_hudmessage(r, g, b, 0.05, 0.45, 0, 6.0, float(duration) , 0.5, 0.15, 4);
  92.         show_hudmessage(0, string);
  93. }
  94.                    
  95. public plugin_init() {
  96.         register_plugin(g_scTitle, g_scVersion, g_scAuthor);
  97.  
  98.         register_cvar("lastround", "1");
  99.     register_logevent("evRoundStart", 2, "0=World triggered", "1=Round_Start");
  100.  
  101.     // Chose 90 seconds not to clash with other events
  102.     set_task(90.0, "initiateLastRound", INITIATE_LAST_ROUND_TASK, "", 0, "d");
  103.  
  104.     return PLUGIN_CONTINUE;
  105. }
  106.  
  107. public plugin_end() {
  108.     set_cvar_float("mp_timelimit", g_timelimit);
  109.     set_cvar_float("sv_maxspeed", g_maxspeed);
  110.  
  111.     remove_task(DISABLE_PLAYERS_TASK);
  112.  
  113.     return PLUGIN_CONTINUE;
  114. }

Előre is köszönöm!

Szerző:  DexoN [ 2021.02.18. 19:18 ]
Hozzászólás témája:  Re: plugin átírás: UTOLSÓ KÖR (chat -be írja..)

Üdv, teszteld:
  1. #include <amxmodx>
  2. #pragma semicolon                1      // force ; usage, just 'cause
  3.    
  4. new g_scTitle[]   = "Last Round";
  5. new g_scVersion[] = "1.0";
  6. new g_scAuthor[]  = "bAnTAi";
  7.    
  8. new bool:g_lastround = false;
  9. new bool:g_changemap = false;
  10. new Float:g_timelimit = 0.0;
  11. new Float:g_maxspeed;
  12.  
  13. #define INITIATE_LAST_ROUND_TASK 545454
  14. #define CHANGE_MAP_TASK 545455
  15. #define DISABLE_PLAYERS_TASK 545456
  16.  
  17. public evRoundStart() {
  18.     if (!get_cvar_num("lastround")) return PLUGIN_CONTINUE;
  19.  
  20.     // Wanted this in init but never got a value
  21.     if (g_timelimit == 0.0)
  22.         g_timelimit = get_cvar_float("mp_timelimit");
  23.  
  24.     if (g_lastround) {
  25.         new Float:roundtime = get_cvar_float("mp_roundtime");
  26.         new Float:c4timer = get_cvar_float("mp_c4timer")/60;
  27.             // Extend the maps time one round + c4timer + some buffer
  28.             set_cvar_float("mp_timelimit", g_timelimit + roundtime + c4timer + 0.5);
  29.                    
  30.         new text[256];
  31.         format(text, 255, "Ez az utolsó kör!");
  32.         client_print_color(0, print_team_default, text);
  33.  
  34.         g_changemap = true;
  35.         g_lastround = false;
  36.     } else if (g_changemap) {
  37.         new nextmap[32];
  38.             get_cvar_string("amx_nextmap", nextmap, 31);
  39.    
  40.         new text[256];
  41.         format(text, 255, "Köszönjük a játékot. Következő páya: %s!", nextmap);
  42.         client_print_color(0, print_team_default, text);
  43.  
  44.         g_maxspeed = get_cvar_float("sv_maxspeed");
  45.         set_cvar_float("sv_maxspeed", 0.0);
  46.  
  47.                 set_task(0.1, "disablePlayers", DISABLE_PLAYERS_TASK, "", 0, "a", 3);
  48.                 set_task(6.0, "changeMap", CHANGE_MAP_TASK);
  49.     }
  50.  
  51.         return PLUGIN_CONTINUE;
  52. }
  53.  
  54. public initiateLastRound() {
  55.     if (!get_cvar_num("lastround")) return PLUGIN_CONTINUE;
  56.  
  57.     remove_task(INITIATE_LAST_ROUND_TASK);
  58.  
  59.     new text[256];
  60.     format(text, 255, "Utolsó kör, gyerunk!!!");
  61.     client_print_color(0, print_team_default, text);
  62.  
  63.         new Float:roundtime = get_cvar_float("mp_roundtime");
  64.     new Float:c4timer = get_cvar_float("mp_c4timer")/60;
  65.  
  66.     // (2* roundtime since it is possible that the even occurs at the beginning of a round)
  67.     set_cvar_float("mp_timelimit", g_timelimit + (2.0*roundtime) + (2.0*c4timer));
  68.  
  69.     g_lastround = true;
  70.  
  71.     return PLUGIN_CONTINUE;
  72. }
  73.  
  74. public disablePlayers() {
  75.         new players[32], num;
  76.         get_players(players, num, "c");
  77.         for(new i=0;i<num; i++) {
  78.         client_cmd(players[i],"drop");
  79.     }
  80. }
  81.  
  82. public changeMap() {
  83.     remove_task(CHANGE_MAP_TASK);
  84.  
  85.         new nextmap[32];
  86.         get_cvar_string("amx_nextmap", nextmap, 31);
  87.         server_cmd("changelevel %s", nextmap);
  88. }
  89.                    
  90. public plugin_init() {
  91.         register_plugin(g_scTitle, g_scVersion, g_scAuthor);
  92.  
  93.         register_cvar("lastround", "1");
  94.     register_logevent("evRoundStart", 2, "0=World triggered", "1=Round_Start");
  95.  
  96.     // Chose 90 seconds not to clash with other events
  97.     set_task(90.0, "initiateLastRound", INITIATE_LAST_ROUND_TASK, "", 0, "d");
  98.  
  99.     return PLUGIN_CONTINUE;
  100. }
  101.  
  102. public plugin_end() {
  103.     set_cvar_float("mp_timelimit", g_timelimit);
  104.     set_cvar_float("sv_maxspeed", g_maxspeed);
  105.  
  106.     remove_task(DISABLE_PLAYERS_TASK);
  107.  
  108.     return PLUGIN_CONTINUE;
  109. }

Szerző:  ZiT3K [ 2021.02.18. 20:11 ]
Hozzászólás témája:  Re: plugin átírás: UTOLSÓ KÖR (chat -be írja..)

Idézek, amint teszteltem.

DexoN írta:
Üdv, teszteld:
MŰKÖDIK!

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