Raised This Month: $ Target: $400
 0% 

How to block damage?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SuchyBGC
New Member
Join Date: Sep 2014
Old 09-01-2014 , 15:45   How to block damage?
Reply With Quote #1

Hi, I have this code:
Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <cstrike>
#include <fakemeta_util>

#include <deathrun_stats>

#define PLUGIN "Kolejka do TT"
#define VERSION "1.0"
#define AUTHOR "DarkGL"

#define dmg(%1,%2) (ArraySize(arKolejka) > 0 && ArrayGetCell(arKolejka,0) == %2 && get_user_team(%1) == 1)
#define dmg2(%1,%2) (ArraySize(arKolejka) > 0 && ArrayGetCell(arKolejka,0) == %1 && get_user_team(%2) == 1)


new Array: arKolejka;
new kolor;
new hud;

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    
    arKolejka = ArrayCreate(1,32);
    
    kolor = register_cvar("kolejka_kolorek", "0 255 0");
    
    register_event("HLTV", "event_RoundStart", "a", "1=0", "2=0"); 
    
    RegisterHam(Ham_TakeDamage, "player", "HamTakeDamage");
    RegisterHam(Ham_Spawn,"player","HamSpawned",1)
    
    register_event("DeathMsg", "DeathMsg", "a", "1=0")
    
    hud = CreateHudSyncObj();
    
    set_task(1.0, "wyswietl",.flags = "b");
}

public DeathMsg(){
    new victim = read_data(2)
    
    new iRet = iFind(victim);
    if(iRet != -1){
        ArrayDeleteItem(arKolejka,iRet);
        
        if(iRet    == 0 && ArraySize(arKolejka) > 0 && ArrayGetCell(arKolejka,0) == victim){
            ArrayDeleteItem(arKolejka,0);
            if(ArraySize(arKolejka) > 0)    fm_set_user_rendering(ArrayGetCell(arKolejka,0), kRenderFxGlowShell, 0, 255, 0, kRenderNormal, 40);
        }
    }
    
    return PLUGIN_HANDLED;
}

public HamSpawned(id){
    if(!is_user_alive(id))    return ;
    
    fm_set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 40);
}

public event_RoundStart() {
    ArrayClear(arKolejka);
}

public HamTakeDamage(victim, inflictor, attacker)
    return (dmg(victim, attacker) || dmg2(victim, attacker) || dmg(victim, inflictor) || dmg2(victim, inflictor) || !is_user_connected(attacker)) ? HAM_IGNORED : HAM_SUPERCEDE;

public fwPlayerFinished(id) {
    if( is_user_alive( id ) && cs_get_user_team( id ) == CS_TEAM_CT ){
        new iRet = iFind(id);
        if(iRet == -1)    ArrayPushCell(arKolejka,id);
        
        if(is_user_alive(ArrayGetCell(arKolejka,0)))    fm_set_user_rendering(ArrayGetCell(arKolejka,0), kRenderFxGlowShell, 0, 255, 0, kRenderNormal, 40);
        else ArrayDeleteItem( arKolejka , 0 );
    }
}

public wyswietl() {
    
    new msg[512];
    new bool: bNone = true;
    new szName[64]
    
    for(new i = 0;i<ArraySize(arKolejka);i++){
        if(!is_user_alive(ArrayGetCell(arKolejka,i))){
            ArrayDeleteItem(arKolejka,i)
            continue;
        }
        
        get_user_name(ArrayGetCell(arKolejka,i), szName,charsmax(szName));
        
        formatex(msg, 511, "%s%d. %s^n", msg, i+1, szName); 
        bNone = false;
    }
    
    if(bNone) formatex(msg, 511, "Lista jest pusta");
    
    new color[15], rgb[3][4]; get_pcvar_string(kolor, color, 14);
    parse(color, rgb[0], 3, rgb[1], 3, rgb[2], 3);
    
    set_hudmessage(str_to_num(rgb[0]), str_to_num(rgb[1]), str_to_num(rgb[2]), 0.78, 0.3, 0, 6.0, 1.0);
    ShowSyncHudMsg(0, hud, "Kolejka:^n%s^n^n", msg);
}

public client_disconnect(id)    arClear(id);
public client_connect(id)    arClear(id);

arClear(id){
    new iRet = iFind(id);
    
    if(iRet == -1)    return    ;
    
    ArrayDeleteItem(arKolejka,iRet)
}

iFind(id){
    for(new i = 0;i<ArraySize(arKolejka);i++){
        if(ArrayGetCell(arKolejka,i) == id)    return i;
    }
    return -1;
}
My problem is in HamTakeDamage.
This function is blocking a damage for weapons.
How to edit this code to block all damage, like rockets in CodMod?
Can you help me?
Sorry for terrible english.
SuchyBGC is offline
Unkolix
Veteran Member
Join Date: Sep 2012
Old 09-01-2014 , 16:14   Re: How to block damage?
Reply With Quote #2

Why not just put player in godmode?

PHP Code:
set_user_godmode(id1
1 = on; 0 = off..
Unkolix is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 09-01-2014 , 16:26   Re: How to block damage?
Reply With Quote #3

No. Just hook the ham and remove those conditions and just return HAM_SUPERCEDE
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
SuchyBGC
New Member
Join Date: Sep 2014
Old 09-01-2014 , 17:20   Re: How to block damage?
Reply With Quote #4

No, it doesn't work.
I have Deathrun + CodMod, when CT go deathrun he are pushed to queue.
When CT is first in queue, he can kill TT and vice versa, TT can't kill CT when he is second in queue.
When I use rocket, I can kill TT without queue.
This function (HamTakeDamage) is damaged because it doesn't block rocket and other things like that.

When I just return HAM_SUPERCEDE all players in game are in "godmode".
Sorry, queue? round? line? I could make a mistake.
SuchyBGC is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 09-01-2014 , 17:28   Re: How to block damage?
Reply With Quote #5

Quote:
Originally Posted by SuchyBGC View Post
When I just return HAM_SUPERCEDE all players in game are in "godmode".
Somethig sorta.
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
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 10:24.


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