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

Solved [L4D2] Beginning of Game Message


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
leaffan
Senior Member
Join Date: Jan 2013
Old 05-24-2023 , 16:46   [L4D2] Beginning of Game Message
Reply With Quote #1

Hello friends,

The attachment I have provided sends a message at the beginning of each game round, but sometimes it doesn't work consistently. How can I ensure that it works every time? Is there an issue with the attachment?

Additionally, can I request a development to be added to the attachment?

What would the development involve?

Before the game starts, I want it to send a "message" - there is already a message after the round starts, but I also want a message before the game starts.

Thank you.
Attached Files
File Type: sp Get Plugin or Get Source (game-start-message.sp - 47 views - 647 Bytes)

Last edited by leaffan; 05-26-2023 at 09:49.
leaffan is offline
HarryPotter
Veteran Member
Join Date: Sep 2017
Location: Taiwan, Asia
Old 05-25-2023 , 06:13   Re: [L4D2] Beginning of Game Message
Reply With Quote #2

Use left4dhooks function

PHP Code:
#include <sourcemod>
#include <left4dhooks>

#pragma semicolon 1
#pragma newdecls required

public Plugin myinfo = {
    
name        "[L4D2] Game Start Message",
    
author      "Drixevel",
    
description "Prints a message in chat when the game starts.",
    
version     "1.0.0",
    
url         "https://drixevel.dev/"
};

public 
void OnPluginStart()
{
    
}

