Zasada działania Od 1:00 w nocy do 10:00 rano mapcykl na małe mapy, a od 10:00 do 1:00 w nocy normalny mapcykl.
To jest edytowane .sma pluginu
#include <amxmodx> #include <amxmisc> #define PLUGIN "Mapcykl matkoj**ca" #define VERSION "1.0" #define AUTHOR "graczu" #define iloscm 2 new mapcycles[iloscm][2][] = {{"mapcycle-dzien.txt", "10", "mapcykl dzienny"}, {"mapcycle-noc.txt", "01", "mapcykl nocny"}} new cum, lastread[3] public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_clcmd("say /mapcycle", "cmdSayMapcycle", 0, "- wyswietla aktualny mapcykl") get_localinfo("lastcnum", lastread, 2) cum = str_to_num(lastread) set_localinfo("lastcnum", "") sprawdz_mapcycle() return PLUGIN_CONTINUE } public sprawdz_mapcycle() { new today_str[8], cmd[48] get_time("%H",today_str,8) new today = str_to_num(today_str) for(new i = 0; i <= (iloscm - 1); i++){ if(today >= str_to_num(mapcycles[i][1])){ cum = i } } new currentfile[32] get_cvar_string("mapcyclefile", currentfile, 31) if(!equali(currentfile, mapcycles[cum][0])){ format(cmd, 48 ,"mapcyclefile %s", mapcycles[cum][0]) server_cmd(cmd) log_amx("** Setting new mapcyclefile: %s - %s!", currentfile, mapcycles[cum][0]) new czytajplik[128], line[192], txtsize = 0 format(czytajplik, 127, "%s", mapcycles[cum][0]) new lineread = file_size(czytajplik, 1) read_file(czytajplik, (lineread - 1), line, 191, txtsize) if (txtsize > 1 && line[0] != ';') { format(cmd, 48 ,"amx_nextmap %s", line) server_cmd(cmd) log_amx("** Setting new MAP NEXTMAP: %s!", line) } else { log_amx("** Setting new MAP NEXTMAP: ERROR LINE IS EMPTY!!") } } else { log_amx("** Mapcyclefile: %s - %s!", currentfile, mapcycles[cum][0]) } return PLUGIN_HANDLED } public cmdSayMapcycle(id){ client_print(id, print_chat, "* Aktualnie Gramy: %s, wcisnij TYLDE by zobaczyc liste map.", mapcycles[cum][2]) client_print(id, print_console, "************* Aktualna Rotacja Map:") new line[192], lines = 0, txtsize = 0, i = 1 new czytajplik[128] format(czytajplik, 127, "%s", mapcycles[cum][0]) if(file_exists(czytajplik)){ while ((lines = read_file(czytajplik, lines, line, 191, txtsize)) != 0) { if (line[0] == ';') continue; client_print(id, print_console, "* Pozycja: %i : %s", i, line) i++ } } client_print(id, print_console, "**********************************") } public plugin_end() { new lastcycle[3] num_to_str(cum, lastcycle, 2) set_localinfo("lastcnum", lastcycle) }
Ale niestety kompilacja nie przebiega pomyślnie i nie mogę skompilować pluginu.
Welcome to the AMX Mod X 1.8.1-300 Compiler. Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team mapcykl_rotator.sma(9) : error 018: initialization data exceeds declared size mapcykl_rotator.sma(54) : error 032: array index out of bounds (variable "mapcycles") 2 Errors. Could not locate output file mapcykl_rotator.amxx (compile failed).