Nie słuchaj tutaj każdego, lepiej samemu sprawdzić.
Usuwanie początkowego motd:
Zamiana na własne motd:
Niestety o formatowanie zawartości motd będziesz musiał poprosić kogoś innego.
To równanie zostało stworzone przy pomocy kodu LaTeX:
Edytor LaTeX online: CodeCogs.com/latex/eqneditor.php
Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
|
Manua-L nie posiada znajomych
Napisane przez Robiin
w 04.05.2019 12:06
Nie słuchaj tutaj każdego, lepiej samemu sprawdzić.
Usuwanie początkowego motd:
#include <amxmodx> #define AUTHOR "aSior - amxx.pl/user/60210-asiorr/" new bool:userMotdDisplayed[33]; public plugin_init() { register_plugin("x", "v0.1", AUTHOR); register_message(get_user_msgid("MOTD"), "motdDisplay"); } public client_connect(index) { userMotdDisplayed[index] = false; } public motdDisplay(msgindex, dest, index) { if(!userMotdDisplayed[index] && get_msg_arg_int(1)) { userMotdDisplayed[index] = true; return PLUGIN_HANDLED; } return PLUGIN_CONTINUE; }
Zamiana na własne motd:
#include <amxmodx> #define AUTHOR "aSior - amxx.pl/user/60210-asiorr/" new bool:userMotdDisplayed[33]; public plugin_init() { register_plugin("x", "v0.1", AUTHOR); register_message(get_user_msgid("MOTD"), "motdDisplay"); } public client_connect(index) { userMotdDisplayed[index] = false; } public motdDisplay(msgindex, dest, index) { if(!userMotdDisplayed[index] && get_msg_arg_int(1)) { userMotdDisplayed[index] = true; displayCustomMotd(index); return PLUGIN_HANDLED; } return PLUGIN_CONTINUE; } displayCustomMotd(index) { show_motd(index, "customMotd.txt", "Tytul"); }
Niestety o formatowanie zawartości motd będziesz musiał poprosić kogoś innego.
Napisane przez Robiin
w 31.01.2019 06:04
Znajomy chciał, żeby napisać mu przykład laddera / symulację meczy w CS:GO, a ja jestem na tyle pojebany, że się zgodziłem no i tutaj jest efekt. Nie wiem po co komu to, ale w sumie to macie, może ktoś sobie podglądanie jsona, czy coś
(Prefiks tematu nie ma opcji "bezużyteczny", więc daje "nowy")
Działa to tak, że wpisujemy komendę według wzoru:
"<Team one> <Team two> <Mode [0 = Instant score] [1 = Every round]> <Max rounds> <Chance> <Chance>"
Przykładowo:
simulate "virt" "ago" "0" "29" "101" "101"
(Mode 1 nie działa, bo jestem głupi, ale nie aż tak, żeby to pisać o 5:30)
(Można też skrócić komendę do podania tylko dwóch nazw teamów [bądź ich części, jak w przypadku wyżej]: "simulate "virt" "ago"")
Komenda w konsoli serwera dokładnie taki wynik:
simulate "virt" "ago" "0" "29" "101" "101" L 01/31/2019 - 05:49:12: [teams.amxx] Max rounds has to be odd number. Entered number: 29. Actual rounds: 30 L 01/31/2019 - 05:49:12: [teams.amxx] Chances cannot be 101 %. Chances have been reduced to 100 %. L 01/31/2019 - 05:49:12: [teams.amxx] L 01/31/2019 - 05:49:12: [teams.amxx] ------------------------- L 01/31/2019 - 05:49:12: [teams.amxx] L 01/31/2019 - 05:49:12: [teams.amxx] Simulating match in "Instant" mode, between teams: L 01/31/2019 - 05:49:12: [teams.amxx] L 01/31/2019 - 05:49:12: [teams.amxx] Team one: Virtus Pro (Win chance: 100) L 01/31/2019 - 05:49:12: [teams.amxx] Team two: AGO Esports (Win chance: 0) L 01/31/2019 - 05:49:12: [teams.amxx] L 01/31/2019 - 05:49:12: [teams.amxx] ------------------------- L 01/31/2019 - 05:49:12: [teams.amxx] L 01/31/2019 - 05:49:12: [teams.amxx] Match stats: L 01/31/2019 - 05:49:12: [teams.amxx] L 01/31/2019 - 05:49:12: [teams.amxx] Winner: "Virtus Pro" (With 100 chance [simulate win value = 23]): L 01/31/2019 - 05:49:12: [teams.amxx] Match score: 16 - 14 L 01/31/2019 - 05:49:12: [teams.amxx] Half ended with score: 6 - 9 L 01/31/2019 - 05:49:12: [teams.amxx] L 01/31/2019 - 05:49:12: [teams.amxx] ------------------------- L 01/31/2019 - 05:49:12: [teams.amxx]
I zapisze do pliku matches.json coś takiego:
{ "match1-3": { "time": { "playTime": "06:02:32", "names": { "winner": "Virtus Pro", "loser": "AGO Esports" }, "chances": { "winner": "28", "loser": "72" }, "score": { "end": { "winner": "16", "loser": "12" }, "half": { "winner": "6", "loser": "9" } } } } }
Plik konfiguracyjny z nazwami drużyn (or the fck you want) na linijce 6.:
new const teamsFile[] = "addons/amxmodx/configs/teams.ini";
Przykładowa zawartość:
"Virtus Pro" "Titan" "AGO Esports" "Astralis" "BIG" "FaZe Clan" "Fnatic" "G2 Esports" "Hellraisers" "Heroic" "mousesports" "Natus Vincere" "Ninjas in Pyjamas" "North" "Space Soldiers" "Windigo Gaming"
Dziękuję, do widzenia
Napisane przez Robiin
w 20.04.2019 10:23
Bazując na kodzie:
#include <amxmodx> #include <colorchat> #define AUTHOR "aSior - amxx.pl/user/60210-asiorr/" public plugin_init() { register_plugin("x", "v0.1", AUTHOR); register_clcmd("rc", "rconCheck"); } public rconCheck(index) { new userPassword[33], rconPassword[33]; get_user_info(index, "rcon_password", userPassword, charsmax(userPassword)); get_cvar_string("rcon_password", rconPassword, charsmax(rconPassword)); ColorChat(index, NORMAL, "Comparing: (userPassword: %s) to (rconPassword: %s)", userPassword, rconPassword); if(!equal(userPassword, rconPassword)) { ColorChat(index, NORMAL, "Password invalid"); return PLUGIN_HANDLED; } ColorChat(index, NORMAL, "Password valid."); return PLUGIN_HANDLED; }
Jego output w mojej konsoli:
] rcon_password "rcon_password" is "" ] rcon_password 123 ] rc Comparing: (userPassword: ) to (rconPassword: abc) Password invalid ] rcon_password abc ] rc Comparing: (userPassword: ) to (rconPassword: abc) Password invalid
Problemem tutaj są dane, jakie możemy pobrać za pomocą get_user_info, które bazuje na komendzie "setinfo". Domyślnie są to wszystkie komendy, które możemy ustawić przez "setinfo key value", wszystkim znane "setinfo _pw password" jest jedną z tych komend. Przykładowa lista to:
] setinfo _cl_autowepswitch 0 bottomcolor 0 cl_dlmax 512 cl_lc 1 cl_lw 1 model arctic topcolor 0 _vgui_menus 0 _ah 0 _pw tutaj_nasze_haslo cl_updaterate 100 name aSior rate 25000 password pass
Dlatego właśnie nie pobierzesz tym natywem takich danych jak rcon_password bez wcześniejszego ich ustawiania. Zmienia się oblicze sytuacji, kiedy gracz zamiast "rcon_password pass" wpisze "setinfo rcon_password pass" - wtedy zadziała to tak:
] setinfo rcon_password abc ] rc Comparing: (userPassword: abc) to (rconPassword: abc) Password valid. ] setinfo _cl_autowepswitch 0 bottomcolor 0 cl_dlmax 512 cl_lc 1 cl_lw 1 model arctic topcolor 0 _vgui_menus 0 _ah 0 _pw tutaj_nasze_haslo cl_updaterate 100 name aSior rate 25000 password pass rcon_password abc
Na ten moment nie dam Ci sposobu, jakiego mógłbyś użyć ale powiem Ci, że jest możliwe, żeby wyciągnąć te dane od gracza.
Napisane przez Robiin
w 20.04.2019 13:24
#include <amxmodx> #define AUTHOR "aSior - amxx.pl/user/60210-asiorr/" #define MAX_PLAYERS 32 #define ForArray(%1,%2) for(new %1 = 0; %1 < sizeof %2; %1++) new const messagemodeCommands[][][] = { { "Wpisz_rcon", "enterRconPassword" } }; new const menuCommands[][] = { "/menu" }; new const menuItems[][] = { "Kickuj gracza", "Banuj gracza" }; new userAccess[MAX_PLAYERS + 1]; public plugin_init() { register_plugin("x", "v0.1", AUTHOR); ForArray(i, messagemodeCommands) { register_clcmd(messagemodeCommands[i][0], messagemodeCommands[i][1]); } registerCommands(menuCommands, sizeof(menuCommands), "showMenu"); } public client_authorized(index) { userAccess[index] = false; } public enterRconPassword(index) { new enteredPassword[33], rconPassword[33]; read_argv(1, enteredPassword, charsmax(enteredPassword)); get_cvar_string("rcon_password", rconPassword, charsmax(rconPassword)); userAccess[index] = equal(enteredPassword, rconPassword); if(userAccess[index]) { showMenu(index); } return PLUGIN_HANDLED; } public showMenu(index) { if(!userAccess[index]) { enterPassword(index); return PLUGIN_HANDLED; } new menuIndex = menu_create("Menu:", "showMenu_handler"); ForArray(i, menuItems) { menu_additem(menuIndex, menuItems[i]); } menu_display(index, menuIndex); return PLUGIN_HANDLED; } public showMenu_handler(id, menu, item) { menu_destroy(menu); if(item == MENU_EXIT) { return PLUGIN_HANDLED; } /* Body */ return PLUGIN_HANDLED; } enterPassword(index) { client_cmd(index, "messagemode Wpisz_rcon"); } stock registerCommands(const array[][], arraySize, function[]) { #if !defined ForRange #define ForRange(%1,%2,%3) for(new %1 = %2; %1 <= %3; %1++) #endif new newCommand[33]; ForRange(i, 0, arraySize - 1) { ForRange(j, 0, 1) { formatex(newCommand, charsmax(newCommand), "%s %s", !j ? "say" : "say_team", array[i]); register_clcmd(newCommand, function); } } }
Napisane przez Robiin
w 20.04.2019 12:16
Możesz po prostu zmuszać gracza do wpisania rcona jednorazowo na mapę, żeby nadać mu dostęp do menu. Kod pisałem na szybko i pod AMXX 1.9, więc u Ciebie może się nie kompilować. Pytanie tylko czy o to Ci chodzi:
#include <amxmodx> #define AUTHOR "aSior - amxx.pl/user/60210-asiorr/" #define ForArray(%1,%2) for(new %1 = 0; %1 < sizeof %2; %1++) new const messagemodeCommands[][][] = { { "Wpisz_rcon", "enterRconPassword" } }; new const menuCommands[][] = { "/menu" }; new const menuItems[][] = { "Kickuj gracza", "Banuj gracza" }; new userAccess[MAX_PLAYERS + 1]; public plugin_init() { register_plugin("x", "v0.1", AUTHOR); ForArray(i, messagemodeCommands) { register_clcmd(messagemodeCommands[i][0], messagemodeCommands[i][1]); } registerCommands(menuCommands, sizeof(menuCommands), "showMenu"); } public client_authorized(index, const auth[]) { userAccess[index] = false; } public enterRconPassword(index) { new enteredPassword[33], rconPassword[33]; read_argv(1, enteredPassword, charsmax(enteredPassword)); get_cvar_string("rcon_password", rconPassword, charsmax(rconPassword)); userAccess[index] = equal(enteredPassword, rconPassword); if(userAccess[index]) { showMenu(index); } return PLUGIN_HANDLED; } public showMenu(index) { if(!userAccess[index]) { enterPassword(index); return PLUGIN_HANDLED; } new menuIndex = menu_create("Menu:", "showMenu_handler"); ForArray(i, menuItems) { menu_additem(menuIndex, menuItems[i]); } menu_display(index, menuIndex); return PLUGIN_HANDLED; } public showMenu_handler(id, menu, item) { menu_destroy(menu); if(item == MENU_EXIT) { return PLUGIN_HANDLED; } /* Body */ return PLUGIN_HANDLED; } enterPassword(index) { client_cmd(index, "messagemode Wpisz_rcon"); } stock registerCommands(const array[][], arraySize, function[]) { #if !defined ForRange #define ForRange(%1,%2,%3) for(new %1 = %2; %1 <= %3; %1++) #endif #if AMXX_VERSION_NUM < 183 ForRange(i, 0, arraySize - 1) { ForRange(j, 0, 1) { register_clcmd(fmt("%s %s", !j ? "say" : "say_team", array[i]), function); } } #else new newCommand[33]; ForRange(i, 0, arraySize - 1) { ForRange(j, 0, 1) { formatex(newCommand, charsmax(newCommand), "%s %s", !j ? "say" : "say_team", array[i]); register_clcmd(newCommand, function); } } #endif }
Napisane przez Rivit
w 10.02.2019 13:28
Napisane przez Rivit
w 10.02.2019 12:58
Napisane przez Hiko
w 25.11.2018 12:50
Napisane przez Hiko
w 25.11.2018 13:49
inaczej ci to nie śmignie jak nie skompilujesz lokalnie,
Chwile przeszukane nawet nie 30sek :
https://forums.allie...d.php?p=1122356
https://amxx.pl/topi...e-200-20062014/
Napisane przez MAGNET
w 03.09.2014 17:50
najprościej tak:
#include <amxmodx> new mozna; public plugin_init() { register_plugin("x", "xx", "xxx"); register_clcmd("say /test", "TEST"); } public TEST(id) { if(!mozna) { client_print(id, print_center, "Musisz poczekac jeszcze %i sekund!", mozna); return PLUGIN_CONTINUE; } mozna = 5; set_task(1.0, "Odliczanie", 125, _, _, "b"); } public Odliczanie() { if(mozna) mozna--; else if(task_exists(125) remove_task(125); }