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

Solved L4D2 is who initiates the switch prompt or display


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
yabi
Senior Member
Join Date: Jun 2021
Location: Taiwan
Old 01-07-2022 , 11:46   L4D2 is who initiates the switch prompt or display
Reply With Quote #1

When all teammates arrive at the rescue location, someone will turn on the rescue switch or trigger the switch. Someone can make a prompt or show who turned on the switch?

Last edited by yabi; 07-17-2022 at 18:26. Reason: 已解決
yabi is offline
HarryPotter
Veteran Member
Join Date: Sep 2017
Location: Taiwan, Asia
Old 01-07-2022 , 12:04   Re: L4D2 is who initiates the switch prompt or display
Reply With Quote #2

PHP Code:
#pragma semicolon 1
#pragma newdecls required
#include <sourcemod>
#include <sdktools>

public Plugin myinfo =
{
    
name "[L4D & L4D2] XXX",
    
author "HarryPotter",
    
description "<->",
    
version "0.0",
    
url ""
}

public 
void OnPluginStart()
{
    
HookEvent("round_start",            Event_RoundStart,    EventHookMode_PostNoCopy);
    
HookEvent("player_use"Event_PlayerUse);
}

bool alreadytrigger false;
public 
void Event_PlayerUse (Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(event.GetInt("userid"));
    if(
alreadytrigger || !client || !IsClientInGame(client)) return;

    
int entity GetEventInt(event,"targetid");
    
char sClassName[64];
    
GetEdictClassname(entitysClassNamesizeof(sClassName));

    
//PrintToChatAll("client = %N, entity = %i, edict classname = %s", client, entity, sClassName);
    
    
if (StrEqual(sClassName,"trigger_finale"))
    {
        
PrintToChatAll("%N triggers final rescue"client);
        
alreadytrigger true;
    }
}

public 
void Event_RoundStart(Event event, const char[] namebool dontBroadcast)
{
    
alreadytrigger false;

__________________
HarryPotter is offline
yabi
Senior Member
Join Date: Jun 2021
Location: Taiwan
Old 01-08-2022 , 11:52   Re: L4D2 is who initiates the switch prompt or display
Reply With Quote #3

Quote:
Originally Posted by HarryPotter View Post
PHP Code:
#pragma semicolon 1
#pragma newdecls required
#include <sourcemod>
#include <sdktools>

public Plugin myinfo =
{
    
name "[L4D & L4D2] XXX",
    
author "HarryPotter",
    
description "<->",
    
version "0.0",
    
url ""
}

public 
void OnPluginStart()
{
    
HookEvent("round_start",            Event_RoundStart,    EventHookMode_PostNoCopy);
    
HookEvent("player_use"Event_PlayerUse);
}

bool alreadytrigger false;
public 
void Event_PlayerUse (Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(event.GetInt("userid"));
    if(
alreadytrigger || !client || !IsClientInGame(client)) return;

    
int entity GetEventInt(event,"targetid");
    
char sClassName[64];
    
GetEdictClassname(entitysClassNamesizeof(sClassName));

    
//PrintToChatAll("client = %N, entity = %i, edict classname = %s", client, entity, sClassName);
    
    
if (StrEqual(sClassName,"trigger_finale"))
    {
        
PrintToChatAll("%N triggers final rescue"client);
        
alreadytrigger true;
    }
}

public 
void Event_RoundStart(Event event, const char[] namebool dontBroadcast)
{
    
alreadytrigger false;


This is great thanks Harry

Do you have any tips for turning on the switch?
For example, generators or other switches that lift elevators can also know who?
yabi 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 14:26.


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