Как исправить KillMessages под себя

Тема в разделе "Общие вопросы", создана пользователем hotlife157, 5 мар 2016.

  1. hotlife157

    hotlife157

    Сообщения:
    126
    Симпатии:
    4
    Как сделать чтоб убийство с ножа было такое как с оружия?kill 1,kill2,kill3 и тд
    sm_killmessage_overlays_basicsupport.sp
    #include <sourcemod>
    #include <sdktools>

    #define PLUGIN_VERSION "2.3"

    new Handle:_hGrenadeOverlay;
    new Handle:_hHeadShotOverlay;
    new Handle:_hKnifeOverlay;
    new Handle:_hCTWinsOverlay;
    new Handle:_hTWinsOverlay;
    new Handle:_hKillOverlayNaming;
    new Handle:_hMaxKillStreak;
    new String:_sGrenadeOverlay[32];
    new String:_sHeadShotOverlay[32];
    new String:_sKnifeOverlay[32];
    new String:_sCTWinsOverlay[32];
    new String:_sTWinsOverlay[32];
    new String:_sKillOverlayNaming[32];
    new _iMaxKillStreak;
    new _aiKillStreak[MAXPLAYERS+1];
    new _abClientDead[MAXPLAYERS+1];

    public Plugin:myinfo =
    {
    name = "Kill Message Overlays Basic Triggers",
    author = "Siang Chun & Black Haze & Xeon",
    description = "Basic Triggers for Kill Message Overlays",
    version = PLUGIN_VERSION,
    url = "bslw.co.uk & beernweed.com"
    }

    public OnPluginStart()
    {
    HookEvent("player_death", Event_PlayerDeath);
    HookEvent("player_spawn", Event_PlayerSpawn);
    HookEvent("round_end", Event_RoundEnd);

    _hGrenadeOverlay = CreateConVar("sm_killmessage_bs_grenade", "ray_grenade", "Материал (убийство с гранаты)");
    _hHeadShotOverlay = CreateConVar("sm_killmessage_bs_headshot", "ray_headshot", "Материал (убийство в голову)");
    _hKnifeOverlay = CreateConVar("sm_killmessage_bs_knife", "ray_knife", "Материал (убийство с ножа)");
    _hCTWinsOverlay = CreateConVar("sm_killmessage_bs_ctwins", "ray_ct_wins", "Материал (Спецназ одержал победу)");
    _hTWinsOverlay = CreateConVar("sm_killmessage_bs_twins", "ray_t_wins", "Материал (Террористы одержали победу)");
    _hKillOverlayNaming = CreateConVar("sm_killmessage_bs_killnaming", "ray_", "Материал (Названия простого убийство под номером 1-10)");
    _hMaxKillStreak = CreateConVar("sm_killmessage_bs_maxkillstreak", "10", "Сколько тут? (Сколько материалов будет подключаться для обычного убийства)");

    AutoExecConfig(true, "raynax_kill_messages");
    }

    public OnMapStart()
    {
    GetConVarString(_hGrenadeOverlay, _sGrenadeOverlay, sizeof(_sGrenadeOverlay));
    GetConVarString(_hHeadShotOverlay, _sHeadShotOverlay, sizeof(_sHeadShotOverlay));
    GetConVarString(_hKnifeOverlay, _sKnifeOverlay, sizeof(_sKnifeOverlay));
    GetConVarString(_hCTWinsOverlay, _sCTWinsOverlay, sizeof(_sCTWinsOverlay));
    GetConVarString(_hTWinsOverlay, _sTWinsOverlay, sizeof(_sTWinsOverlay));
    GetConVarString(_hKillOverlayNaming, _sKillOverlayNaming, sizeof(_sKillOverlayNaming));
    _iMaxKillStreak = GetConVarInt(_hMaxKillStreak);

    ServerCommand("sm_killmessage_prepare %s",_sGrenadeOverlay);
    ServerCommand("sm_killmessage_prepare %s",_sHeadShotOverlay);
    ServerCommand("sm_killmessage_prepare %s",_sKnifeOverlay);
    ServerCommand("sm_killmessage_prepare %s",_sCTWinsOverlay);
    ServerCommand("sm_killmessage_prepare %s",_sTWinsOverlay);

    new iCounter;
    for (iCounter = 1; iCounter <= _iMaxKillStreak; iCounter++)
    {
    new String:sCounterTemp[64];
    IntToString(iCounter, sCounterTemp,sizeof(sCounterTemp));
    ServerCommand("sm_killmessage_prepare %s%s",_sKillOverlayNaming,sCounterTemp);
    }
    }

    public OnClientPutInServer(client)
    {
    if(client>0)
    {
    _aiKillStreak[client]=0;
    _abClientDead[client]=false;
    }
    }

    public Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
    {
    new client;
    client = GetClientOfUserId(GetEventInt(event, "userid"));
    if(client>0)
    {
    if(_abClientDead[client])
    {
    _aiKillStreak[client]=0;
    _abClientDead[client]=false;
    }
    }
    }

    public Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
    {
    new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
    new String:sAttackerID[32];
    GetEventString(event, "attacker",sAttackerID, sizeof(sAttackerID));

    new victim = GetClientOfUserId(GetEventInt(event, "userid"))

    _abClientDead[victim]=true;

    if(attacker>0)
    {
    if(!IsFakeClient(attacker))
    {
    if(victim != attacker)
    {
    _aiKillStreak[attacker]++;
    if(_aiKillStreak[attacker]>_iMaxKillStreak)
    {
    _aiKillStreak[attacker]=1;
    }
    new bool:headshot = GetEventBool(event, "headshot");
    new String:weapon[32];
    GetEventString(event, "weapon",weapon, sizeof(weapon));

    if(StrEqual(weapon, "hegrenade"))
    {
    ServerCommand("sm_killmessage_show %s %s",sAttackerID,_sGrenadeOverlay);
    }
    else if(StrEqual(weapon,"knife"))
    {
    ServerCommand("sm_killmessage_show %s %s",sAttackerID,_sKnifeOverlay);
    }
    else if(headshot)
    {
    ServerCommand("sm_killmessage_show %s %s",sAttackerID,_sHeadShotOverlay);
    }
    else
    {
    new String:sKillStreakTemp[64];
    IntToString(_aiKillStreak[attacker], sKillStreakTemp,sizeof(sKillStreakTemp));
    ServerCommand("sm_killmessage_show %s %s%s",sAttackerID,_sKillOverlayNaming,sKillStreakTemp);
    }
    }
    }
    }
    }

    public Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
    {
    new iWinningTeam = GetEventInt(event, "winner");

    if (iWinningTeam == 2)
    {
    for (new iClientCounter = 1; iClientCounter <= MaxClients; iClientCounter++)
    {
    if(IsClientInGame(iClientCounter))
    {
    ServerCommand("sm_killmessage_show %i %s",GetClientUserId(iClientCounter),_sTWinsOverlay);
    }
    }
    }
    else if (iWinningTeam == 3)
    {
    for (new iClientCounter = 1; iClientCounter <= MaxClients; iClientCounter++)
    {
    if(IsClientInGame(iClientCounter))
    {
    ServerCommand("sm_killmessage_show %i %s",GetClientUserId(iClientCounter),_sCTWinsOverlay);
    }
    }
    }
    }
    sm_killmessage_framework.sp
    #include <sourcemod>
    #include <sdktools>

    #define PLUGIN_VERSION "2.3"

    new Handle:_atCleanTimer[MAXPLAYERS+1] = INVALID_HANDLE
    new Handle:_hTimerLength;
    new Float:_dTimerLength;

    public Plugin:myinfo =
    {
    name = "Kill Message Overlays Framework",
    author = "Siang Chun & Black Haze & Xeon",
    description = "Framework for Kill Message Overlays",
    version = PLUGIN_VERSION,
    url = "bslw.co.uk & beernweed.com & csgo-astra.ru"
    }

    public OnPluginStart()
    {
    _hTimerLength = CreateConVar("sm_killmessage_overlays_length", "3.0", "Length of time an overlay is showed", FCVAR_PLUGIN|FCVAR_REPLICATED, true, 1.0);
    _dTimerLength = GetConVarFloat(_hTimerLength);

    RegServerCmd("sm_killmessage_show", ShowKillMessage);
    RegServerCmd("sm_killmessage_prepare", PrepareOverlay);
    }

    public Action:ShowKillMessage(args)
    {
    if (args < 2)
    {
    return Plugin_Handled;
    }

    decl String: client_id[192];
    GetCmdArg(1, client_id, sizeof(client_id));
    new client = GetClientOfUserId(StringToInt(client_id));

    if(client>0)
    {
    decl String: sOverLay[192];
    GetCmdArg(2, sOverLay, sizeof(sOverLay));

    if(_atCleanTimer[client] !=INVALID_HANDLE)
    {
    KillTimer(_atCleanTimer[client]);
    _atCleanTimer[client] =INVALID_HANDLE;
    }

    _atCleanTimer[client] = CreateTimer(_dTimerLength,CleanTimer,client);

    ClearScreen(client);
    ClientCommand(client, "r_screenoverlay \"ray_killmessages/%s.vtf\"",sOverLay);
    }
    return Plugin_Handled;
    }

    public ClearScreen(client)
    {
    if(client>0)
    {
    ClientCommand(client, "r_screenoverlay \"\"");
    }
    }

    public Action:CleanTimer(Handle:Timer, any:client)
    {
    _atCleanTimer[client] = INVALID_HANDLE;
    ClearScreen(client);
    }

    public Action:PrepareOverlay(args)
    {
    if (args < 1)
    {
    return Plugin_Handled;
    }

    decl String: sOverLay[192];
    GetCmdArg(1, sOverLay, sizeof(sOverLay));

    new String:overlays_file[64];
    new String:overlays_dltable[64];

    Format(overlays_file,sizeof(overlays_file),"ray_killmessages/%s.vtf",sOverLay);
    PrecacheDecal(overlays_file,true);
    Format(overlays_dltable,sizeof(overlays_dltable),"materials/ray_killmessages/%s.vtf",sOverLay);
    AddFileToDownloadsTable(overlays_dltable);
    Format(overlays_file,sizeof(overlays_file),"ray_killmessages/%s.vmt",sOverLay);
    PrecacheDecal(overlays_file,true);
    Format(overlays_dltable,sizeof(overlays_dltable),"materials/ray_killmessages/%s.vmt",sOverLay);
    AddFileToDownloadsTable(overlays_dltable);

    return Plugin_Handled;
    }
    Сами исходники

    --- Добавлено позже ---
    Помогите плиз кто разбирается
     

    Вложения:

    Последнее редактирование: 6 мар 2016