Изменение плагина

babka68

Участник
Сообщения
2,124
Реакции
957
@Felton,
C++:
#include <sourcemod>

public Plugin myinfo =
{
    name            = "Blue Screen of Kill",
    author            = "johnspade",
    description        = "The plugin fades the screen to transparent blue for a second when you kill someone",
    version            = "1.0",
    url                = "johnspade.ru"
}

public void OnPluginStart()
{
    HookEvent("player_death", Event_PlayerDeath);
}

PerformFade(client, duration, const color[4])
{
    Handle hFadeClient = StartMessageOne("Fade",  client)
  
    BfWriteShort(hFadeClient, duration)
    BfWriteShort(hFadeClient, 0)
    BfWriteShort(hFadeClient, (0x0001))
    BfWriteByte(hFadeClient, color[0])
    BfWriteByte(hFadeClient, color[1])
    BfWriteByte(hFadeClient, color[2])
    BfWriteByte(hFadeClient, color[3])
    EndMessage()
}

public void Event_PlayerDeath(Handle event, const char[] name, bool dontBroadcast)
{
    int client = GetClientOfUserId(GetEventInt(event, "userid"));
    int attacker_id = GetEventInt(event, "attacker");
    int attacker = GetClientOfUserId(attacker_id);
  
    PerformFade(attacker, 300, (GetClientTeam(client) == 2) ? {255, 0, 0, 51} : {0, 0, 200, 51});
}
@RusJJ, ты, кстати, команду убийцы получаешь, а ему жертва нужна
Сообщения автоматически склеены:


Просто хватит сидеть на SM <=1.6.3
Так будут цвета работать наоборот,когда будешь убивать КТ находясь за команду Т,то будет синий цвет,а когда будешь играть за СТ,а убивать Т,то будет красный

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

public Plugin myinfo =
{
    name = "Blue Screen of Kill",
    author = "johnspade",
    description = "Эффект экрана при убийстве",
    version = "1.0",
    url = "johnspade.ru"
}

public void OnPluginStart()
{
    HookEvent("player_death", Event_PlayerDeath);
}

PerformFade(client, duration, const color[4])
{
    Handle hFadeClient = StartMessageOne("Fade", client)
   
    BfWriteShort(hFadeClient, duration)
    BfWriteShort(hFadeClient, 0)
    BfWriteShort(hFadeClient, (0x0001))
    BfWriteByte(hFadeClient, color[0])
    BfWriteByte(hFadeClient, color[1])
    BfWriteByte(hFadeClient, color[2])
    BfWriteByte(hFadeClient, color[3])
    EndMessage()
}

public void Event_PlayerDeath(Handle event, const char[] name, bool dontBroadcast)
{
    int client = GetClientOfUserId(GetEventInt(event, "userid"));
    int attacker_id = GetEventInt(event, "attacker");
    int attacker = GetClientOfUserId(attacker_id);
   
    PerformFade(attacker, 300, (GetClientTeam(client) == 3) ?  { 255, 0, 0, 51 }  :  { 0, 0, 200, 51 } );
}

Вот так будет играя за Т красный эффект,а за кт Синий
 

Paranoiiik

хачю клиентмод
Сообщения
2,047
Реакции
1,491
Так будут цвета работать наоборот,когда будешь убивать КТ находясь за команду Т,то будет синий цвет,а когда будешь играть за СТ,а убивать Т,то будет красный

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

public Plugin myinfo =
{
    name = "Blue Screen of Kill",
    author = "johnspade",
    description = "Эффект экрана при убийстве",
    version = "1.0",
    url = "johnspade.ru"
}

public void OnPluginStart()
{
    HookEvent("player_death", Event_PlayerDeath);
}

PerformFade(client, duration, const color[4])
{
    Handle hFadeClient = StartMessageOne("Fade", client)
  
    BfWriteShort(hFadeClient, duration)
    BfWriteShort(hFadeClient, 0)
    BfWriteShort(hFadeClient, (0x0001))
    BfWriteByte(hFadeClient, color[0])
    BfWriteByte(hFadeClient, color[1])
    BfWriteByte(hFadeClient, color[2])
    BfWriteByte(hFadeClient, color[3])
    EndMessage()
}

