Написание плагинов

Dobro777

Участник
Сообщения
45
Реакции
5
@Dobro777, вот версия, которая будет добавлять разницу м/у sm_startmoney_def и sm_startmoney_first во втором раунде.
В КС же в начале раунда не даёт деньги игроку сверх заработанного, если у него их меньше значения квара mp_startmoney
Хорошо спасибо, проверю как отпишу.
 

iLoco

Пишу плагины за печеньки 🍪🍪🍪
Сообщения
2,265
Реакции
1,323
Может кто дать код для вывода сообщения всем в чат или хинт в начале раунда (когда раунд начался)?
PHP:
public void OnPluginStart()
{
    HookEvent("round_start",Event_Start);
}

public void Event_Start(Event hEvent,const char[] client, bool bDontBroadcast)
{
    PrintToChatAll("text");
    PrintCenterTextAll("text");
    PrintHintTextToAll("text");
}
 
  • Мне нравится
Реакции: Afro

smxnet

Участник
Сообщения
80
Реакции
4
Привет ребят кто может подсказать или написать небольшой плагин вот что бы в нем можно было указать steam id игрока и ему бы в игре никогда не выдавалась бомба в начале раунда но поднять с земли он ее мог и поставить когда он играет за террористов заранее благодарю (сервер css)
 

NotToday

Участник
Сообщения
79
Реакции
2
Может ли кто-то подправить плагин турели для зм?
Она не ломается.

C-подобный:
/**
 * ============================================================================
 *
 *  Zombie Plague
 *
 *
 *  Copyright (C) 2015-2019 Nikita Ushakov (Ireland, Dublin)
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * ============================================================================
 **/

#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>
#include <zombieplague>

#pragma newdecls required

/**
 * @brief Record plugin info.
 **/
public Plugin myinfo =
{
    name            = "[ZP] ExtraItem: DroneGun",
    author          = "qubka (Nikita Ushakov)",     
    description     = "Addon of extra items",
    version         = "1.0",
    url             = "https://forums.alliedmods.net/showthread.php?t=290657"
}

/**
 * @section Information about weapon.
 **/
#define WEAPON_DRONE_HEALTH        500
#define WEAPON_DRONE_MULTIPLIER    3.0
/**
 * @endsection
 **/
 
// Item index
int gItem; int gWeapon;
#pragma unused gItem, gWeapon

/**
 * @brief Called after a zombie core is loaded.
 **/
public void ZP_OnEngineExecute(/*void*/)
{
    // Items
    gItem = ZP_GetExtraItemNameID("drone gun");
    if(gItem == -1) SetFailState("[ZP] Custom extraitem ID from name : \"drone gun\" wasn't find");
    
    // Weapons
    gWeapon = ZP_GetWeaponNameID("drone gun");
    if(gWeapon == -1) SetFailState("[ZP] Custom weapon ID from name : \"drone gun\" wasn't find");
    
    // Sounds
    PrecacheSound("sound/survival/turret_death_01.wav", true);
    PrecacheSound("sound/survival/turret_idle_01.wav", true);
    PrecacheSound("sound/survival/turret_takesdamage_01.wav", true);
    PrecacheSound("sound/survival/turret_takesdamage_02.wav", true);
    PrecacheSound("sound/survival/turret_takesdamage_03.wav", true);
    PrecacheSound("sound/survival/turret_lostplayer_01.wav", true);
    PrecacheSound("sound/survival/turret_lostplayer_02.wav", true);
    PrecacheSound("sound/survival/turret_lostplayer_03.wav", true);
    PrecacheSound("sound/survival/turret_sawplayer_01.wav", true);
    
    // Models
    PrecacheModel("models/props_survival/dronegun/dronegun.mdl", true);
    PrecacheModel("models/props_survival/dronegun/dronegun_gib1.mdl", true);
    PrecacheModel("models/props_survival/dronegun/dronegun_gib2.mdl", true);
    PrecacheModel("models/props_survival/dronegun/dronegun_gib3.mdl", true);
    PrecacheModel("models/props_survival/dronegun/dronegun_gib4.mdl", true);
    PrecacheModel("models/props_survival/dronegun/dronegun_gib5.mdl", true);
    PrecacheModel("models/props_survival/dronegun/dronegun_gib6.mdl", true);
    PrecacheModel("models/props_survival/dronegun/dronegun_gib7.mdl", true);
    PrecacheModel("models/props_survival/dronegun/dronegun_gib8.mdl", true);
}

