View Single Post
Sunyata
Senior Member
Join Date: Nov 2017
Location: Wherever I am
Old 06-15-2019 , 03:24   Re: [L4D] Pills Here
Reply With Quote #24

I'm trying to include this plugin on my l4d1 co-op server, but there is an issue with it: at round start of opening chapter it will give 1 set of pills to each survivor -as it should do. However on each subsequent chapter it gives 2 sets of pills to each survivor instead of the 1 that they should get.

Anyone know why this is happening? Below is the code from the script, perhaps some experienced coder here may see what is causing this issue. Any help on this would be most appreciated.

PHP Code:
/*
* 1.1.2
*  - Update URL in plugin info.
*  - Cleaned up some more code.
* 1.1.1
*  - Cleaned up some code.
* 1.1
*  - Added admin command sm_givepills.
* 1.0.1
*  - Increased timer so plugin will work on 16 player servers.
* 1.0
*  - Initial release.
*/

#include <sourcemod>
#include <sdktools>
 
public Plugin:myinfo =
{
    
name "[L4D] Pills Here",
    
author "Crimson_Fox",
    
description "Gives pills to survivors at the start of each round.",
    
version "1.1.2",
    
url "http://forums.alliedmods.net/showthread.php?p=915033"
}

public 
OnPluginStart()
{
    
HookEvent("round_start"EventGivePillsEventHookMode_Post);
    
RegAdminCmd("sm_givepills"Command_GivePillsADMFLAG_KICK"Gives pills to survivors.");
}

public 
EventGivePills(Handle:event, const String:name[], bool:dontBroadcast)
{
    
CreateTimer(30.0GivePillsDelay);
}

public 
Action:GivePillsDelay(Handle:timer)
{
    
GivePillsAll()
}

public 
Action:Command_GivePills(clientargs)
{
    
GivePillsAll()
}

public 
GivePillsAll()
{
    new 
flags GetCommandFlags("give");    
    
SetCommandFlags("give"flags & ~FCVAR_CHEAT);    
    for (new 
1<= MaxClientsi++)
    {
        if (
IsClientInGame(i) && GetClientTeam(i)==2FakeClientCommand(i"give pain_pills");
    }
    
SetCommandFlags("give"flags|FCVAR_CHEAT);

Sunyata is offline