public void Event_PlayerDeath(Handle event, const char[] name, bool dontBroadcast)
{
    int client = GetClientOfUserId(GetEventInt(event, "userid"));
    int attacker_id = GetEventInt(event, "attacker");
    int attacker = GetClientOfUserId(attacker_id);
  
    PerformFade(attacker, 300, (GetClientTeam(client) == 3) ?  { 255, 0, 0, 51 }  :  { 0, 0, 200, 51 } );
}

Вот так будет играя за Т красный эффект,а за кт Синий
Как бы 3 - это CT
 

Paranoiiik

хачю клиентмод
Сообщения
2,047
Реакции
1,491
Сейчас скомпилировал твой код с 2,цвета наоборот работают,выставил 3 цвета работаю верно)
Для уверенности вот тебе
C-подобный:
#include <cstrike>

public Plugin myinfo =
{
    name            = "Blue Screen of Kill",
    author            = "johnspade",
    description        = "The plugin fades the screen to transparent blue for a second when you kill someone",
    version            = "1.0",
    url                = "johnspade.ru"
}

public void OnPluginStart()
{
    HookEvent("player_death", Event_PlayerDeath);
}

PerformFade(client, duration, const color[4])
{
    Handle hFadeClient = StartMessageOne("Fade",  client)
    
    BfWriteShort(hFadeClient, duration)
    BfWriteShort(hFadeClient, 0)
    BfWriteShort(hFadeClient, (0x0001))
    BfWriteByte(hFadeClient, color[0])
    BfWriteByte(hFadeClient, color[1])
    BfWriteByte(hFadeClient, color[2])
    BfWriteByte(hFadeClient, color[3])
    EndMessage()
}

public void Event_PlayerDeath(Handle event, const char[] name, bool dontBroadcast)
{
    int client = GetClientOfUserId(GetEventInt(event, "userid"));
    int attacker_id = GetEventInt(event, "attacker");
    int attacker = GetClientOfUserId(attacker_id);
    
    if(client != attacker) PerformFade(attacker, 300, (GetClientTeam(client) == CS_TEAM_T) ? {255, 0, 0, 51} : {0, 0, 200, 51});
}
Сообщения автоматически склеены:

Блин, вообще как-то странно себя ведёт засветка. Задолбался проверять, просто забью
 
Последнее редактирование:

Grey83

не пишу плагины с весны 2022
Сообщения
8,569
Реакции
5,071
@Felton, вот для 1.6.3.
При убийстве террориста будет красный эффект и синий, если убил спеца.
Заодно добавил все необходимые проверки.
Работать будет только на CSS.
C-подобный:
#pragma semicolon 1

public OnPluginStart()
{
    HookEvent("player_death", Event_PlayerDeath);
}

public Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new client = GetClientOfUserId(GetEventInt(event, "attacker"));
    if(!client || IsFakeClient(client))
        return;

    new buffer = GetClientOfUserId(GetEventInt(event, "userid"));
    if(!buffer || buffer == client || (buffer = GetClientTeam(buffer)) < 2)
        return;

    new Handle:fade = StartMessageOne("Fade", client);
    BfWriteShort(fade, 300);
    BfWriteShort(fade, 0);
    BfWriteShort(fade, 17);
    BfWriteByte(fade, buffer == 2 ? 255 : 0);
    BfWriteByte(fade, 63);
    BfWriteByte(fade, buffer == 3 ? 255 : 0);
    BfWriteByte(fade, 51);
    EndMessage();
}
 

Felton

Участник
Сообщения
799
Реакции
59

Grey83

Не думал что кто то ответит!Скомпелил,установил все работает как швецарские часы.То что я хотел.Спасибо добрый человек.
 
Сверху Снизу