/**
 * @brief Called before show an extraitem in the equipment menu.
 *
 * @param clientIndex       The client index.
 * @param extraitemIndex    The item index.
 *
 * @return                  Plugin_Handled to disactivate showing and Plugin_Stop to disabled showing. Anything else
 *                              (like Plugin_Continue) to allow showing and calling the ZP_OnClientBuyExtraItem() forward.
 **/
public Action ZP_OnClientValidateExtraItem(int clientIndex, int extraitemIndex)
{
    // Check the item index
    if(extraitemIndex == gItem)
    {
        // Validate access
        if(ZP_IsPlayerHasWeapon(clientIndex, gWeapon))
        {
            return Plugin_Handled;
        }
    }
    
    // Allow showing
    return Plugin_Continue;
}

/**
 * @brief Called after select an extraitem in the equipment menu.
 *
 * @param clientIndex       The client index.
 * @param extraitemIndex    The item index.
 **/
public void ZP_OnClientBuyExtraItem(int clientIndex, int extraitemIndex)
{
    // Check the item index
    if(extraitemIndex == gItem)
    {
        // Give item and select it
        ZP_GiveClientWeapon(clientIndex, gWeapon);
    }
}

//*********************************************************************
//*          Don't modify the code below this line unless             *
//*             you know _exactly_ what you are doing!!!              *
//*********************************************************************

void Weapon_OnDeploy(const int clientIndex, const int weaponIndex, const float flCurrentTime)
{
    #pragma unused clientIndex, weaponIndex, flCurrentTime
    
    /// Block the real attack
    SetEntPropFloat(weaponIndex, Prop_Send, "m_flNextPrimaryAttack", flCurrentTime + 9999.9);

    // Sets next attack time
    SetEntPropFloat(weaponIndex, Prop_Send, "m_fLastShotTime", flCurrentTime + ZP_GetWeaponDeploy(gWeapon));
}

void Weapon_OnPrimaryAttack(const int clientIndex, const int weaponIndex, float flCurrentTime)
{
    #pragma unused clientIndex, weaponIndex, flCurrentTime

    /// Block the real attack
    SetEntPropFloat(weaponIndex, Prop_Send, "m_flNextPrimaryAttack", flCurrentTime + 9999.9);
    
    // Validate animation delay
    if(GetEntPropFloat(weaponIndex, Prop_Send, "m_fLastShotTime") > flCurrentTime)
    {
        return;
    }

    // Validate water
    if(GetEntProp(clientIndex, Prop_Data, "m_nWaterLevel") == WLEVEL_CSGO_FULL)
    {
        return;
    }
    
    // Initialize vectors
    static float vPosition[3]; static float vEndPosition[3];
    
    // Gets weapon position
    ZP_GetPlayerGunPosition(clientIndex, 0.0, 0.0, 0.0, vPosition);
    ZP_GetPlayerGunPosition(clientIndex, 150.0, 0.0, 0.0, vEndPosition);

    // Create the end-point trace
    Handle hTrace = TR_TraceRayFilterEx(vPosition, vEndPosition, MASK_SHOT, RayType_EndPoint, TraceFilter);

    // Validate collisions
    if(TR_DidHit(hTrace) && TR_GetEntityIndex(hTrace) < 1)
    {
        // Returns the collision position/angle of a trace result
        TR_GetEndPosition(vPosition, hTrace);
        
        // Shift position
        vPosition[2] += 15.0;
        
        // Create a dronegun entity
        int entityIndex = CreateEntityByName("dronegun");

        // Validate entity
        if(entityIndex != INVALID_ENT_REFERENCE)
        {
            // Spawn the entity
            DispatchSpawn(entityIndex);

            // Teleport the turret
            TeleportEntity(entityIndex, vPosition, NULL_VECTOR, NULL_VECTOR);
            
            // Sets parent for the entity
            SetEntPropEnt(entityIndex, Prop_Send, "m_hOwnerEntity", clientIndex);

            // Sets health     
            SetEntProp(entityIndex, Prop_Data, "m_takedamage", DAMAGE_EVENTS_ONLY);
            SetEntProp(entityIndex, Prop_Data, "m_iHealth", WEAPON_DRONE_HEALTH);
            SetEntProp(entityIndex, Prop_Data, "m_iMaxHealth", WEAPON_DRONE_HEALTH);
            
             // Sets collision
            SetEntProp(entityIndex, Prop_Data, "m_CollisionGroup", COLLISION_GROUP_PUSHAWAY);
            
            // Create damage hook
            SDKHook(entityIndex, SDKHook_OnTakeDamage, DroneDamageHook);
        }
        
        // Adds the delay to the game tick
        flCurrentTime += ZP_GetWeaponSpeed(gWeapon);
                
        // Sets next attack time
        SetEntPropFloat(weaponIndex, Prop_Send, "m_flTimeWeaponIdle", flCurrentTime);
        SetEntPropFloat(weaponIndex, Prop_Send, "m_fLastShotTime", flCurrentTime);   
        
        // Forces a player to remove weapon
        RemovePlayerItem(clientIndex, weaponIndex);
        AcceptEntityInput(weaponIndex, "Kill");
        
        // Gets weapon index
        int weaponIndex2 = GetPlayerWeaponSlot(clientIndex, view_as<int>(SlotType_Melee)); // Switch to knife
        
        // Validate weapon
        if(IsValidEdict(weaponIndex2))
        {
            // Gets weapon classname
            static char sClassname[SMALL_LINE_LENGTH];
            GetEdictClassname(weaponIndex2, sClassname, sizeof(sClassname));
            
            // Switch the weapon
            FakeClientCommand(clientIndex, "use %s", sClassname);
        }
    }

    // Close the trace
    delete hTrace;
}

