Raised This Month: $32 Target: $400
 8% 

Solved [L4D2] Weapons


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Uncle Jessie
Member
Join Date: May 2016
Location: Mind Prison
Old 03-06-2017 , 20:17   [L4D2] Weapons
Reply With Quote #1

The weapon drops from two slots at the same time, how to fix it?

PHP Code:
public Action:OnPlayerRunCmd(client, &buttons, &impulsFloat:vel[3], Float:angles[3], &weapon)

    if((
buttons IN_SPEED) && (buttons IN_USE))
    {
        if(
GetClientTeam(client)==&& !IsFakeClient(client) && IsPlayerAlive(client))
        {
                
Command_Drop(clientslot);
        }
        if (
buttons IN_USEbuttons &= ~IN_USE
    } 

Last edited by Uncle Jessie; 03-15-2017 at 20:37.
Uncle Jessie is offline
sdz
Senior Member
Join Date: Feb 2012
Old 03-06-2017 , 20:41   Re: [L4D2] Weapons
Reply With Quote #2

PHP Code:
new bool:prethink[MAXPLAYERS 1] = false;

public 
Action:OnPlayerRunCmd(client, &buttons, &impulsFloat:vel[3], Float:angles[3], &weapon)
{
    if((
buttons IN_SPEED) && (buttons IN_USE))
    {
        if(!
prethink[client])
        {
            if(
GetClientTeam(client) == && !IsFakeClient(client) && IsPlayerAlive(client))
            {
                
Command_Drop(clientslot);
                
prethink true;
            }
            if (
buttons IN_USEbuttons &= ~IN_USE;
        }
        else if(
buttons IN_USE || buttons IN_SPEED)
            
prethink[client] = false;
    }


Last edited by sdz; 03-06-2017 at 20:41.
sdz is offline
Uncle Jessie
Member
Join Date: May 2016
Location: Mind Prison
Old 03-06-2017 , 21:51   Re: [L4D2] Weapons
Reply With Quote #3

Quote:
Originally Posted by EasSidezz View Post
PHP Code:
new bool:prethink[MAXPLAYERS 1] = false;

public 
Action:OnPlayerRunCmd(client, &buttons, &impulsFloat:vel[3], Float:angles[3], &weapon)
{
    if((
buttons IN_SPEED) && (buttons IN_USE))
    {
        if(!
prethink[client])
        {
            if(
GetClientTeam(client) == && !IsFakeClient(client) && IsPlayerAlive(client))
            {
                
Command_Drop(clientslot);
                
prethink true;
            }
            if (
buttons IN_USEbuttons &= ~IN_USE;
        }
        else if(
buttons IN_USE || buttons IN_SPEED)
            
prethink[client] = false;
    }

Thank you for the code but nothing helps
Uncle Jessie is offline
Lux
Veteran Member
Join Date: Jan 2015
Location: Cat
Old 03-07-2017 , 21:18   Re: [L4D2] Weapons
Reply With Quote #4

you should be more specific, i can't understand your vague question?
__________________
Connect
My Plugins: KlickME
[My GitHub]

Commission me for L4D
Lux is offline
Uncle Jessie
Member
Join Date: May 2016
Location: Mind Prison
Old 03-08-2017 , 08:01   Re: [L4D2] Weapons
Reply With Quote #5

Quote:
Originally Posted by Ludastar View Post
you should be more specific, i can't understand your vague question?
If slot 0 then press button, weapons drops normally if slot 2 or 3, then weapons drops from these two slots. mean auto slots switching and all weapon drops.
My english is bad sorry

edit:
solved
PHP Code:
public Action:OnPlayerRunCmd(client, &buttons, &impulsFloat:vel[3], Float:angles[3], &weapon)
{
    if(
CanPlayerDrop[client] == false && (buttons IN_SPEED) && (buttons IN_USE))
    {
        
buttons &= ~IN_USE;
        return 
Plugin_Continue;
    }
            
    if(
GetClientTeam(client) == && !IsFakeClient(client) && IsPlayerAlive(client) && h_ClientTimer[client] == INVALID_HANDLE && (buttons IN_SPEED) && (buttons IN_USE))
    {
        
buttons &= ~IN_USE;
        
CanPlayerDrop[client] = false;
        
h_ClientTimer[client] = CreateTimer(0.1Timer_CanPlayerDrop_Resetclient);
    }
    
    return 
Plugin_Continue;


Last edited by Uncle Jessie; 03-14-2017 at 23:03.
Uncle Jessie is offline
Uncle Jessie
Member
Join Date: May 2016
Location: Mind Prison
Old 03-15-2017 , 17:58   Re: [L4D2] Weapons
Reply With Quote #6

Another question is how to make a delay for the buttons? With working
PHP Code:
buttons &= ~IN_USE 
Uncle Jessie is offline
sdz
Senior Member
Join Date: Feb 2012
Old 03-16-2017 , 11:07   Re: [L4D2] Weapons
Reply With Quote #7

Quote:
Originally Posted by Uncle Jessie View Post
Another question is how to make a delay for the buttons? With working
PHP Code:
buttons &= ~IN_USE 
Call a timer and return Plugin_Handled on the button
sdz is offline
Uncle Jessie
Member
Join Date: May 2016
Location: Mind Prison
Old 03-16-2017 , 20:58   Re: [L4D2] Weapons
Reply With Quote #8

Quote:
Call a timer and return Plugin_Handled on the button
Something like this works fine, thanks.

PHP Code:
public Action:OnPlayerRunCmd(client, &buttons, &impulsFloat:vel[3], Float:angles[3], &weapon)
{
    if(
CanPlayerDrop[client] == false && (buttons IN_SPEED) && (buttons IN_USE))
    {
        
buttons &= ~IN_USE;
        return 
Plugin_Continue;
    }
    
    if(
GetClientTeam(client) == && !IsFakeClient(client) && IsPlayerAlive(client) && (buttons IN_SPEED) && (buttons IN_USE))
    {
        
CanPlayerDrop[client] = false;

        
CreateTimer(2.0ResetDelayclient);
        
Command_Drop(clientslot)
        
buttons &= ~IN_USE;
    }
    
    return 
Plugin_Continue;


Last edited by Uncle Jessie; 03-16-2017 at 20:59.
Uncle Jessie 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 20:41.


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