Raised This Month: $51 Target: $400
 12% 

grey screen when death


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
slava123
Junior Member
Join Date: Apr 2022
Location: zm_crazycity
Old 07-15-2022 , 09:39   grey screen when death
Reply With Quote #1

how can i edit this script to show the grey screen to the victim on death https://forums.alliedmods.net/showthread.php?t=282773
slava123 is offline
Cruze
Veteran Member
Join Date: May 2017
Old 07-15-2022 , 10:34   Re: grey screen when death
Reply With Quote #2

PHP Code:
#include <sourcemod>

public Plugin myinfo 
{
    
name "Blue Screen On Kill",
    
author "Addicted [smol edit by Cruze]",
    
version "1.2",
    
url "oaaron.com"
};

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

public 
Action Event_PlayerDeath(Event ev, const char[] namebool dbc)
{
    
int victim GetClientOfUserId(ev.GetInt("userid"));

    if(
victim || victim MaxClients || IsFakeClient(victim))
        return 
Plugin_Continue;

    
ShowScreenFade(victim211211211100); // Your preffered grey color code here

    
return Plugin_Continue;    
}

void ShowScreenFade(int clientint rint gbint a)
{
    
int duration 200holdtime 200flags = (0x0001 0x0010), color[4];

    
color[0] = r;
    
color[1] = g;
    
color[2] = b;
    
color[3] = a;

    
int clients[2];
    
clients[0] = client;

    
Handle message StartMessageEx(GetUserMessageId("Fade"), clients1);

    if (
GetUserMessageType() == UM_Protobuf)
    {
        
Protobuf pb UserMessageToProtobuf(message);
        
pb.SetInt("duration"duration);
        
pb.SetInt("hold_time"holdtime);
        
pb.SetInt("flags"flags);
        
pb.SetColor("clr"color);
    }
    else
    {
        
BfWriteShort(messageduration);
        
BfWriteShort(messageholdtime);
        
BfWriteShort(messageflags);
        
BfWriteByte(messagecolor[0]);
        
BfWriteByte(messagecolor[1]);
        
BfWriteByte(messagecolor[2]);
        
BfWriteByte(messagecolor[3]);
    }

    
EndMessage();

__________________
Taking paid private requests! Contact me

Last edited by Cruze; 07-15-2022 at 14:28. Reason: my bad. was sleepy
Cruze is offline
slava123
Junior Member
Join Date: Apr 2022
Location: zm_crazycity
Old 07-15-2022 , 12:00   Re: grey screen when death
Reply With Quote #3

Quote:
Originally Posted by Cruze View Post
PHP Code:
#include <sourcemod>

public Plugin myinfo 
{
    
name "Blue Screen On Kill",
    
author "Addicted [smol edit by Cruze]",
    
version "1.1",
    
url "oaaron.com"
};

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

public 
Action Event_PlayerDeath(Handle event, const char[] namebool dontbroadcast)
{
    
int victim GetClientOfUserId(GetEventInt(event"victim"));
    
    if (
victim || victim MaxClients || IsFakeClient(attacker))
        return 
Plugin_Continue;
    
    
int clients[2];
    
clients[0] = victim;

    
Handle message StartMessageEx(GetUserMessageId("Fade"), clients1);
    
    
Protobuf pb UserMessageToProtobuf(message);
    
pb.SetInt("duration"200);
    
pb.SetInt("hold_time"200);
    
pb.SetInt("flags", (0x0001 0x0010));
    
pb.SetColor("clr", {211211211100}); // Your preffered grey color code here
    
    
EndMessage();
        
    return 
Plugin_Continue;    

i think you should change if (victim < 1 || victim > MaxClients || IsFakeClient(attacker))
to
if (victim < 1 || victim > MaxClients || IsFakeClient(victim))
slava123 is offline
slava123
Junior Member
Join Date: Apr 2022
Location: zm_crazycity
Old 07-15-2022 , 12:08   Re: grey screen when death
Reply With Quote #4

after testing it doesnt work on css server
slava123 is offline
slava123
Junior Member
Join Date: Apr 2022
Location: zm_crazycity
Old 07-15-2022 , 12:29   Re: grey screen when death
Reply With Quote #5

PHP Code:
#include <sourcemod>

public Plugin myinfo =
{
    
name "Grey Screen On death",
    
author "Addicted",
    
version "1.0",
    
url "oaaron.com"
};

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

public 
Action Event_PlayerDeath(Handle event, const char[] namebool dontbroadcast)

    
int victim GetClientOfUserId(GetEventInt(event"userid")); 

    if (
victim || victim MaxClients || !IsClientConnected(victim) || !IsClientInGame(victim) || IsFakeClient(victim)) 
        return 
Plugin_Continue;

    
int clients[2];
    
clients[0] = victim;
    
int duration 200,
        
holdtime 200,
        
flags = (0x0001 0x0010),
        
color[4] = {211211211100};
    
    
Handle message StartMessageEx(GetUserMessageId("Fade"), clients1);
    if (
GetUserMessageType() == UM_Protobuf)
    {
        
Protobuf pb UserMessageToProtobuf(message);
        
pb.SetInt("duration"duration);
        
pb.SetInt("hold_time"holdtime);
        
pb.SetInt("flags"flags);
        
pb.SetColor("clr"color);
    }
    else 
//write them bytez
    
{
        
BfWriteShort(messageduration);
        
BfWriteShort(messageholdtime);
        
BfWriteShort(messageflags);
        
BfWriteByte(messagecolor[0]);
        
BfWriteByte(messagecolor[1]);
        
BfWriteByte(messagecolor[2]);
        
BfWriteByte(messagecolor[3]);
    }
    
EndMessage();

    return 
Plugin_Continue;

after some research i found that there is no event called victim you should replace it with userid which is user who died https://wiki.alliedmods.net/Counter-...s#player_death

Last edited by slava123; 07-15-2022 at 12:32.
slava123 is offline
Cruze
Veteran Member
Join Date: May 2017
Old 07-15-2022 , 14:29   Re: grey screen when death
Reply With Quote #6

Quote:
Originally Posted by slava123 View Post
PHP Code:
#include <sourcemod>

public Plugin myinfo =
{
    
name "Grey Screen On death",
    
author "Addicted",
    
version "1.0",
    
url "oaaron.com"
};

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

public 
Action Event_PlayerDeath(Handle event, const char[] namebool dontbroadcast)

    
int victim GetClientOfUserId(GetEventInt(event"userid")); 

    if (
victim || victim MaxClients || !IsClientConnected(victim) || !IsClientInGame(victim) || IsFakeClient(victim)) 
        return 
Plugin_Continue;

    
int clients[2];
    
clients[0] = victim;
    
int duration 200,
        
holdtime 200,
        
flags = (0x0001 0x0010),
        
color[4] = {211211211100};
    
    
Handle message StartMessageEx(GetUserMessageId("Fade"), clients1);
    if (
GetUserMessageType() == UM_Protobuf)
    {
        
Protobuf pb UserMessageToProtobuf(message);
        
pb.SetInt("duration"duration);
        
pb.SetInt("hold_time"holdtime);
        
pb.SetInt("flags"flags);
        
pb.SetColor("clr"color);
    }
    else 
//write them bytez
    
{
        
BfWriteShort(messageduration);
        
BfWriteShort(messageholdtime);
        
BfWriteShort(messageflags);
        
BfWriteByte(messagecolor[0]);
        
BfWriteByte(messagecolor[1]);
        
BfWriteByte(messagecolor[2]);
        
BfWriteByte(messagecolor[3]);
    }
    
EndMessage();

    return 
Plugin_Continue;

after some research i found that there is no event called victim you should replace it with userid which is user who died https://wiki.alliedmods.net/Counter-...s#player_death
Yeah my bad I am too sleepy I guess. Updated the main post.
__________________
Taking paid private requests! Contact me
Cruze is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:05.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode