Raised This Month: $ Target: $400
 0% 

Solved CS:GO Use Bandage by klicking Q (lastinv)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
iskenderkebab33
Senior Member
Join Date: Jun 2018
Old 07-06-2018 , 21:31   CS:GO Use Bandage by klicking Q (lastinv)
Reply With Quote #1

Hey, i need a Plugin, where Player can klick on there binded lastinv key (default: Q) to use a Bandage that give him 10 HP.

Thanks

Last edited by iskenderkebab33; 11-03-2018 at 17:35.
iskenderkebab33 is offline
LenHard
Senior Member
Join Date: Jan 2016
Old 07-06-2018 , 22:03   Re: CS:GO Use Bandage by klicking Q (lastinv)
Reply With Quote #2

PHP Code:
#include <sourcemod>  

#pragma semicolon 1  
#pragma newdecls required  

public void OnPluginStart()  
{  
    
AddCommandListener(CL_Heal"+lookatweapon"); 
}  

public 
Action CL_Heal(int client, const char[] sCmdint args)  
{  
    if (
client <= MaxClients && IsClientInGame(client) && IsPlayerAlive(client))  
    {  
        
int iHealth GetEntProp(clientProp_Send"m_iHealth") + 10;
        
int iMaxHealth GetEntProp(clientProp_Data"m_iMaxHealth");        
        
        if (
iHealth <= iMaxHealth)
            
SetEntProp(clientProp_Send"m_iHealth"iHealth);
        else
            
SetEntProp(clientProp_Send"m_iHealth"iMaxHealth);
            
        
ClientCommand(client"play )items/healthshot_success_01.wav");
    }  
    return 
Plugin_Continue;  

I tried lastinv but it didn't seem to work. So right now the button is (default: F) +lookatweapon
__________________


Currently accepting private requests.

Last edited by LenHard; 07-06-2018 at 22:03.
LenHard is offline
iskenderkebab33
Senior Member
Join Date: Jun 2018
Old 07-07-2018 , 05:04   Re: CS:GO Use Bandage by klicking Q (lastinv)
Reply With Quote #3

Quote:
Originally Posted by LenHard View Post
PHP Code:
#include <sourcemod>  

#pragma semicolon 1  
#pragma newdecls required  

public void OnPluginStart()  
{  
    
AddCommandListener(CL_Heal"+lookatweapon"); 
}  

public 
Action CL_Heal(int client, const char[] sCmdint args)  
{  
    if (
client <= MaxClients && IsClientInGame(client) && IsPlayerAlive(client))  
    {  
        
int iHealth GetEntProp(clientProp_Send"m_iHealth") + 10;
        
int iMaxHealth GetEntProp(clientProp_Data"m_iMaxHealth");        
        
        if (
iHealth <= iMaxHealth)
            
SetEntProp(clientProp_Send"m_iHealth"iHealth);
        else
            
SetEntProp(clientProp_Send"m_iHealth"iMaxHealth);
            
        
ClientCommand(client"play )items/healthshot_success_01.wav");
    }  
    return 
Plugin_Continue;  

I tried lastinv but it didn't seem to work. So right now the button is (default: F) +lookatweapon
many thanks! working fine.
iskenderkebab33 is offline
Ermert1992
Member
Join Date: Jan 2012
Location: Germany
Old 07-07-2018 , 08:23   Re: CS:GO Use Bandage by klicking Q (lastinv)
Reply With Quote #4

Yes, works fine. Thank you!
Ermert1992 is offline
iskenderkebab33
Senior Member
Join Date: Jun 2018
Old 07-08-2018 , 12:00   Re: CS:GO Use Bandage by klicking Q (lastinv)
Reply With Quote #5

Quote:
Originally Posted by LenHard View Post
PHP Code:
#include <sourcemod>  

#pragma semicolon 1  
#pragma newdecls required  

public void OnPluginStart()  
{  
    
AddCommandListener(CL_Heal"+lookatweapon"); 
}  

public 
Action CL_Heal(int client, const char[] sCmdint args)  
{  
    if (
client <= MaxClients && IsClientInGame(client) && IsPlayerAlive(client))  
    {  
        
int iHealth GetEntProp(clientProp_Send"m_iHealth") + 10;
        
int iMaxHealth GetEntProp(clientProp_Data"m_iMaxHealth");        
        
        if (
iHealth <= iMaxHealth)
            
SetEntProp(clientProp_Send"m_iHealth"iHealth);
        else
            
SetEntProp(clientProp_Send"m_iHealth"iMaxHealth);
            
        
ClientCommand(client"play )items/healthshot_success_01.wav");
    }  
    return 
Plugin_Continue;  

I tried lastinv but it didn't seem to work. So right now the button is (default: F) +lookatweapon
can you do also, a Player can use it only 3 times per Round please. Thanks.
iskenderkebab33 is offline
LenHard
Senior Member
Join Date: Jan 2016
Old 07-08-2018 , 20:25   Re: CS:GO Use Bandage by klicking Q (lastinv)
Reply With Quote #6

Quote:
Originally Posted by iskenderkebab33 View Post
can you do also, a Player can use it only 3 times per Round please. Thanks.
PHP Code:
#include <sourcemod>   

#pragma semicolon 1   
#pragma newdecls required   

#define LIMIT    3

int gI_Limit[MAXPLAYERS 1];

public 
void OnPluginStart()   
{   
    
HookEvent("round_start"Event_RoundStartEventHookMode_Post);   
    
    
AddCommandListener(CL_Heal"+lookatweapon");  
}   

public 
Action CL_Heal(int client, const char[] sCmdint args)   
{   
    if (
client <= MaxClients && IsClientInGame(client) && IsPlayerAlive(client))   
    {   
        if (
gI_Limit[client] < LIMIT)
        {            
            ++
gI_Limit[client];
            
            
int iHealth GetEntProp(clientProp_Send"m_iHealth") + 10
            
int iMaxHealth GetEntProp(clientProp_Data"m_iMaxHealth");         
             
            if (
iHealth <= iMaxHealth
                
SetEntProp(clientProp_Send"m_iHealth"iHealth); 
            else 
                
SetEntProp(clientProp_Send"m_iHealth"iMaxHealth); 
                 
            
ClientCommand(client"play )items/healthshot_success_01.wav"); 
        }
        else 
PrintToChat(client"[SM] You already used it \x04%i\x01 times..."LIMIT);
    }   
    return 
Plugin_Continue;   
}  

public 
void Event_RoundStart(Event hEvent, const char[] sEventNamebool bDontBroadcast

    for (
int i 1<= MaxClients; ++i
        if (
IsClientInGame(i)) 
            
gI_Limit[i] = 0;

Alright, stop spamming the forums with requests, make all your requests in one post. Otherwise I'll stop assisting.
__________________


Currently accepting private requests.

Last edited by LenHard; 07-09-2018 at 19:14. Reason: Limit Fix
LenHard is offline
iskenderkebab33
Senior Member
Join Date: Jun 2018
Old 07-09-2018 , 02:24   Re: CS:GO Use Bandage by klicking Q (lastinv)
Reply With Quote #7

Quote:
Originally Posted by LenHard View Post
PHP Code:
#include <sourcemod>   

#pragma semicolon 1   
#pragma newdecls required   

#define LIMIT    3

int gI_Limit[MAXPLAYERS 1];

public 
void OnPluginStart()   
{   
    
HookEvent("round_start"Event_RoundStartEventHookMode_Post);   
    
    
AddCommandListener(CL_Heal"+lookatweapon");  
}   

public 
Action CL_Heal(int client, const char[] sCmdint args)   
{   
    if (
client <= MaxClients && IsClientInGame(client) && IsPlayerAlive(client))   
    {   
        if (
gI_Limit[client] <= LIMIT)
        {            
            ++
gI_Limit[client];
            
            
int iHealth GetEntProp(clientProp_Send"m_iHealth") + 10
            
int iMaxHealth GetEntProp(clientProp_Data"m_iMaxHealth");         
             
            if (
iHealth <= iMaxHealth
                
SetEntProp(clientProp_Send"m_iHealth"iHealth); 
            else 
                
SetEntProp(clientProp_Send"m_iHealth"iMaxHealth); 
                 
            
ClientCommand(client"play )items/healthshot_success_01.wav"); 
        }
        else 
PrintToChat(client"[SM] You already used it \x04%i\x01 times..."LIMIT);
    }   
    return 
Plugin_Continue;   
}  

public 
void Event_RoundStart(Event hEvent, const char[] sEventNamebool bDontBroadcast

    for (
int i 1<= MaxClients; ++i
        if (
IsClientInGame(i)) 
            
gI_Limit[i] = 0;

Alright, stop spamming the forums with requests, make all your requests in one post. Otherwise I'll stop assisting.
thanks and what do you mean with spamming the forum? am i creating to much requests or..? if so sorry, i am new in SourcePawn and would also lern it by using other Coders stuffs. Sometimes i am tring it alone but the Code don't work and i give fast up.

Last edited by iskenderkebab33; 07-09-2018 at 02:26.
iskenderkebab33 is offline
iskenderkebab33
Senior Member
Join Date: Jun 2018
Old 07-09-2018 , 14:26   Re: CS:GO Use Bandage by klicking Q (lastinv)
Reply With Quote #8

Quote:
Originally Posted by LenHard View Post
PHP Code:
#include <sourcemod>   

#pragma semicolon 1   
#pragma newdecls required   

#define LIMIT    3

int gI_Limit[MAXPLAYERS 1];

public 
void OnPluginStart()   
{   
    
HookEvent("round_start"Event_RoundStartEventHookMode_Post);   
    
    
AddCommandListener(CL_Heal"+lookatweapon");  
}   

public 
Action CL_Heal(int client, const char[] sCmdint args)   
{   
    if (
client <= MaxClients && IsClientInGame(client) && IsPlayerAlive(client))   
    {   
        if (
gI_Limit[client] <= LIMIT)
        {            
            ++
gI_Limit[client];
            
            
int iHealth GetEntProp(clientProp_Send"m_iHealth") + 10
            
int iMaxHealth GetEntProp(clientProp_Data"m_iMaxHealth");         
             
            if (
iHealth <= iMaxHealth
                
SetEntProp(clientProp_Send"m_iHealth"iHealth); 
            else 
                
SetEntProp(clientProp_Send"m_iHealth"iMaxHealth); 
                 
            
ClientCommand(client"play )items/healthshot_success_01.wav"); 
        }
        else 
PrintToChat(client"[SM] You already used it \x04%i\x01 times..."LIMIT);
    }   
    return 
Plugin_Continue;   
}  

public 
void Event_RoundStart(Event hEvent, const char[] sEventNamebool bDontBroadcast

    for (
int i 1<= MaxClients; ++i
        if (
IsClientInGame(i)) 
            
gI_Limit[i] = 0;

Alright, stop spamming the forums with requests, make all your requests in one post. Otherwise I'll stop assisting.
thanks working, but one issue, you can use it 4 times and not 3.
iskenderkebab33 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 13:21.


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