AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Block suicide from he.. (https://forums.alliedmods.net/showthread.php?t=206636)

emaya93 01-24-2013 14:57

Block suicide from he..
 
Hi all I need a cod that block suicide from hegrenade. I have made a menu for deathrun only tero, and tero when select the option Grenazi (hegrenade) he use them to suicide ... I want a cod that works when that option it's selected, to active block suicide from he... here is menu:
Code:

/* Thanks a lot to red bull for make me this plugin, thanks a lot! /*
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <fakemeta>
#include <hamsandwich>

#pragma semicolon 1

#define RED  0
#define GREEN  255
#define BLUE  255

#define HE 30
#define FLASH 50
#define TIME 7

#define KEYS    ((1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<9))

#define PLUGIN "DeathRun Terro Menu"
#define VERSION "1.2"
#define AUTHOR "Vicious Vixen"

stock ColorChat(const id, const intrare[], any:...) {
    new numar = 1, jucatori[32];
   
    static mesaj[191];
    vformat(mesaj, 190, intrare, 3);
   
    replace_all(mesaj, 190, "!v", "^x04");    /* culoarea verde                                */
    replace_all(mesaj, 190, "!c", "^x01");    /* culoarea chatului                            */
    replace_all(mesaj, 190, "!e", "^x03");  /* culoarea echipei ct = albastru | tero = rosie */
    replace_all(mesaj, 190, "!e2", "^x00"); /* culoarea normala a echipei                    */
   
    if(id)
        jucatori[0] = id;
    else
       
    get_players(jucatori, numar, "ch");
   
    for(new i = 0; i < numar; i++) {
        if(is_user_connected(jucatori[i])) {
            message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, jucatori[i]);
            write_byte(jucatori[i]);
            write_string(mesaj);
            message_end();
        }
    }
}

new const PREFIX[] = "IlogicGroup";
new const MenuName[] = "\rTero Meniu^n^n";
new const NumeSite[] = "\ywww.numesite.ro";

new MENU;

new bool: UserIsInvisible[33];

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR);
   
    MENU = register_menuid("MENU");
    register_menucmd( MENU, KEYS, "MenuHandler");
   
    RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn", 1);
   
}

public fw_PlayerSpawn(id)
{
    client_cmd(id, "cl_backspeed 400");
    client_cmd(id, "cl_forwardspeed 400");
    client_cmd(id, "cl_sidespeed 400");
   
    if(UserIsInvisible[id])
    {
        set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderNormal, 0);
        UserIsInvisible[id] = false;
    }
   
    if(is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_T )
    {
        showMenu(id);
    }
   
    return HAM_IGNORED;
}

public showMenu(id)
{   
    new szMenu[1024], n;
   
    n = formatex(szMenu, 1023, "%s",MenuName);
   
    n += formatex(szMenu[n], 1023-n, "\r1.\w Free Run^n");
    n += formatex(szMenu[n], 1023-n, "\r2.\w Invizibilitate^n");
    n += formatex(szMenu[n], 1023-n, "\r3.\w Victima^n");
    n += formatex(szMenu[n], 1023-n, "\r4.\w Alba ca Zapada^n");
    n += formatex(szMenu[n], 1023-n, "\r5.\w Sniper^n");
    n += formatex(szMenu[n], 1023-n, "\r6.\w Grenazi^n^n\r0.\w Iesire^n^n%s",NumeSite);
   
    show_menu(id, KEYS, szMenu, TIME, "MENU");
   
}
public MenuHandler(id, key)
{
   
    switch(key)
    {
        case 0:
        {
            freerun(id);
            return 1;
        }
        case 1:
        {
            invizibilitate(id);
            return 1;
        }
        case 2:
        {
            Victima(id);
            return 1;
        }
        case 3:
        {
            alba_ca_zapada(id);
            return 1;
        }
        case 4:
        {
            sniper(id);
            return 1;
        }
        case 5:
        {
            grenazi(id);
            return 1;
        }
        case 9:
        {
            showMenu(id);
            return 1;
        }
    }
    return 0;
}

public freerun(id)
{
    if(is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_T )
    {
        ColorChat(id, "^x01[^x04 %s^x01 ]^x03 Ai lasat jocul^x04 Free Run,^x03 primul^x04 CT^x03 care ajunge la tine trebuie sa iti dea^x04 arma!",PREFIX);
        client_cmd(id,"say /free");
    }
    new name[32];
    get_user_name(id,name,31);
   
    set_hudmessage(RED, GREEN, BLUE, 0.02, 0.20, 0, 6.0, 3.0);
    show_hudmessage(0, "%s a lasat jocul Free Run, Primul CT care ajunge, ii va da arma!!",name);
   
}

public invizibilitate(id)
{
    if(is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_T )
    {
        server_cmd("deathrun_mode ^"INVIS^"");
        ColorChat(id, "^x01[^x04 %s^x01 ]^x03 Acum esti total^x03 invizibil!",PREFIX);
        set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 0);
        UserIsInvisible[id] = true;
    }
    new name[32];
    get_user_name(id,name,31);
   
    set_hudmessage(RED, GREEN, BLUE, 0.02, 0.20, 0, 6.0, 3.0);
    show_hudmessage(0, "%s este acum invizibil !!",name);
   
   
}

