View Single Post
Author Message
monkaS
Junior Member
Join Date: Feb 2021
Old 03-01-2021 , 12:58   [L4D1] Survival Triggers help. [HELP/REQUEST]
Reply With Quote #1

So I got some help restoring a plugin to display a world record chat message on the trigger 'round_start' a few weeks ago however I want this to display on the actual start of the survival round, I ported this to L4D2 just fine since that game has a trigger dedicated to the start of a survival round using 'survival_round_start'.

Since this game doesn't have a trigger dedicated to the start of a survival round, I assume that the only way to get this to happen on l4d1 is to use the create_panic_event trigger however using that means that the message is displayed every time there's a panic event, so every 40sec - a min.

The idea I had in fixing it was (somehow) limiting it to just display on the first panic event that happens when the round first starts. I researched other threads looking for any type of code close to what I was looking for to use as a template since I'm very inexperienced with coding but I haven't managed to find any.

So finally I'm here, my request is: with the code below can I have some help in adjusting it to my needs?

Code:
public void OnPluginStart()
{
    HookEvent("create_panic_event", OnPanicCreate);
}

public void OnPanicCreate(Event event, const char[] name, bool dontBroadcast)
{
    PrintMapRecord();
}

public void PrintMapRecord()
{
    char map[64];
    GetCurrentMap(map, sizeof(map));
    StringToLowerCase(map);

    char record[250];
    if (StrEqual(map, "l4d_hospital02_subway"))
        record = "360:10.63 - enk, 0pposer, henry, Ùŋ∂ęƦĢØ";
    else if (StrEqual(map, "l4d_hospital03_sewers"))
        record = "367:55.20 - BadNews, jim, Karma, Nesisoth";
    else if (StrEqual(map, "l4d_hospital04_interior"))
        record = "319:39.23 - вℓσσ∂у, Dennis, JusT SLOW, 0pposer";
    else if (StrEqual(map, "l4d_vs_hospital05_rooftop"))
        record = "269:09.67 - BadNews, jim, Karma, Nesisoth";
    else if (StrEqual(map, "l4d_garage01_alleys"))
        record = "273:57.33 - jim, Nesisoth, Scout, Ùŋ∂ęƦĢØ";
    else if (StrEqual(map, "l4d_garage02_lots"))
        record = "205:37.40 - jim, Nesisoth, Scout, ϟḱ¥ђ℮αґт";
    else if (StrEqual(map, "l4d_smalltown02_drainage"))
        record = "333:32.37 - enk, henry, Scout, śķ⁹ęł";
    else if (StrEqual(map, "l4d_smalltown03_ranchhouse"))
        record = "290:39.90 - Dean Winchester, Scout, henry, Ùŋ∂ęƦĢØ";
    else if (StrEqual(map, "l4d_smalltown04_mainstreet"))
        record = "500:45.77 - вℓσσ∂у, JusT SLOW, 0pposer, henry";
    else if (StrEqual(map, "l4d_vs_smalltown05_houseboat"))
        record = "340:35.63 - Davis, enk, Fox, śķ⁹ęł";
    else if (StrEqual(map, "l4d_airport02_offices"))
        record = "227:09.97 - enk, henry, Scout, śķ⁹ęł";
    else if (StrEqual(map, "l4d_airport03_garage"))
        record = "225:35.93 - enk, jim, Karma, Nesisoth";
    else if (StrEqual(map, "l4d_airport04_terminal"))
        record = "270:09.60 - вℓσσ∂у, Davis, JusT SLOW, 0pposer";
    else if (StrEqual(map, "l4d_vs_airport05_runway"))
        record = "232:52.00 - jim, Nesisoth, Scout, ϟḱ¥ђ℮αґт";
    else if (StrEqual(map, "l4d_farm02_traintunnel"))
        record = "286:12.94 - Dean Winchester, 0pposer, Raptor, Scout";
    else if (StrEqual(map, "l4d_farm03_bridge"))
        record = "211:21.77 - Abdur, jim, Nesisoth, henry";
    else if (StrEqual(map, "l4d_vs_farm05_cornfield"))
        record = "501:17.20 - 0pposer, henry, Scout, Ùŋ∂ęƦĢØ";
    else if (StrEqual(map, "l4d_river01_docks"))
        record = "205:53.13 - jim, Nesisoth, Scout, ϟḱ¥ђ℮αґт";
    else if (StrEqual(map, "l4d_river03_port"))
        record = "483:15.73 - Dean Winchester, Tom, henry, 0pposer";
    else if (StrEqual(map, "l4d_sv_lighthouse"))
        record = "366:22.60 - jim, Karma, Nesisoth, Scout";

    if (record[0] != 0)
        PrintToChatAll("\x03Map World Record is %s. GLHF!", record);
}

/**
 * Converts the string to lower case.
 *
 * @param input         Input string.
 */
void StringToLowerCase(char[] input)
{
    for (int i = 0; i < strlen(input); i++)
    {
        input[i] = CharToLower(input[i]);
    }
}
Any help is appreciated even if it's just giving me tips however, I've only just started looking into code and have no experience with code in the past. Been looking into this for a few days now with no success.
monkaS is offline