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

[L4D] Pills Here


Post New Thread Reply   
 
Thread Tools Display Modes
hara kiri
Member
Join Date: Jan 2014
Old 02-26-2015 , 03:01   Re: [L4D] Pills Here
Reply With Quote #21

Hello ,

i have tried these commands

sm_ cvar ammo_first_aid_kit_max 0
sm_ cvar weapon_first_aid_kit_max 0

But it's not work
hara kiri is offline
Krufftys Killers
Senior Member
Join Date: Jan 2014
Old 02-26-2015 , 09:36   Re: [L4D] Pills Here
Reply With Quote #22

Quote:
Originally Posted by hara kiri View Post
Hello ,

i have tried these commands

sm_ cvar ammo_first_aid_kit_max 0
sm_ cvar weapon_first_aid_kit_max 0

But it's not work
check here https://forums.alliedmods.net/showthread.php?t=185125 for the cav you want.
Krufftys Killers is offline
hara kiri
Member
Join Date: Jan 2014
Old 02-26-2015 , 17:10   Re: [L4D] Pills Here
Reply With Quote #23

i tried it but not work yet

ammo_firstaid_max 0
sm_cvar ammo_firstaid_max 0

can you help to found the good CVAR please ?
hara kiri is offline
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
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 06-15-2019 , 06:14   Re: [L4D] Pills Here
Reply With Quote #25

Quote:
Originally Posted by Sunyata View Post
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);

I can't find the post at the moment but I read somewhere on this forum that round_start can fire twice, so maybe add a bool variable to check if it already fired once?

PHP Code:
public void EventGivePills(Event event, const char[] namebool dontBroadcast)
{
    if (!
g_bPillsGiven)
    {
        
g_bPillsGiven true;
        
CreateTimer(30.0GivePillsDelay);
    }

__________________
Psyk0tik is offline
Sunyata
Senior Member
Join Date: Nov 2017
Location: Wherever I am
Old 06-15-2019 , 09:00   Re: [L4D] Pills Here
Reply With Quote #26

Hey Crasher_3637, thanks for that code snippet. Perhaps I should have explained in my last post - how would your code be incorporated into the "pills" script? I should have mentioned that I'm no good at coding, so I'm very dependent upon an experienced coder, such as yourself, to help mod this existing script to include your code - assuming that's easy enough to do of course.

I'd be most grateful if you could help out some more on this issue,

Regards, Sunyata
Sunyata is offline
Naleksuh
Member
Join Date: Dec 2018
Old 06-17-2019 , 12:45   Re: [L4D] Pills Here
Reply With Quote #27

Quote:
maybe add a bool variable to check if it already fired once?
Good idea, problem is that would make it only fire once ever then never fire again.
What I'm thinking is make it ignore any round_start's that happened less than a second since the previous one.
Naleksuh is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 06-17-2019 , 13:18   Re: [L4D] Pills Here
Reply With Quote #28

Quote:
Originally Posted by Naleksuh View Post
Good idea, problem is that would make it only fire once ever then never fire again.
What I'm thinking is make it ignore any round_start's that happened less than a second since the previous one.
That’s why you reset the variable back to false on round_end.
__________________
Psyk0tik is offline
FlavioCO92
New Member
Join Date: Jul 2020
Old 07-08-2020 , 05:54   Re: [L4D] Pills Here
Reply With Quote #29

Hello, I need help, to start I don't know anything about programming or anything about it, I'm just curious, anyway, what I want to achieve is: give a survivors starter pack, but only in the first round of any campaign.

It works (it gives the 4 survivors their packs), but it has the error that it generates 6 extra packs on the ground and as one progresses on the map, packs appear in the place where the survivors are, I suspect it is from HookEvent "player_first_spawn" and that packs are being generated by the appearance of Infected (bots)

PHP Code:
#include <sourcemod>
#include <sdktools>
 
public OnPluginStart()
{
    
HookEvent("player_first_spawn"EventGiveStartPack);
    
RegAdminCmd("sm_startpack"Command_GiveStartPackADMFLAG_KICK"Gives start pack to survivors.");
}

public 
EventGiveStartPack(Handle:event, const String:name[], bool:dontBroadcast)
{
    
CreateTimer(10.0GiveStartPackDelay);
}

public 
Action:GiveStartPackDelay(Handle:timer)
{
    
GiveStartPackAll()
}

public 
Action:Command_GiveStartPack(clientargs)
{
    
GiveStartPackAll()
}

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

FlavioCO92 is offline
Reply


Thread Tools
Display Modes

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 11:57.


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