public 
void L4D_OnFirstSurvivorLeftSafeArea_Post(int client)
{
    
PrintToChatAll("\x04[Oyun Mod-Kontrolü] \x01Oyun başladı. Oyun Mod'u hazır! Bol şanslar! İyi oyunlar...");

__________________

Last edited by HarryPotter; 05-25-2023 at 06:13.
HarryPotter is offline
leaffan
Senior Member
Join Date: Jan 2013
Old 05-25-2023 , 12:00   Re: [L4D2] Beginning of Game Message
Reply With Quote #3

Quote:
Originally Posted by HarryPotter View Post
Use left4dhooks function

PHP Code:
#include <sourcemod>
#include <left4dhooks>

#pragma semicolon 1
#pragma newdecls required

public Plugin myinfo = {
    
name        "[L4D2] Game Start Message",
    
author      "Drixevel",
    
description "Prints a message in chat when the game starts.",
    
version     "1.0.0",
    
url         "https://drixevel.dev/"
};

public 
void OnPluginStart()
{
    
}

public 
void L4D_OnFirstSurvivorLeftSafeArea_Post(int client)
{
    
PrintToChatAll("\x04[Oyun Mod-Kontrolü] \x01Oyun başladı. Oyun Mod'u hazır! Bol şanslar! İyi oyunlar...");

Perfect, thank you very much.

May I also make a small request regarding the situation?

Would it be possible to have another message appear when the player has not yet started the game and is in the 'Safe Zone'? Currently, there is a message for 'Out of Safe Zone', but could you also include a message for 'In Safe Zone' if it's not too much trouble?

Thank you.
leaffan is offline
alasfourom
Senior Member
Join Date: Feb 2022
Location: Saudi Arabia
Old 05-25-2023 , 20:20   Re: [L4D2] Beginning of Game Message
Reply With Quote #4

PHP Code:
#include <sourcemod>
#include <left4dhooks>

#pragma semicolon 1
#pragma newdecls required

bool g_bLeftSafeArea;
Handle g_hTimerMessage[MAXPLAYERS+1];

public 
Plugin myinfo =
{
    
name        "[L4D2] Game Start Message",
    
author      "Drixevel",
    
description "Prints a message in chat when the game starts.",
    
version     "1.0.0",
    
url         "https://drixevel.dev/"
};

public 
void OnPluginStart()
{
    
HookEvent("round_freeze_end"Event_RoundFreezeEndEventHookMode_PostNoCopy);
}

public 
void OnMapStart()
{
    
g_bLeftSafeArea false;
}

public 
void OnClientPutInServer(int client)
{
    if(!
IsFakeClient(client) && !g_bLeftSafeArea)
        
g_hTimerMessage[client] = CreateTimer(5.0Timer_DisplayMessageInSafeAreaGetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);
}

void Event_RoundFreezeEnd(Event event, const char[] namebool dontBroadcast)
{
    
g_bLeftSafeArea false;
    for(
int i 1<= MaxClientsi++)
    {
        if(!
IsClientInGame(i) || IsFakeClient(i) || g_hTimerMessage[i] != null) continue;
        
g_hTimerMessage[i] = CreateTimer(5.0Timer_DisplayMessageInSafeAreaGetClientUserId(i), TIMER_FLAG_NO_MAPCHANGE);
    }
}

Action Timer_DisplayMessageInSafeArea(Handle timerint userid)
{
    
int client GetClientOfUserId(userid);
    if (
client == || !IsClientInGame(client)) return Plugin_Handled;
    
    if(!
g_bLeftSafeAreaPrintToChat(client"\x04Inside Safe Area Message");
    
g_hTimerMessage[client] = null;
    return 
Plugin_Handled;
}

public 
void L4D_OnFirstSurvivorLeftSafeArea_Post(int client)
{
    
g_bLeftSafeArea true;
    
PrintToChatAll("\x04[Oyun Mod-Kontrolü] \x01Oyun başladı. Oyun Mod'u hazır! Bol şanslar! İyi oyunlar...");

__________________
alasfourom is offline
leaffan
Senior Member
Join Date: Jan 2013
Old 05-26-2023 , 09:49   Re: [L4D2] Beginning of Game Message
Reply With Quote #5

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

#pragma semicolon 1
#pragma newdecls required

bool g_bLeftSafeArea;
Handle g_hTimerMessage[MAXPLAYERS+1];

public 
Plugin myinfo =
{
    
name        "[L4D2] Game Start Message",
    
author      "Drixevel",
    
description "Prints a message in chat when the game starts.",
    
version     "1.0.0",
    
url         "https://drixevel.dev/"
};

public 
void OnPluginStart()
{
    
HookEvent("round_freeze_end"Event_RoundFreezeEndEventHookMode_PostNoCopy);
}

public 
void OnMapStart()
{
    
g_bLeftSafeArea false;
}

public 
void OnClientPutInServer(int client)
{
    if(!
IsFakeClient(client) && !g_bLeftSafeArea)
        
g_hTimerMessage[client] = CreateTimer(5.0Timer_DisplayMessageInSafeAreaGetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);
}

void Event_RoundFreezeEnd(Event event, const char[] namebool dontBroadcast)
{
    
g_bLeftSafeArea false;
    for(
int i 1<= MaxClientsi++)
    {
        if(!
IsClientInGame(i) || IsFakeClient(i) || g_hTimerMessage[i] != null) continue;
        
g_hTimerMessage[i] = CreateTimer(5.0Timer_DisplayMessageInSafeAreaGetClientUserId(i), TIMER_FLAG_NO_MAPCHANGE);
    }
}

Action Timer_DisplayMessageInSafeArea(Handle timerint userid)
{
    
int client GetClientOfUserId(userid);
    if (
client == || !IsClientInGame(client)) return Plugin_Handled;
    
    if(!
g_bLeftSafeAreaPrintToChat(client"\x04Inside Safe Area Message");
    
g_hTimerMessage[client] = null;
    return 
Plugin_Handled;
}

public 
void L4D_OnFirstSurvivorLeftSafeArea_Post(int client)
{
    
g_bLeftSafeArea true;
    
PrintToChatAll("\x04[Oyun Mod-Kontrolü] \x01Oyun başladı. Oyun Mod'u hazır! Bol şanslar! İyi oyunlar...");

Thank you very much. It works perfectly. Thanks.
leaffan 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 03:46.


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