//**********************************************
//* Item (weapon) hooks.                       *
//**********************************************

#define _call.%0(%1,%2) \
                        \
    Weapon_On%0         \
    (                   \
        %1,             \
        %2,             \
        GetGameTime()   \
    )   

/**
 * @brief Called on deploy of a weapon.
 *
 * @param clientIndex       The client index.
 * @param weaponIndex       The weapon index.
 * @param weaponID          The weapon id.
 **/
public void ZP_OnWeaponDeploy(int clientIndex, int weaponIndex, int weaponID)
{
    // Validate custom weapon
    if(weaponID == gWeapon)
    {
        // Call event
        _call.Deploy(clientIndex, weaponIndex);
    }
}   
    
/**
 * @brief Called on each frame of a weapon holding.
 *
 * @param clientIndex       The client index.
 * @param iButtons          The buttons buffer.
 * @param iLastButtons      The last buttons buffer.
 * @param weaponIndex       The weapon index.
 * @param weaponID          The weapon id.
 *
 * @return                  Plugin_Continue to allow buttons. Anything else
 *                                (like Plugin_Changed) to change buttons.
 **/
public Action ZP_OnWeaponRunCmd(int clientIndex, int &iButtons, int iLastButtons, int weaponIndex, int weaponID)
{
    // Validate custom weapon
    if(weaponID == gWeapon)
    {
        // Button primary attack press
        if(iButtons & IN_ATTACK)
        {
            // Call event
            _call.PrimaryAttack(clientIndex, weaponIndex);
            iButtons &= (~IN_ATTACK);
            return Plugin_Changed;
        }
    }

    // Allow button
    return Plugin_Continue;
}

/**
 * @brief Called when a client take a fake damage.
 *
 * @param clientIndex       The client index.
 * @param attackerIndex     The attacker index.
 * @param inflictorIndex    The inflictor index.
 * @param damage            The amount of damage inflicted.
 * @param bits              The ditfield of damage types.
 * @param weaponIndex       The weapon index or -1 for unspecified.
 **/
public void ZP_OnClientDamaged(int clientIndex, int &attackerIndex, int &inflictorIndex, float &flDamage, int &iBits, int &weaponIndex)
{
    // Validate attacker
    if(IsValidEdict(inflictorIndex))
    {
        // Gets classname of the inflictor
        static char sClassname[SMALL_LINE_LENGTH];
        GetEdictClassname(inflictorIndex, sClassname, sizeof(sClassname));

        // If entity is a turret, then block damage
        if(!strcmp(sClassname, "env_gunfire", false))
        {
            // Multiply damage
            flDamage *= ZP_IsPlayerZombie(clientIndex) ? WEAPON_DRONE_MULTIPLIER : 0.0;
        }
    }
}

//**********************************************
//* Item (drone) hooks.                        *
//**********************************************

/**
 * @brief Drone damage hook.
 *
 * @param entityIndex       The entity index.   
 * @param attackerIndex     The attacker index.
 * @param inflictorIndex    The inflictor index.
 * @param flDamage          The damage amount.
 * @param iBits             The damage type.
 **/
public Action DroneDamageHook(const int entityIndex, int &attackerIndex, int &inflictorIndex, float &flDamage, int &iBits)
{
    // Validate entity
    if(IsValidEdict(entityIndex))
    {
        // Validate zombie
        if(IsPlayerExist(attackerIndex) && ZP_IsPlayerZombie(attackerIndex))
        {
            // Calculate the damage
            int iHealth = GetEntProp(entityIndex, Prop_Data, "m_iHealth") - RoundToNearest(flDamage); iHealth = (iHealth > 0) ? iHealth : 0;

            // Destroy entity
            if(!iHealth)
            {
                // Destroy damage hook
                SDKUnhook(entityIndex, SDKHook_OnTakeDamage, DroneDamageHook);
            }
            else
            {
                // Apply damage
                SetEntProp(entityIndex, Prop_Data, "m_iHealth", iHealth);
            }
        }
    }

    // Return on success
    return Plugin_Handled;
}

/**
 * @brief Trace filter.
 *
 * @param entityIndex       The entity index. 
 * @param contentsMask      The contents mask.
 * @return                  True or false.
 **/
public bool TraceFilter(const int entityIndex, const int contentsMask)
{
    return !(1 <= entityIndex <= MaxClients);
}
 

Truyn

King of clowns
Сообщения
1,591
Реакции
749
@Oligarx1488, вроде ты просил

в Discord.cfg добавить:
"ServerInfo" "WebHook канала"
Выложил бы в ресурсы думаю не только мне пригодилось бы
--- Добавлено позже ---
@Grey83 [CS:GO] Lasermines 1.5.1 - AlliedModders
А можно как то другую валюту добавить/кредиты/рубли???
 
Последнее редактирование:

Dobro777

Участник
Сообщения
45
Реакции
5
@Dobro777, вот версия, которая будет добавлять разницу м/у sm_startmoney_def и sm_startmoney_first во втором раунде.
В КС же в начале раунда не даёт деньги игроку сверх заработанного, если у него их меньше значения квара mp_startmoney
Спасибо большое, все отлично работает, в 1м раунде 1000$, в последующих 10000$, скиньте в лс номер эл.кошелька отправлю вам в благодарность магарычок.
 

Grey83

не пишу плагины с весны 2022
Сообщения
8,521
Реакции
4,980
@Oligarx1488, можно, конечно.
Вот только нужно добавлять поддержку шопов/випов/рпг
 

smxnet

Участник
Сообщения
80
Реакции
4
Привет Ребят если можете то помогите с написанием небольшого плагина как то я заходил на сервер ukcs и там при выборе команды нельзя было выбрать не теров не контров а только автоназначение вот хотелось бы такой же или может кто подскажет где такой скачать заранее благодарю (сервер css steam)
 

Paranoiiik

хачю клиентмод
Сообщения
2,047
Реакции
1,490
Привет Ребят если можете то помогите с написанием небольшого плагина как то я заходил на сервер ukcs и там при выборе команды нельзя было выбрать не теров не контров а только автоназначение вот хотелось бы такой же или может кто подскажет где такой скачать заранее благодарю (сервер css steam)
И я б не отказался от такого
 

Truyn

King of clowns
Сообщения
1,591
Реакции
749
@Oligarx1488, можно, конечно.
Вот только нужно добавлять поддержку шопов/випов/рпг
Что нужно сделать чтобы ты ее добавил?)?)))
--- Добавлено позже ---
И я б не отказался от такого
У меня было реализовано,я поищу,но связкой из 2 плагинов
Один из них вот

C-подобный:
#include <sourcemod>

#include <influx/core>
//#include <influx/teams>


ConVar g_ConVar_Delay;


public Plugin myinfo =
{
    author = INF_AUTHOR,
    url = INF_URL,
    name = INF_NAME..." - Autojoin Team",
    description = "Puts you in a team when connected.",
    version = INF_VERSION
};

public void OnPluginStart()
{
    g_ConVar_Delay = CreateConVar( "influx_teams_autojoin_delay", "1", "How long we wait before autojoining a team.", FCVAR_NOTIFY, true, 0.1, true, 1337.0 );
   
    AutoExecConfig( true, "teams_autojoin", "influx" );
}

