-
Postów
26 -
Dołączył
-
Ostatnia wizyta
-
Wygrane w rankingu
1
Odpowiedzi opublikowane przez ogbudowa
-
-
Cytat
char sounds[][] = { "wr.mp3", "wr1.mp3", "wr2.mp3" } public void OnMapStart() { for (int i = 0; i < sizeof(sounds); i++) { char soundname[128]; Format(soundname, sizeof(soundname), "*/%s", sounds[i]); PrecacheSound(soundname, true); Format(soundname, sizeof(soundname), "sound/%s", sounds[i]); AddFileToDownloadsTable(soundname); } } ... EmitSoundToAll(sounds[GetRandomInt(0, sizeof(sounds))]);
-
9 minut temu, HyperbeastXD napisał:
@EliteMyślałem, ze klasy są własnie jedną z prostszych rzeczy
I wgl zna ktoś plugin na rtv bo jak pisze !rtv w tym pluginie to nic się nie dzieje: https://forums.alliedmods.net/showthread.php?t=57106
Plugin "na rtv" domyślnie znajduje się w katalogu plugins/disabled pod nazwą "rockthevote.smx", wystarczy że przeniesiesz go do katalogu plugins.
-
14 godzin temu, Brum Brum napisał:
Druga sprawa jest taka, że przy usuwaniu graczowi gotówki tak naprawdę mu ją dodajesz xD W includzie od gomoda nie masz jak zabrać graczowi euro.
native float GoMod_AddEuro(int client, float amount);
zgaduje że jak pod parametrem amount jest wartosc ujemna to odejmie graczowi euro- 2
-
Godzinę temu, fiXed napisał:
char ads[][] = { "{green}Zapraszam na forum {orange}cs-owo.pl{green}!" "{green}Wlascicielem serwera jest fiXed!" }
zmien na
Godzinę temu, fiXed napisał:char ads[][] = { "{green}Zapraszam na forum {orange}cs-owo.pl{green}!", "{green}Wlascicielem serwera jest fiXed!" }
-
#include <sourcemod> #include <cstrike> #include <sdktools> #define freeze_time 3.0 #define freeze_sound "physics/glass/glass_impact_bullet4.wav" float g_freeze_time[MAXPLAYERS + 1] = {0.0, ...} public OnPluginStart() { HookEvent("player_hurt", player_hurt); } public OnMapStart() { PrecacheSound(freeze_sound, true); } public Action player_hurt(Event e, const char[] n, bool b) { char weapon[256]; GetEventString(e, "weapon", weapon, sizeof(weapon)); if (strlen(weapon) > 0) { int vic = GetClientOfUserId(GetEventInt(e, "userid")); float vec[3]; GetClientAbsOrigin(vic, vec); EmitAmbientSound(freeze_sound, vec, vic, SNDLEVEL_RAIDSIREN); g_freeze_time[vic] = freeze_time; freeze_player(vic); CreateTimer(1.0, freeze_timer, vic, TIMER_REPEAT); } return Plugin_Continue; } public Action freeze_player(int client) { SetEntityMoveType(client, MOVETYPE_NONE); SetEntityRenderColor(client, 0, 128, 255, 192); } public Action unfreeze_player(int client) { SetEntityMoveType(client, MOVETYPE_WALK); SetEntityRenderColor(client, 255, 255, 255, 255); } public Action freeze_timer(Handle timer, int vic) { if (g_freeze_time[vic] == 0.0) { unfreeze_player(vic); KillTimer(timer); return Plugin_Stop; } g_freeze_time[vic]--; return Plugin_Continue; }
powinno działać
-
#include <sourcemod>
#include <cstrike>
#define tt_text "Terroryści"
#define ct_text "Antyterroryści"
#define refresh_time 0.5
public OnMapStart()
{
CreateTimer(refresh_time, refresh_hud, _, TIMER_REPEAT);
}
public Action refresh_hud(Handle timer)
{
for (int i = 1; i <= MaxClients; i++)
{
if (is_valid_client(i))
draw_text(i);
}
}
int draw_text(int client)
{
if (!is_valid_client(client))
return 0;
int count_tt = get_all_players(CS_TEAM_T);
int count_ct = get_all_players(CS_TEAM_CT);
SetHudTextParams(0.01, 0.02, refresh_time, 255, 255, 255, 0);
ShowHudText(client, -1, "%s: %d", tt_text, count_tt);
SetHudTextParams(0.01, 0.06, refresh_time, 255, 255, 255, 0);
ShowHudText(client, -1, "%s: %d", ct_text, count_ct);
return 0;
}
int get_all_players(int team)
{
int counter = 0;
for (int i = 1; i <= MaxClients; i++)
{
if (is_valid_client(i) && IsPlayerAlive(i) && GetClientTeam(i) == team)
counter++;
}
return counter;
}
stock bool is_valid_client(int client)
{
return (client >= 1 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client) && !IsClientSourceTV(client));
}
- 1
-
Cytat
#include <sourcemod>
#include <cstrike>
#define tt_text "Terroryści"
#define ct_text "Antyterroryści"
#define refresh_time 0.5
public OnMapStart()
{
CreateTimer(refresh_time, refresh_hud, _, TIMER_REPEAT);
}
public Action refresh_hud(Handle timer)
{
for (int i = 1; i <= MaxClients; i++)
{
if (is_valid_client(i))
draw_text(i);
}
}
int draw_text(int client)
{
if (!is_valid_client(client))
return 0;
int count_tt = get_all_players(CS_TEAM_T);
int count_ct = get_all_players(CS_TEAM_CT);
SetHudTextParams(0.01, 0.02, refresh_time, 255, 255, 255, 0);
ShowHudText(client, -1, "%s: %d", tt_text, count_tt);
SetHudTextParams(0.01, 0.06, refresh_time, 255, 255, 255, 0);
ShowHudText(client, -1, "%s: %d", ct_text, count_ct);
return 0;
}
int get_all_players(int team)
{
int counter = 0;
for (int i = 1; i <= MaxClients; i++)
{
if (is_valid_client(i) && GetClientTeam(i) == team)
counter++;
}
return counter;
}
stock bool is_valid_client(int client)
{
return (client >= 1 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client) && !IsClientSourceTV(client));
}
- 1
-
Cytat
#include <sourcemod>
#include <sdktools>
#define random_flag Admin_Root
#define losuj_time 180.0
public OnMapStart()
CreateTimer(losuj_time, losuj_vipa);
public Action losuj_vipa(Handle timer)
{
int winner = 0;
char client_name[MAX_NAME_LENGTH];
do {
winner = GetRandomInt(1, MaxClients);
} while (!IsClientInGame(winner) || GetClientTeam(winner) != 3);
AddUserFlags(winner, random_flag);
GetClientName(winner, client_name, sizeof(client_name));
PrintToChatAll(" \x0B--------------------------------------------------\x01");
PrintToChatAll(" \x0BPoczątek mapy - \x10wkrótce losowanie \x0F[VIPA]\x01");
for (int i = 4;i > 0; i--)
PrintToChatAll(" \x0BLosowanie \x0F[VIPA] \x10za %ds...\x01", i); // timer dodaj
PrintToChatAll(" \x0F[VIPA] \x0Bna mapę wygrywa \x06%s. \x10Gratulujemy!\x01", client_name);
PrintToChatAll(" \x0B--------------------------------------------------\x01");
KillTimer(timer);
}
public OnClientDisconnect(int client)
RemoveUserFlags(client, random_flag);
Cytat#include <sourcemod>
#include <sdktools>
#define message "Wyrzucam pakę."
public OnPluginStart()
HookEvent("bomb_dropped", bomb_dropped);
public Action bomb_dropped(Event e, const char[] n, bool b)
{
int client = GetClientOfUserId(GetEventInt(e, "userid"));
FakeClientCommandEx(client, "say_team %s", message);
}
raczej powinno działać
-
#include <sourcemod> #include <sdktools> bool g_Msg[MAXPLAYERS + 1] = {true, ...}; char Toggler[256]; public OnPluginStart() { RegConsoleCmd("sm_menubroni", bronie); } public Action bronie(int client, int args) { Menu gMenu = new Menu(gMenu_Handler); gMenu.SetTitle("Wybierz broń!"); gMenu.AddItem("1", "BROŃ - AK-47"); gMenu.AddItem("2", "BROŃ - NEGEV"); Format(Toggler, sizeof(Toggler), "%s Wiadomości przy wybieraniu broni", (g_Msg[client] ? "[ON]" : "[OFF]")); gMenu.AddItem("3", Toggler); gMenu.Display(client, MENU_TIME_FOREVER); return Plugin_Handled; } int gMenu_Handler(Menu menu, MenuAction action, int client, int pos) { switch(action) { case MenuAction_Select: { switch(pos) { case 0: { GivePlayerItem(client, "weapon_ak47"); if (g_Msg[client]) PrintToChat(client, " \x0B [BRONIE] \x04 ★\x02Twoja broń to \x01 AK-47\x04★"); // wybierajac opcje nr3 chcialbym aby ta wiadomosc nie wyswietlala sie, lub jesli juz byly wylaczona to zeby sie wyswietlala } case 1: { GivePlayerItem(client, "weapon_negev"); if (g_Msg[client]) PrintToChat(client, " \x0B [BRONIE] \x04 ★\x02Twoja broń to \x01 NEGEV\x04★"); // wybierajac opcje nr3 chcialbym aby ta wiadomosc nie wyswietlala sie, lub jesli juz byly wylaczona to zeby sie wyswietlala } case 2: { PrintToChat(client, "\x03 Wiadomości zostały: %s.", (g_Msg[client] ? "wyłączone" : "włączone")); g_Msg[client] = !g_Msg[client]; FakeClientCommandEx(client, "sm_menubroni"); } } } case MenuAction_End: delete menu; } return 0; }
-
#include <sourcemod> #include <sdktools> #define TAG " \x0F[STEAMID]\x01" #define FORMAT "%s %s - %s" public OnPluginStart() { RegConsoleCmd("sm_steamid", GetSteamID); LoadTranslations("common.phrases"); } public Action GetSteamID(int client, int args) { char arg[MAX_TARGET_LENGTH], ClientName[MAX_NAME_LENGTH], ClientSteamId[32]; GetCmdArg(1, arg, sizeof(arg)); int target = FindTarget(client, arg); if (target == -1) { return Plugin_Handled; } GetClientName(target, ClientName, sizeof(ClientName)); GetClientAuthId(target, AuthId_Steam2, ClientSteamId, sizeof(ClientSteamId)); PrintToChat(client, FORMAT, TAG, ClientName, ClientSteamId); return Plugin_Handled; }
- 1
-
Cytat
#include <sourcemod> #define TITLE_FORMAT "Informacje o %s [%s]\nWybierz, aby skopiować!" #define NAME_FORMAT "Nazwa: %s" #define STEAMID_FORMAT "Steam ID: %s" #define STEAMURL_FORMAT "Link do profilu: %s" #define CHAT_TAG " \x0F[ADMINS]\x01" #define pub public KeyValues Kv; char Path[256], ClientName[MAX_NAME_LENGTH], ClientSteamUrl[1024], ClientSteamId[32], ClientServerRank[256]; char Commands[][] = { "sm_admins", "sm_admini", "sm_adm" }; pub OnPluginStart() { for (int i = 0; i < sizeof(Commands); i++) RegConsoleCmd(Commands[i], CommandHelp); } pub Action CommandHelp(int client, int args) { BuildPath(Path_SM, Path, sizeof(Path), "configs/admins_list.ini"); Kv = new KeyValues("Admins"); Kv.ImportFromFile(Path); if (!Kv.GotoFirstSubKey()) return Plugin_Handled; Menu menu = new Menu(List_Handle); menu.SetTitle("Admini"); do { Kv.GetString("NAME", ClientName, sizeof(ClientName)); Kv.GetString("STEAM_ID", ClientSteamId, sizeof(ClientSteamId)); Kv.GetSectionName(ClientServerRank, sizeof(ClientServerRank)); Format(ClientServerRank, sizeof(ClientServerRank), "[%s] %s", ClientServerRank, ClientName); menu.AddItem(ClientSteamId, ClientServerRank); } while (Kv.GotoNextKey()); menu.Display(client, MENU_TIME_FOREVER); return Plugin_Handled; } pub Action AdminDetails(int client, const char[] NAME, const char[] STEAM_ID, const char[] STEAM_URL, const char[] RANK) { char pClientName[MAX_NAME_LENGTH], pClientSteamId[32], pClientSteamUrl[1024]; Format(pClientName, sizeof(pClientName), NAME_FORMAT, NAME); Format(pClientSteamId, sizeof(pClientSteamId), STEAMID_FORMAT, STEAM_ID); Format(pClientSteamUrl, sizeof(pClientSteamUrl), STEAMURL_FORMAT, STEAM_URL); Menu menu = new Menu(AdminDetails_Handler); menu.SetTitle(TITLE_FORMAT, NAME, RANK); menu.AddItem(NAME, pClientName); menu.AddItem(STEAM_ID, pClientSteamId); menu.AddItem(STEAM_URL, pClientSteamUrl); menu.ExitBackButton = true; menu.Display(client, MENU_TIME_FOREVER); } int List_Handle(Menu menu, MenuAction action, int client, int param) { if (action == MenuAction_Select) { char Item[128]; menu.GetItem(param, Item, sizeof(Item)); Kv.ImportFromFile(Path); if (!Kv.GotoFirstSubKey()) delete Kv; do { Kv.GetString("STEAM_ID", ClientSteamId, sizeof(ClientSteamId)); if (StrEqual(Item, ClientSteamId)) { Kv.GetString("NAME", ClientName, sizeof(ClientName)); Kv.GetString("STEAM_URL", ClientSteamUrl, sizeof(ClientSteamUrl)); Kv.GetSectionName(ClientServerRank, sizeof(ClientServerRank)); AdminDetails(client, ClientName, ClientSteamId, ClientSteamUrl, ClientServerRank); break; } } while (Kv.GotoNextKey()); } return 0; } int AdminDetails_Handler(Menu menu, MenuAction action, int client, int param) { if (action == MenuAction_Cancel && param == MenuCancel_ExitBack) CommandHelp(client, -1); else if (action == MenuAction_Select) { char Item[1024]; menu.GetItem(param, Item, sizeof(Item)); PrintToConsole(client, "%s", Item); PrintToChat(client, "%s Wejdz w konsole, aby skopiować wybraną opcję!", CHAT_TAG) } return 0; }
Nie wiem czy o to ci chodziło, tutaj możesz adminów dodawać do pliku .ini
-
Cytat
#include <sourcemod> #include <cstrike> public OnPluginStart() { AddCommandListener(CommandChangeTeam, "jointeam"); // AddCommandListener(CommandChangeTeam, "changeteam"); } public Action CommandChangeTeam(int client, const char[] command, int argc) { char arg[32]; GetCmdArg(1, arg, sizeof(arg)); if (StringToInt(arg) == CS_TEAM_T) { int PlayersCT = GetClientsOfTeam(CS_TEAM_CT); int PlayersTT = GetClientsOfTeam(CS_TEAM_T); if ((float(PlayersTT) / float(PlayersCT)) > 0.25) { PrintHintText(client, "Za dużo jest terrorystów!"); return Plugin_Handled; } } return Plugin_Continue; } stock bool IsValidClient(int client) { return (client >= 1 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client) && !IsClientSourceTV(client)); } stock int GetClientsOfTeam(int team) { int b = 0; for (int i = 1; i <= MaxClients; i++) { if (IsValidClient(i) && GetClientTeam(i) == team) b++; } return b; }
Teraz powinno zadziałać
-
PrintHintText("Za dużo jest terrorystów!");
zmien na
PrintHintText(client, "Za dużo jest terrorystów!");
- 1
-
#include <sourcemod> #include <cstrike> public OnPluginStart() { AddCommandListener(CommandChangeTeam, "jointeam"); AddCommandListener(CommandChangeTeam, "changeteam"); } public Action CommandChangeTeam(int client, const char[] command, int argc) { char arg[32]; GetCmdArg(1, arg, sizeof(arg)); if (StringToInt(arg) == CS_TEAM_T) { int PlayersCT = GetClientsOfTeam(CS_TEAM_CT); int PlayersTT = GetClientsOfTeam(CS_TEAM_T); if ((PlayersTT / PlayersCT) > 0.25) { PrintHintText("Za dużo jest terrorystów!"); return Plugin_Handled; } } return Plugin_Continue; } stock bool IsValidClient(int client) { return (client >= 1 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client) && !IsClientSourceTV(client)); } stock int GetClientsOfTeam(int team) { int b = 0; for (int i = 1; i <= MaxClients; i++) { if(IsValidClient(i) && IsPlayerAlive(i) && GetClientTeam(i) == team) b++; } return b; }
powinno zadziałać lecz nie testowałem bo nie mam jak
-
#include <sourcemod> char ClientColor[MAXPLAYERS + 1][256]; char red[256], green[256], blue[256], tytul[256], path[256]; KeyValues kv; public OnPluginStart() { RegConsoleCmd("sm_kolorek", Menu_Colors); HookEvent("player_spawn", Player_Reset); } public Action Player_Reset(Event e, const char[] n, bool b) { int client = GetClientOfUserId(GetEventInt(e, "userid")); SetColor(client, ClientColor[client]); } public Action Menu_Colors(int client, int args) { Menu menu = new Menu(Menu_Handler); menu.SetTitle("Menu kolorów"); BuildPath(Path_SM, path, sizeof(path), "configs/plugin-kolory.ini"); kv = new KeyValues("Kolory"); kv.ImportFromFile(path); if (!kv.GotoFirstSubKey()) { delete kv; return Plugin_Handled; } do { kv.GetString("red", red, sizeof(red)); kv.GetString("green", green, sizeof(green)); kv.GetString("blue", blue, sizeof(blue)); kv.GetSectionName(tytul, sizeof(tytul)) menu.AddItem(tytul, tytul); } while (kv.GotoNextKey()); menu.Display(client, MENU_TIME_FOREVER); return Plugin_Handled; } void SetColor(int ent, const char[] Item) { kv.ImportFromFile(path); if (!kv.GotoFirstSubKey()) { delete kv; return Plugin_Handled; } do { char Wybor[64]; kv.GetSectionName(Wybor, sizeof(Wybor)); if (StrEqual(Item, Wybor)) { SetEntityRenderColor(ent, kv.GetNum("red"), kv.GetNum("green"), kv.GetNum("blue"), kv.GetNum("alpha")); break; } } while (kv.GotoNextKey()); } int Menu_Handler(Menu menu, MenuAction action, int client, int param2) { switch (action) { case MenuAction_Select: { char Item[64]; menu.GetItem(param2, Item, sizeof(Item)); ClientColor[client] = Item; SetColor(client, Item); } case MenuAction_End: delete menu; } return 0; }
do tego pluginu potrzebujesz configu, którego wrzucasz do sourcemod/configs, w który podajesz nazwy kolorów wraz z paletą rgba
#include <sourcemod> #include <sdktools> ConVar g_ShowDmgHintText; public OnPluginStart() { g_ShowDmgHintText = CreateConVar("sm_showdmg", "0", "Obrażenia"); HookEvent("player_hurt", Player_Hurt); AutoExecConfig(true, "cfg_showdmg"); } public Action Player_Hurt(Event e, const char[] n, bool b) { if (!g_ShowDmgHintText.BoolValue) return Plugin_Handled; int attacker = GetClientOfUserId(GetEventInt(e, "attacker")); int victim = GetClientOfUserId(GetEventInt(e, "userid")); int donedmg = GetEventInt(e, "dmg_health"); char victimName[64]; GetClientName(victim, victimName, sizeof(victimName)); PrintHintText(attacker, "Zadałeś %s %d obrażeń", victimName, donedmg); return Plugin_Continue; }
a ten plugin sam tworzy plik cfg w csgo/cfg/sourcemod, w którym możesz pozmieniać cvary lub w grze
jeżeli są to pojedyncze opcje to celowałbym w cvary, które nie wymagają aż tylu lini kodu
-
Zależy co masz na myśli "config", chodzi ci o ConVary czy czytanie z pliku przez Kv
- 1
-
Cytat
#include <sourcemod>
char red[255], green[255], blue[255], tytul[255], path[256];
KeyValues kv;
public OnPluginStart()
{
RegConsoleCmd("sm_kolorek", Menu_Colors);
}
public Action Menu_Colors(int client, int args)
{
Menu menu = new Menu(Menu_Handler);
menu.SetTitle("Menu kolorów");
BuildPath(Path_SM, path, sizeof(path), "configs/plugin-kolory.ini");
kv = new KeyValues("Kolory");
kv.ImportFromFile(path);
if (!kv.GotoFirstSubKey())
{
delete kv;
return Plugin_Handled;
}
do
{
kv.GetString("red", red, sizeof(red));
kv.GetString("green", green, sizeof(green));
kv.GetString("blue", blue, sizeof(blue));
kv.GetSectionName(tytul, sizeof(tytul))
menu.AddItem(tytul, tytul);
} while (kv.GotoNextKey());
menu.Display(client, MENU_TIME_FOREVER);
return Plugin_Handled;
}
int Menu_Handler(Menu menu, MenuAction action, int client, int param2)
{
switch (action)
{
case MenuAction_Select:
{
char Item[64];
menu.GetItem(param2, Item, sizeof(Item));
kv.ImportFromFile(path);
if (!kv.GotoFirstSubKey())
{
delete kv;
return false;
}
do
{
char Wybor[64];
kv.GetSectionName(Wybor, sizeof(Wybor));
if (StrEqual(Item, Wybor)) {
SetEntityRenderColor(client, kv.GetNum("red"), kv.GetNum("green"), kv.GetNum("blue"), kv.GetNum("alpha"));
break;
}
} while (kv.GotoNextKey());
}
case MenuAction_End:
delete menu;
}
return 0;
}
powinno działać
-
zgaduję że twój serwer stoi na linuxie a pobierasz sm/mm na windowsa lub na odwrót
-
masz sourcebany dodane?
-
public OnPluginStart() { AddCommandListener(BlockTeamChange, "jointeam"); } public Action BlockTeamChange(int client, const char[] command, int argc) { char arg[32]; GetCmdArg(1, arg, sizeof(arg)); if (StringToInt(arg) == CS_TEAM_T) { int CT_Players = GetClientsOfTeam(CS_TEAM_CT); int TT_Players = GetClientsOfTeam(CS_TEAM_T); if (CT_Players <= 4) { if (TT_Players) return Plugin_Handled; } else if (CT_Players > 4 && CT_Players <= 9) { if (TT_Players >= 2) return Plugin_Handled; } else if (CT_Players > 10 && CT_Players <= 14) { if (TT_Players >= 3) return Plugin_Handled; } else if (CT_Players > 15 && CT_Players <= 20) { if (TT_Players >= 4) return Plugin_Handled; } } return Plugin_Continue; }
Najprościej możesz to zrobić w taki sposób
-
tak a w cfg/sourcemod/bomb_sound.cfg zmieniasz
Cytatnazwa_piosenki.mp3
na taka samą jak nazwa muzyki
-
zależy to wszystko od tego jaki plugin na sklep posiadasz, jeżeli zephyrus to do używania w/w zadań na czacie wymagany jest Simple Chat Processor (Redux), jeżeli nie pokazują się modele, to nie są one wgrane poprawnie na twój serwer bądź zła ścieżka do modeli w items.txt
-
#include <sourcemod> #include <sdktools> ConVar g_c4Timer; ConVar g_SoundName; ConVar g_SoundVolume; float c4Timer; float Tick = 0.0; char SoundName[256]; public OnPluginStart() { g_SoundName = CreateConVar("sm_bomb_sound_name", "nazwa_piosenki.mp3", "Nazwa pliku .mp3/.wav"); g_SoundVolume = CreateConVar("sm_bomb_sound_volume", "0.05", "Głośnośc piosenki"); HookEvent("bomb_planted", Bomb_Planted); AutoExecConfig(true, "bomb_sound"); } public Action Bomb_Planted(Event e, const char[] name, bool broadCast) { g_c4Timer = FindConVar("mp_c4timer"); c4Timer = GetConVarFloat(g_c4Timer); Tick = 0.0; CreateTimer(1.0, BombTick, _, TIMER_REPEAT); } public Action BombTick(Handle timer) { Tick++; float TimeToExplose = c4Timer - Tick; if (TimeToExplose == 12.0) EmitSoundToAll(SoundName, _, _, _, _, GetConVarFloat(g_SoundVolume), _, _, _, _, _, _); else { if (TimeToExplose <= 0) { for (int i = 1; i <= MaxClients; i++) StopSound(i, SNDCHAN_AUTO, SoundName); KillTimer(timer); } } } public OnClientConnected(int client) { PrecacheFix(); } void PrecacheFix() { GetConVarString(g_SoundName, SoundName, sizeof(SoundName)); Format(SoundName, sizeof(SoundName), "sound/%s", SoundName); AddFileToDownloadsTable(SoundName); GetConVarString(g_SoundName, SoundName, sizeof(SoundName)); Format(SoundName, sizeof(SoundName), "*/%s", SoundName); PrecacheSound(SoundName); }
Piosenkę wrzucasz do folderu sound, a w cfg/sourcemod/bomb_sound.cfg ustawiasz nazwę oraz głośność
-
#include <sourcemod> #include <cstrike> #include <clients> public OnPluginStart() { RegConsoleCmd("sm_menu", CMD_Menu); } public Action CMD_Menu(int client, int args) { if (!IsClientConnected(client) || IsFakeClient(client)) return Plugin_Handled; Menu menu = new Menu(Menu_Handle); menu.SetTitle("Wybór drużyny\nMenu dla [%s]", (GetClientTeam(client) == CS_TEAM_CT ? "CT" : "TT")); menu.AddItem("1", "CT", (GetClientTeam(client) == CS_TEAM_CT ? ITEMDRAW_DISABLED : ITEMDRAW_DEFAULT)); menu.AddItem("2", "TT", (GetClientTeam(client) == CS_TEAM_T ? ITEMDRAW_DISABLED : ITEMDRAW_DEFAULT)); menu.AddItem("3", "Spectator"); menu.ExitButton = true; menu.Display(client, MENU_TIME_FOREVER); return Plugin_Handled; } int Menu_Handle(Menu menu, MenuAction action, int client, int param2) { switch (action) { case MenuAction_Select: { char choice[32]; menu.GetItem(param2, choice, sizeof(choice)); if (StrEqual(choice, "1")) ChangeClientTeam(client, CS_TEAM_CT); else if (StrEqual(choice, "2")) ChangeClientTeam(client, CS_TEAM_T); else ChangeClientTeam(client, CS_TEAM_SPECTATOR); } } return 0; }
lub możesz zrobić dwa menu dla CT oraz TT
Drukowanie komend na chat
w Problem z kodem
Opublikowano
Wyświetla się ostatnia bo nadpisujesz zmienną chat
Z której korzystasz tutaj