public Victima(id)
{
    if(is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_T )
    {
       
        ColorChat(id, "^x01[^x04 %s^x01 ]^x03 Esti o^x04 victima^x03 acuma!",PREFIX);
        set_user_health(id, 10000);
       
    }
   
    new name[32];
    get_user_name(id,name,31);   
    set_hudmessage(RED, GREEN, BLUE, 0.02, 0.20, 0, 6.0, 3.0);
    show_hudmessage(0, "%s a primit 1000 HP iar echipa CT AWP, deoarece a ales modul VICTIMA !",name);
   
    if(is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT )
    {
       
        give_item(id, "weapon_awp");
        cs_set_user_bpammo(id , CSW_AWP, 35);
        set_user_health(id, 100);
    }
   
}

public alba_ca_zapada(id)
{
    if(is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_T )
    {   
        ColorChat(id, "^x01[^x04 %s^x01 ]^x03 ai primit^x04 %d^x03 de^x04 Flashbang!",PREFIX, FLASH);
        give_item(id, "weapon_flashbang");
        cs_set_user_bpammo(id , CSW_FLASHBANG, HE);
    }
   
    new name[32];
    get_user_name(id,name,31);
   
    set_hudmessage(RED, GREEN, BLUE, 0.02, 0.20, 0, 6.0, 3.0);
    show_hudmessage(0, "%s a primit %d de Flashbang!",name,FLASH);
}

public sniper(id)
{
    if(is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_T )
    {
        new name[32];
        get_user_name(id,name,31);
       
        set_hudmessage(RED, GREEN, BLUE, 0.02, 0.20, 0, 6.0, 3.0);
        show_hudmessage(0, "%s are un AWP cu 35 gloante. Echipa CT a primit cate un DEAGLE !!",name);
       
        ColorChat(id, "^x01[^x04 %s^x01 ]^x03 Ai primit un^x04 AWP^x03 cu^x04 35^x03 gloante !",PREFIX);
       
        give_item(id, "weapon_awp");
        cs_set_user_bpammo(id , CSW_AWP, 35);
    }
   
    if(is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT )
    {
        give_item(id, "weapon_deagle");
        give_item(id, "item_assaultsuit");
        cs_set_user_bpammo(id , CSW_DEAGLE, 35);
    }
   
   
   
}

public grenazi(id)
{
   
    new name[32];
    get_user_name(id,name,31);
   
    set_hudmessage(RED, GREEN, BLUE, 0.02, 0.20, 0, 6.0, 3.0);
    show_hudmessage(0, "%s a primit %d de HE !",name,HE);
   
    if(is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_T )
    {
        ColorChat(id, "^x01[^x04 %s^x01 ]^x03 Ai primit^x04 %d^x03 de^x04 HE !", PREFIX, HE);
       
        give_item(id, "weapon_hegrenade");
        cs_set_user_bpammo(id,CSW_HEGRENADE,HE);
    }
}


EpicMonkey 01-24-2013 16:43

Block suicide from he..
 
Did you try searching?

emaya93 01-24-2013 17:22

Re: Block suicide from he..
 
yes.. and i find this http://forums.alliedmods.net/showthread.php?t=170855 and this.. https://forums.alliedmods.net/showthread.php?t=164383 but i dont know how it work...

EpicMonkey 01-24-2013 18:16

Block suicide from he..
 
Create a variable and store the player who chooses the grenade option , hook hamtakedamage and check if the victim is the inflictor and if the victim is the player stored in the variable , if he is return ham_superece

Edit: i just went through the code u posted ...... Slow hacking? :3

ConnorMcLeod 01-25-2013 01:04

Re: Block suicide from he..
 
PHP Code:

// #define BLOCK_FALLDAMAGE

#include <amxmodx>
#include <engine>
#include <hamsandwich>

#define PLUGIN "No Suicide"
#define VERSION "0.0.1"

const DMG_HEGRENADE = (1<<24)

public 
plugin_init()
{
    
register_pluginPLUGINVERSION"ConnorMcLeod" )
    
RegisterHam(Ham_TakeDamage"player""OnCBasePlayer_TakeDamage")
}

public 
OnCBasePlayer_TakeDamageidiInflictoriAttackerFloat:flDamagebitsDamageType // return int
{
#if defined BLOCK_FALLDAMAGE
    
if(    bitsDamageType DMG_FALL
    
||    (bitsDamageType DMG_HEGRENADE && id == iAttacker)    )
#else
    
if( bitsDamageType DMG_HEGRENADE && id == iAttacker )
#endif
    
{
        
SetHamReturnInteger(0)
        return 
HAM_SUPERCEDE
    
}
    return 
HAM_IGNORED
}

public 
client_kill(id)
{
    return 
PLUGIN_HANDLED



emaya93 01-25-2013 08:15

Re: Block suicide from he..
 
thanks a lot, you are the man !!


All times are GMT -4. The time now is 20:36.

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