Skocz do zawartości

Nowy szablon forum

mygo.pl

Stworzyliśmy dla Was nowy wygląd forum. Z pewnością znajdziesz rzeczy, które wg Ciebie mogą zostać zmienione - wspomnij o tym w specjalnym wątku.

Czytaj więcej

Jak założyć własną sieć

serwerów CS

Zastanawiasz się nad prowadzeniem własnej sieci serwerów? Przeczytaj podstawowe informacje, na które należy zwrócić uwagę, przy takim projekcie.

Czytaj więcej

Tworzymy spis sieci

dodaj swoją

Dodaj sieć do której należysz, pozwoli to na promocję i budowę ogólnopolskiej bazy sieci CS.

Czytaj więcej

Dodanie Cooldownu ( limitu ) do konkretnej komendy


`Fusion
 Udostępnij

Rekomendowane odpowiedzi

Chciałem dodać do mojego serwera PropHunt Cooldown, aby nie można było uzywać komendy !whistle cały czas.

 

Próbowałem robić to samemu ale wyskakiwały same errory.

 

PropHunta ściągnąłem stąd; https://forums.alliedmods.net/showthread.php?p=2384364

 

zawartość commands.sp

 

 


#include "prophunt/include/phclient.inc" // say /tp /third /thirdperson public Action Cmd_ToggleThirdPerson(int client, int args) {     if (!IsClientInGame(client) || !IsPlayerAlive(client))         return Plugin_Stop;     // Only allow Terrorists to use thirdperson view     if (GetClientTeam(client) != CS_TEAM_T) {         PrintToChat(client, "%s%t", PREFIX, "Only terrorists can use");         return Plugin_Handled;     }     if (!g_bInThirdPersonView[client]) {         SetThirdPersonView(client, true);         PrintToChat(client, "%s%t", PREFIX, "Type again for ego");     } else {         SetThirdPersonView(client, false);     }     return Plugin_Continue; } // say /whistle public Action Cmd_PlayWhistle(int _client, int args) {     PHClient client = GetPHClient(_client);     // check if whistling is enabled     if (!GetConVarBool(cvar_Whistle) || !client.isAlive)         return Plugin_Handled;     bool cvarWhistleSeeker = view_as<bool>(GetConVarInt(cvar_WhistleSeeker));     if (!cvarWhistleSeeker && client.team != CS_TEAM_T) {         PrintToChat(client.index, "%s%t", PREFIX, "Only terrorists can use");         return Plugin_Handled;     }     int cvarWhistleTimes = GetConVarInt(cvar_WhistleTimes);     if (client.team == CS_TEAM_T || g_iWhistleCount[client.index] < cvarWhistleTimes) {         if (client.team == CS_TEAM_T) {             MakeClientWhistle(client.index);             PrintToChatAll("%s%N %t", PREFIX, client, "whistled");         } else {             int target, iCount;             float maxrange, range, clientOrigin[3];             client.GetOrigin(clientOrigin);             for (int i = 1; i <= MaxClients; i++) {                 PHClient c = GetPHClient(i);                 if (c && c.isAlive && c.team == CS_TEAM_T) {                     iCount++;                     float targetOrigin[3];                     c.GetOrigin(targetOrigin);                     range = GetVectorDistance(clientOrigin, targetOrigin);                     if (range > maxrange) {                         maxrange = range;                         target = i;                     }                 }             }             if (iCount > 1) {                 MakeClientWhistle(target);                 PrintToChatAll("%s %N forced %N to whistle.", PREFIX, client, target);                 g_iWhistleCount[client.index]++;                 PrintToChat(client.index, "%s%t", PREFIX, "whistles left", (cvarWhistleTimes - g_iWhistleCount[client.index]));             }         }     } else {         PrintToChat(client.index, "%s%t", PREFIX, "whistle limit exceeded", cvarWhistleTimes);     }     return Plugin_Handled; } // say /help public Action Cmd_DisplayHelp(int client, int args) {     ShowMOTDPanel(client, "PropHunt", "https://tilastokeskus.github.io/sm-PropHunt/r_rules.html", MOTDPANEL_TYPE_URL);     return Plugin_Handled; } // say /freeze // Freeze hiders in position public Action Cmd_Freeze(int _client, int args) {     PHClient client = GetPHClient(_client);     if (!GetConVarInt(cvar_HiderFreezeMode) || client.team != CS_TEAM_T || !client.isAlive)         return Plugin_Handled;     if (client.isFreezed) {         client.SetFreezed(false);         PrintToChat(client.index, "%s%t", PREFIX, "Hider Unfreezed");     } else if (GetConVarBool(cvar_HiderFreezeInAir) || (GetEntityFlags(client.index) & FL_ONGROUND)) {         client.SetFreezed(true);         char buffer[128];         Format(buffer, sizeof(buffer), "*/%s", g_sndFreeze);         EmitSoundToClient(client.index, buffer);         PrintToChat(client.index, "%s%t", PREFIX, "Hider Freezed");     }     return Plugin_Handled; } // Admin Command // ph_force_whistle // Forces a terrorist player to whistle public Action ForceWhistle(int client, int args) {     if (!GetConVarBool(cvar_Whistle)) {         ReplyToCommand(client, "Disabled.");         return Plugin_Handled;     }     if (GetCmdArgs() < 1) {         ReplyToCommand(client, "Usage: ph_force_whistle <#userid|steamid|name>");         return Plugin_Handled;     }     char player[70];     GetCmdArg(1, player, sizeof(player));     int target = FindTarget(client, player);     if (target == -1)         return Plugin_Handled;     if (GetClientTeam(target) == CS_TEAM_T && IsPlayerAlive(target)) {         char sound[MAX_WHISTLE_LENGTH];         g_WhistleSounds.GetString(GetRandomInt(0, g_WhistleSounds.Length - 1), sound, MAX_WHISTLE_LENGTH);         EmitSoundToAll(sound, target, SNDCHAN_AUTO, SNDLEVEL_GUNFIRE);         PrintToChatAll("%s%N %t", PREFIX, target, "whistled");     } else {         ReplyToCommand(client, "Hide and Seek: %t", "Only terrorists can use");     }     return Plugin_Handled; } // say /whoami // displays the model name in chat again public Action Cmd_DisplayModelName(int client, int args) {     // only enable command, if player already chose a model     if (!IsPlayerAlive(client) || g_iModelChangeCount[client] == 0)         return Plugin_Handled;     // only Ts can use a model     if (GetClientTeam(client) != CS_TEAM_T) {         PrintToChat(client, "%s%t", PREFIX, "Only terrorists can use");         return Plugin_Handled;     }     char modelName[128];     GetClientModel(client, modelName, sizeof(modelName));     PrintToChat(client, "%s%t\x01 %s.", PREFIX, "Model Changed", modelName);     return Plugin_Handled; } // say /ct public Action Cmd_RequestCT(int client, int args) {     if (GetConVarBool(cvar_TurnsToScramble)) {         PrintToChat(client, "%sCommand disabled.", PREFIX);         return Plugin_Handled;     }     if (GetClientTeam(client) == CS_TEAM_CT) {         PrintToChat(client, "%sYou are already on the seeking side", PREFIX);         return Plugin_Handled;     }     if (g_iHiderToSeekerQueue[client] != NOT_IN_QUEUE) {         PrintToChat(client, "%sYou are already in the queue", PREFIX);         return Plugin_Stop;     }     g_iHidersInSeekerQueue++;     g_iHiderToSeekerQueue[client] = g_iHidersInSeekerQueue;     PrintToChat(client, "%sYou are now in the seeker queue", PREFIX);     PrintToChat(client, "%sTurns until team switch: %d", PREFIX, SimulateTurnsToSeeker(g_iHidersInSeekerQueue));     return Plugin_Handled; } public Action Cmd_JoinTeam(int client, int args) {     if (!client || !IsClientInGame(client) || FloatCompare(GetConVarFloat(cvar_CTRatio), 0.0) == 0) {         return Plugin_Continue;     }     char arg[5];     if (!GetCmdArgString(arg, sizeof(arg))) {         return Plugin_Continue;     }     int team = StringToInt(arg);     // Player wants to join CT     if (team == CS_TEAM_CT) {         int teamClientCount[5];         teamClientCount[CS_TEAM_CT] = GetTeamClientCount(CS_TEAM_CT);         teamClientCount[CS_TEAM_T] = GetTeamClientCount(CS_TEAM_T);         // This client would be in CT if we continue.         teamClientCount[CS_TEAM_CT]++;         // And would leave T         if (GetClientTeam(client) == CS_TEAM_T)             teamClientCount[CS_TEAM_T]--;         // Check, how many terrors are going to get switched to ct at the end of the round         for (int i = 1; i <= MaxClients; i++) {             if (IsClientInGame(i)) {                 teamClientCount[g_iClientTeam]++;                 teamClientCount[GetClientTeam(i)]--;             }         }         float fRatio = FloatDiv(float(teamClientCount[CS_TEAM_T]), float(teamClientCount[CS_TEAM_CT]));         float fCFGRatio = GetConVarFloat(cvar_CTRatio);         //PrintToServer("Debug: Player %N wants to join CT. CTCount: %d TCount: %d Ratio: %f", client, iCTCount, iTCount, FloatDiv(float(iCTCount), float(iTCount)));         // There are more CTs than we want in the CT team.         if (teamClientCount[CS_TEAM_CT] > 1 && fRatio < fCFGRatio) {             PrintCenterText(client, "CT team is full");             //PrintToServer("Debug: Blocked.");             return Plugin_Stop;         }     } else if (team == CS_TEAM_T) {         int iCTCount = GetTeamClientCount(CS_TEAM_CT);         int iTCount = GetTeamClientCount(CS_TEAM_T);         iTCount++;         if (GetClientTeam(client) == CS_TEAM_CT)             iCTCount--;         if (iCTCount == 0 && iTCount >= 2) {             PrintCenterText(client, "Cannot leave CT empty");             //PrintToServer("Debug: Blocked.");             return Plugin_Stop;         }     }     return Plugin_Continue; } public Action Cmd_SelectModelMenu(int client, int args) {    return ShowSelectModelMenu(client, args);  }

 

 

 

 

Zawartość prophunt.sp



 

#pragma semicolon 1 #include <sourcemod> #include <sdktools> #include <cstrike>  #include <sdkhooks> #include "prophunt/include/globals.inc" #include "prophunt/include/keyvalues.inc" #include "prophunt/include/utils.inc" #pragma newdecls required #define PLUGIN_VERSION "1.0.5" public Plugin myinfo = {     name = "PropHunt",     author = "Statistician",     description = "Terrorists choose a model and hide, CTs try to find and kill them.",     version = PLUGIN_VERSION,     url = "http://github.com/tilastokeskus/sm-PropHunt" }; public void OnPluginStart() {     Handle hVersion = CreateConVar("ph_version", PLUGIN_VERSION, "PropHunt",              FCVAR_PLUGIN | FCVAR_SPONLY | FCVAR_REPLICATED | FCVAR_NOTIFY | FCVAR_DONTRECORD);     SetConVarString(hVersion, PLUGIN_VERSION);     CreateConVars();     RegisterCommands();     AddListeners();     SetOffsets();     LoadLang();     // init clients     for (int x = 1; x <= MaxClients; x++) {         if (IsClientInGame(x))             OnClientPutInServer(x);     }     CreateTimer(120.0, SpamCommands, 0);     g_hForceCamera = FindConVar("mp_forcecamera");     AutoExecConfig(true, "prophunt"); } public void OnPluginEnd() {     ServerCommand("mp_restartgame 1");     for (int client = 1; client <= MaxClients; client++) {         if (g_hAutoFreezeTimers[client] != INVALID_HANDLE) {             KillTimer(g_hAutoFreezeTimers[client]);             g_hAutoFreezeTimers[client] = INVALID_HANDLE;         }     } } public void OnConfigsExecuted() {     // set bad server cvars     for (int i = 0; i < sizeof(protected_cvars); i++) {         g_hProtectedConvar = FindConVar(protected_cvars);         if (g_hProtectedConvar == INVALID_HANDLE)             continue;         previous_values = GetConVarInt(g_hProtectedConvar);         SetConVarInt(g_hProtectedConvar, forced_values, true);         HookConVarChange(g_hProtectedConvar, OnCvarChange);     } } // teach the players the /whistle and /tp commands public Action SpamCommands(Handle timer, int data) {     if (GetConVarBool(cvar_Whistle) && data == 1)         PrintToChatAll("%s%t", PREFIX, "T type /whistle");     else if (!GetConVarBool(cvar_Whistle) || data == 0) {         for (int i = 1; i <= MaxClients; i++)             if (IsClientInGame(i) && GetClientTeam(i) == CS_TEAM_T)                 PrintToChat(i, "%s%t", PREFIX, "T type /tp");     }          CreateTimer(120.0, SpamCommands, (data == 0 ? 1 : 0));     return Plugin_Continue; } // prevent changes to protected cvars public void OnCvarChange(Handle convar, const char[] oldValue, const char[] newValue) {     char cvarName[50];     GetConVarName(convar, cvarName, sizeof(cvarName));     for (int i = 0; i < sizeof(protected_cvars); i++) {         if (StrEqual(protected_cvars, cvarName) && StringToInt(newValue) != forced_values) {             SetConVarInt(convar, forced_values);             PrintToServer("Hide and Seek: %T", "protected cvar", LANG_SERVER);             break;         }     } } // prevent changes to hider speed public void OnChangeHiderSpeed(Handle convar, const char[] oldValue, const char[] newValue) {     for (int i = 1; i <= MaxClients; i++) {         if (IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == CS_TEAM_T)             SetEntDataFloat(i, g_flLaggedMovementValue, GetConVarFloat(cvar_HiderSpeed), true);     } } static void CreateConVars() {     cvar_FreezeCTs = CreateConVar("ph_freezects", "1", "Should CTs get freezed and blinded on spawn?", FCVAR_PLUGIN, true, 0.0, true, 1.0);     cvar_FreezeTime = CreateConVar("ph_freezetime", "45.0", "How long should the CTs be freezed after spawn?", FCVAR_PLUGIN, true, 1.00, true, 120.00);     cvar_ChangeLimit = CreateConVar("ph_changelimit", "2", "How often a T is allowed to choose his model ingame? 0 = unlimited", FCVAR_PLUGIN, true, 0.00);     cvar_ChangeLimittime = CreateConVar("ph_changelimittime", "30.0", "How long should a T be allowed to change his model again after spawn?", FCVAR_PLUGIN, true, 0.00);     cvar_AutoChoose = CreateConVar("ph_autochoose", "0", "Should the plugin choose models for the hiders automatically?", FCVAR_PLUGIN, true, 0.0, true, 1.0);     cvar_Whistle = CreateConVar("ph_whistle", "1", "Are terrorists allowed to whistle?", FCVAR_PLUGIN);     cvar_WhistleTimes = CreateConVar("ph_whistle_times", "5", "How many times a hider is allowed to whistle per round?", FCVAR_PLUGIN);     cvar_WhistleSeeker = CreateConVar("ph_whistle_seeker", "0", "Allow CTs to enforce T whistle?", FCVAR_PLUGIN);     cvar_HiderWinFrags = CreateConVar("ph_hider_win_frags", "5", "How many frags should surviving terrorists gain?", FCVAR_PLUGIN, true, 0.00, true, 10.00);     cvar_SlaySeekers = CreateConVar("ph_slay_seekers", "0", "Should we slay all seekers on round end and there are still some hiders alive? (Default: 0)", FCVAR_PLUGIN, true, 0.0, true, 1.0);     cvar_HPSeekerEnable = CreateConVar("ph_hp_seeker_enable", "1", "Should CT lose HP when shooting, 0 = off/1 = on.", FCVAR_PLUGIN, true, 0.0, true, 1.0);     cvar_HPSeekerDec = CreateConVar("ph_hp_seeker_dec", "5", "How many hp should a CT lose on shooting?", FCVAR_PLUGIN, true, 0.00);     cvar_HPSeekerInc = CreateConVar("ph_hp_seeker_inc", "15", "How many hp should a CT gain when hitting a hider?", FCVAR_PLUGIN, true, 0.00);     cvar_HPSeekerIncShotgun = CreateConVar("ph_hp_seeker_inc_shotgun", "5", "How many hp should a CT gain when hitting a hider with shotgun? (CS:GO only)", FCVAR_PLUGIN, true, 0.00);     cvar_HPSeekerBonus = CreateConVar("ph_hp_seeker_bonus", "50", "How many hp should a CT gain when killing a hider?", FCVAR_PLUGIN, true, 0.00);     cvar_HiderSpeed = CreateConVar("ph_hidersspeed", "1.00", "Hiders speed (Default: 1.00).", FCVAR_PLUGIN, true, 1.00, true, 3.00);     cvar_DisableDucking = CreateConVar("ph_disable_ducking", "1", "Disable ducking. (Default: 1).", FCVAR_PLUGIN, true, 0.00, true, 1.00);     cvar_AutoThirdPerson = CreateConVar("ph_auto_thirdperson", "1", "Enable thirdperson view for hiders automatically. (Default: 1)", FCVAR_PLUGIN, true, 0.00, true, 1.00);     cvar_HiderFreezeMode = CreateConVar("ph_hider_freeze_mode", "1", "0: Disables /freeze command for hiders, 1: Only freeze on position, be able to move camera, 2: Freeze completely (no cameramovements) (Default: 2)", FCVAR_PLUGIN, true, 0.00, true, 2.00);     cvar_HideBlood = CreateConVar("ph_hide_blood", "1", "Hide blood on hider damage. (Default: 1)", FCVAR_PLUGIN, true, 0.00, true, 1.00);     cvar_ShowHelp = CreateConVar("ph_show_help", "0", "Show help explaining the game on first player spawn. (Default: 0)", FCVAR_PLUGIN, true, 0.00, true, 1.00);     cvar_CTRatio = CreateConVar("ph_ct_ratio", "3", "The ratio of hiders to 1 seeker. 0 to disables teambalance. (Default: 3)", FCVAR_PLUGIN, true, 0.00, true, 64.00);     cvar_DisableUse = CreateConVar("ph_disable_use", "1", "Disable CTs pushing things. (Default: 1)", FCVAR_PLUGIN, true, 0.00, true, 1.00);     cvar_HiderFreezeInAir = CreateConVar("ph_hider_freeze_inair", "0", "Are hiders allowed to freeze in the air? (Default: 0)", FCVAR_PLUGIN, true, 0.00, true, 1.00);     cvar_HidePlayerLocation = CreateConVar("ph_hide_player_locations", "1", "Hide the location info shown next to players name on voice chat and teamsay? (Default: 1)", FCVAR_PLUGIN, true, 0.00, true, 1.00);     cvar_AutoFreezeTime = CreateConVar("ph_auto_freeze_time", "5", "Time after which stationary players should freeze automatically (Default: 5) - 0 to disable", FCVAR_PLUGIN, true, 0.00);     cvar_GuaranteedCTTurns = CreateConVar("ph_guaranteed_ct_turns", "3", "Turns after which CTs might be switched to the T side (Default: 3) - 0 to never switch", FCVAR_PLUGIN, true, 0.00);     cvar_KnifeSpeed = CreateConVar("ph_knifespeed", "1.40", "Running speed when holding a knife (multiplier)", FCVAR_PLUGIN, true, 0.00);     cvar_LimitSpec = CreateConVar("ph_limitspec", "2", "0: Do not limit spectating, 1: Limit spectating to own team, 2: Limit spectating to CT. (Default: 2)", FCVAR_PLUGIN, true, 0.00, true, 2.00);     cvar_IncludeDefaultModels = CreateConVar("ph_include_default_models", "1", "0: Include default model list only when there isn't one for the current map, 1: Always include default model list. (Default: 1)", FCVAR_PLUGIN, true, 0.00, true, 1.00);     cvar_ForcePeriodicWhistle = CreateConVar("ph_force_periodic_whistle", "0", "Periodically, every x seconds, force a random hider to whistle. 0 to disable. (Default: 0)", FCVAR_PLUGIN, true, 0.00);     cvar_PeriodicWhistleDelay = CreateConVar("ph_periodic_whistle_delay", "60", "Number of seconds for the first periodic whistle, if they are enabled. (Default: 60)", FCVAR_PLUGIN, true, 0.00);     cvar_TurnsToScramble = CreateConVar("ph_turns_to_scramble", "0", "Scramble teams every x turns. 0 to disable scrambling. Disables the /ct command if enabled. (Default: 0)", FCVAR_PLUGIN, true, 0.00); } static void RegisterCommands() {     RegConsoleCmd("rules", Cmd_DisplayHelp, "Displays a panel with information on how to play.");     RegConsoleCmd("hide", Cmd_SelectModelMenu, "Opens a menu with different models to choose as hider.");     RegConsoleCmd("prop", Cmd_SelectModelMenu, "Opens a menu with different models to choose as hider.");     RegConsoleCmd("model", Cmd_SelectModelMenu, "Opens a menu with different models to choose as hider.");     RegConsoleCmd("tp", Cmd_ToggleThirdPerson, "Toggles the view to thirdperson for hiders.");     RegConsoleCmd("thirdperson", Cmd_ToggleThirdPerson, "Toggles the view to thirdperson for hiders.");     RegConsoleCmd("third", Cmd_ToggleThirdPerson, "Toggles the view to thirdperson for hiders.");     RegConsoleCmd("jointeam", Cmd_JoinTeam);     RegConsoleCmd("whistle", Cmd_PlayWhistle, "Plays a random sound from the hiders position to give the seekers a hint.");     RegConsoleCmd("whoami", Cmd_DisplayModelName, "Displays the current models description in chat.");     RegConsoleCmd("freeze", Cmd_Freeze, "Toggles freezing for hiders.");     RegConsoleCmd("ct", Cmd_RequestCT, "Requests a switch to the seeking side.");     RegAdminCmd("ph_force_whistle", ForceWhistle, ADMFLAG_CHAT, "Force a player to whistle");     RegAdminCmd("ph_reload_models", ReloadModels, ADMFLAG_RCON, "Reload the modellist from the map config file."); } static void AddListeners() {     HookConVarChange(cvar_HiderSpeed, OnChangeHiderSpeed);     HookEvent("player_spawn", Event_OnPlayerSpawn);     HookEvent("weapon_fire", Event_OnWeaponFire);     HookEvent("player_death", Event_OnPlayerDeath);     //HookEvent("player_death", Event_OnPlayerDeath_Pre, EventHookMode_Pre);     HookEvent("round_start", Event_OnRoundStart);     HookEvent("round_end", Event_OnRoundEnd);     HookEvent("round_end", Event_OnRoundEnd_Pre, EventHookMode_Pre);     HookEvent("player_team", Event_OnPlayerTeam);     //HookEvent("teamchange_pending", Event_OnTeamChange);     HookEvent("item_equip", Event_ItemEquip);     AddCommandListener(Cmd_spec_next, "spec_next");     AddCommandListener(Cmd_spec_prev, "spec_prev");     AddCommandListener(Cmd_spec_player, "spec_player");     AddCommandListener(Cmd_spec_mode, "spec_mode"); } static void SetOffsets() {     g_Freeze = FindSendPropOffs("CBasePlayer", "m_fFlags");     g_flLaggedMovementValue = FindSendPropOffs("CCSPlayer", "m_flLaggedMovementValue"); } static void LoadLang() {     LoadTranslations("plugin.prophunt");     LoadTranslations("common.phrases"); } #include "prophunt/roundevents.sp" #include "prophunt/mapevents.sp" #include "prophunt/clientevents.sp" #include "prophunt/commands.sp" #include "prophunt/menus.sp" #include "prophunt/models.sp" #include "prophunt/spectate.sp" #include "prophunt/teamevents.sp"

 

Prosiłbym o jak najszybszą odpowiedź.

Edytowane przez `Fusion
Odnośnik do komentarza
Udostępnij na innych stronach

Gość
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
 Udostępnij

×
×
  • Dodaj nową pozycję...