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