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

OnTakeDamage problem with container


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kubad
Senior Member
Join Date: Sep 2015
Location: Czech Republic
Old 04-17-2016 , 03:41   OnTakeDamage problem with container
Reply With Quote #1

Hello i have problem with OnTakeDamage i try change damagetype or dont said on plugin and i destroy him and container give me - 30 HP i need this damage give for knife and guns please help me

PHP Code:
public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
    if (
IsClientInGame(attacker) && IsPlayerAlive(attacker))
    {
        if (
damagetype DMG_BULLET
        {
            
damage = (damage 30);
            return 
Plugin_Changed;
        }
    }
    return 
Plugin_Continue;

#sorry for my english

Last edited by Kubad; 04-17-2016 at 04:04.
Kubad is offline
Kubad
Senior Member
Join Date: Sep 2015
Location: Czech Republic
Old 04-17-2016 , 06:01   Re: OnTakeDamage problem with container
Reply With Quote #2

+ tried this and dont working dont giving damage

PHP Code:
public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype
{
    if(
attacker == victim
        return 
Plugin_Handled;
    
    
damage = (damage 10);
    return 
Plugin_Continue

Kubad is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 04-17-2016 , 06:17   Re: OnTakeDamage problem with container
Reply With Quote #3

Quote:
Originally Posted by Kubad View Post
Hello i have problem with OnTakeDamage i try change damagetype or dont said on plugin and i destroy him and container give me - 30 HP i need this damage give for knife and guns please help me

PHP Code:
public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
    if (
IsClientInGame(attacker) && IsPlayerAlive(attacker))
    {
        if (
damagetype DMG_BULLET
        {
            
damage = (damage 30);
            return 
Plugin_Changed;
        }
    }
    return 
Plugin_Continue;

#sorry for my english
I don't understand a ***, can you describe your problem in Czech? I will try to understand and translate for others.

Quote:
Originally Posted by Kubad View Post
+ tried this and dont working dont giving damage

PHP Code:
public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype
{
    if(
attacker == victim
        return 
Plugin_Handled;
    
    
damage = (damage 10);
    return 
Plugin_Continue

PHP Code:
public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype
{
    if(
attacker == victim
        return 
Plugin_Handled;
    
    
damage = (damage 10);
    return 
Plugin_Changed// HERE

__________________
Plugins: TeamGames
Includes: Menu stocks, ColorVariables, DownloadTableConfig

> No help through PM, make a topic.
KissLick is offline
Kubad
Senior Member
Join Date: Sep 2015
Location: Czech Republic
Old 04-17-2016 , 06:25   Re: OnTakeDamage problem with container
Reply With Quote #4

dont give for player +10 damage i dont know why
PHP Code:
public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype
{
    if(
attacker == victim
        return 
Plugin_Handled;
    
    
damage = (damage 10);
    return 
Plugin_Changed;

Kubad is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 04-17-2016 , 06:34   Re: OnTakeDamage problem with container
Reply With Quote #5

This works for me.

PHP Code:
#include <sourcemod>
#include <sdkhooks>

#pragma semicolon 1

public Plugin myinfo = {
    
name        "",
    
author      "",
    
description "",
    
version     "0.0.0",
    
url         ""
};

public 
OnClientPutInServer(client)
{
    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage);
}

public 
Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype
{
    if(
attacker == victim
        return 
Plugin_Handled;
    
    
damage = (damage 90.0);
    return 
Plugin_Changed;

Are you sure that you have players hooked?
__________________
Plugins: TeamGames
Includes: Menu stocks, ColorVariables, DownloadTableConfig

> No help through PM, make a topic.
KissLick is offline
Kubad
Senior Member
Join Date: Sep 2015
Location: Czech Republic
Old 04-17-2016 , 06:39   Re: OnTakeDamage problem with container
Reply With Quote #6

i have hook in public void OnClientPutInServer(client) i trying updating sourcemod or i dont know

PHP Code:
public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)  
{      
    
damage = (damage 10); 
    return 
Plugin_Changed

only this code working

PHP Code:
if(attacker == victim
        return 
Plugin_Handled
and with this not

Last edited by Kubad; 04-17-2016 at 06:39.
Kubad is offline
Phil25
AlliedModders Donor
Join Date: Feb 2015
Old 04-17-2016 , 06:49   Re: OnTakeDamage problem with container
Reply With Quote #7

Post the whole script. Maybe you're late loading the plugin and not hooking already online clients?
Phil25 is offline
Kubad
Senior Member
Join Date: Sep 2015
Location: Czech Republic
Old 04-17-2016 , 06:53   Re: OnTakeDamage problem with container
Reply With Quote #8

PHP Code:
public void OnClientPutInServer(client)
{
    if(!
IsValidClient(client))
        return;
    
SDKHook(clientSDKHook_GroundEntChangedPostGroundEntChangedPost);
    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage); 



Last edited by Kubad; 04-17-2016 at 06:54.
Kubad is offline
Kubad
Senior Member
Join Date: Sep 2015
Location: Czech Republic
Old 04-17-2016 , 06:59   Re: OnTakeDamage problem with container
Reply With Quote #9

i update sourcemod and all working
Kubad 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 05:33.


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