AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   Solved L4D2 is who initiates the switch prompt or display (https://forums.alliedmods.net/showthread.php?t=335831)

yabi 01-07-2022 11:46

L4D2 is who initiates the switch prompt or display
 
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?

HarryPotter 01-07-2022 12:04

Re: L4D2 is who initiates the switch prompt or display
 
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;



yabi 01-08-2022 11:52

Re: L4D2 is who initiates the switch prompt or display
 
Quote:

Originally Posted by HarryPotter (Post 2767882)
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?


All times are GMT -4. The time now is 04:58.

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