public void OnClientPutInServer( int client )
{
    CreateTimer( g_ConVar_Delay.FloatValue, T_Spawn, GetClientUserId( client ), TIMER_FLAG_NO_MAPCHANGE );
}

public Action T_Spawn( Handle hTimer, int client )
{
    if ( (client = GetClientOfUserId( client )) > 0 && IsClientInGame( client ) )
    {
        if ( !IsPlayerAlive( client ) && !IsClientSourceTV( client ) )
        {
            SpawnPlayer( client );
        }
    }
}

stock void SpawnPlayer( int client )
{
    if ( IsPlayerAlive( client ) ) return;
   
   
    int spawns_ct, spawns_t;
    int team = Inf_GetPreferredTeam( spawns_ct, spawns_t );
   
    if ( !spawns_ct && !spawns_t )
    {
        LogError( INF_CON_PRE..."No spawnpoints, can't spawn player!" );
        return;
    }
   
   
    if ( GetClientTeam( client ) != team )
    {
        ChangeClientTeam( client, team );
    }
   
    if ( !IsPlayerAlive( client ) )
    {
        CS_RespawnPlayer( client );
    }
}
Убрать зависимость от influx,и тут можно попросить чтобы сделали запрет выбора команды.
 

WanekWest

Помешан на "Даунских названиях"
Сообщения
442
Реакции
143
Привет Ребят если можете то помогите с написанием небольшого плагина как то я заходил на сервер ukcs и там при выборе команды нельзя было выбрать не теров не контров а только автоназначение вот хотелось бы такой же или может кто подскажет где такой скачать заранее благодарю (сервер css steam)
Держи: [CS:GO] Auto join team on connect - AlliedModders
 

Grey83

не пишу плагины с весны 2022
Сообщения
8,521
Реакции
4,980
@Oligarx1488, даже не знаю: нет никакого желания заморачиваться с этим.
 

rokfestr

Участник
Сообщения
340
Реакции
63
Возможно ли сделать сохранение игроков? Чтобы когда замутил у себя игрока, то после выхода с сервера его запоминало, а то сейчас если замученый игрок выйдет с сервера и зайдет то его нужно мутить заново. Пытался cookie добавить, но что-то не получилось :(
 

Вложения

  • SelfMute.sp
    16.6 КБ · Просмотры: 13

Черная вдова

Участник
Сообщения
2,795
Реакции
670
Возможно ли сделать сохранение игроков? Чтобы когда замутил у себя игрока, то после выхода с сервера его запоминало, а то сейчас если замученый игрок выйдет с сервера и зайдет то его нужно мутить заново. Пытался cookie добавить, но что-то не получилось :(
Но лучше использовать sourcebans++ или material admin
 

rokfestr

Участник
Сообщения
340
Реакции
63
Вот плагин с сохранениями мутов ExtendedComm
Но лучше использовать sourcebans++ или material admin
Self Mute - это отключение микрофона игроков лично для себя, так же как и через TAB - Заглушить Микрофон
 

smxnet

Участник
Сообщения
80
Реакции
4
@smxnet, @Paranoiiik, @Oligarx1488

А кваром не вариант что ли ?
C-подобный:
CS:S - mp_forceautoteam 1
CS:GO - mp_force_assign_teams 1
не работает
--- Добавлено позже ---
проверил что то не работает (нужно просто вот такой плагин что бы нельзя была нажать команду теров команду контров а только нажать можно было бы пункт автоназначение и пункт наблюдателей и все)
 

Truyn

King of clowns
Сообщения
1,591
Реакции
749
не работает
--- Добавлено позже ---

проверил что то не работает (нужно просто вот такой плагин что бы нельзя была нажать команду теров команду контров а только нажать можно было бы пункт автоназначение и пункт наблюдателей и все)
[CS:GO] Block Team for MG course maps - AlliedModders
Или мб этот [CS:S/CS:GO] blockteam - AlliedModders
Либо настрой, либо попроси чтобы изменили под твои нужды



Первый плагин использовал,работает как тебе нужно блокирует, чтобы на определенной карте былп только одна команда, только т и сменить нельзя к примеру, а если тебе надо чтобы было 2 команды но нельзя было менять. Закажи платно чтобы написали или может кто бесплатно на основе тех что я скинул поможет..
 
Последнее редактирование:
Сверху Снизу