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

semi godmode


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
l4ulwtlln
Member
Join Date: Aug 2007
Old 10-30-2007 , 21:37   semi godmode
Reply With Quote #1

is it possible to have a semi godmode? what i mean is that users cant take damage from weapons (ak, mp5, usp, he nade, knife, ect) but can take damage from falling from a high place, map damaging triggers, drowning, ect.
l4ulwtlln is offline
Wilson [29th ID]
Veteran Member
Join Date: Nov 2005
Location: London
Old 10-31-2007 , 04:39   Re: semi godmode
Reply With Quote #2

Check out how this plugin is operated. It hooks the shot then changes the hitbox to the head. You can simply change the hitbox to "none"

It won't affect high places or drowning or anything - just weapons. I'm not sure it will fix the knife for you though.
__________________

Day of Defeat AMXX Community

FakeMeta Research . Voice Proximity . Advanced Deploy . Technician
Wilson [29th ID] is offline
Send a message via ICQ to Wilson [29th ID] Send a message via AIM to Wilson [29th ID] Send a message via MSN to Wilson [29th ID] Send a message via Yahoo to Wilson [29th ID]
kp_uparrow
Penalized Member
Join Date: Jun 2006
Location: 192.168.0.1
Old 10-31-2007 , 16:19   Re: semi godmode
Reply With Quote #3

i say it will block knife attacks, because the endpoint can be modified to knife someone from far away
__________________
I USED A SECOND ACCOUNT TO DO MORE KARMA UPS AND DOWNS UNTIL GREENTRYST CAUGHT ME
kp_uparrow is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-31-2007 , 17:12   Re: semi godmode
Reply With Quote #4

You can use hamsandwich module to hook damage.
ConnorMcLeod is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 10-31-2007 , 18:38   Re: semi godmode
Reply With Quote #5

this should work fine:

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <fun>

new g_max_players

public plugin_init(){
    
register_plugin"NoWeaponDmg""1.0""Sylwester")
    
register_forward(FM_TraceLine"traceline")
    
register_forward(FM_TraceHull"tracehull"1)
    
register_event("Damage""damage_event""b""2!0")

    
g_max_players get_maxplayers()
}

//block bullets
public traceline(Float:v1[3], Float:v2[3], noMonsterspentToSkip){
    new 
iAttacker pentToSkip
    
new iVictim get_tr(TR_pHit)

    if ( 
iVictim >= && iVictim <= g_max_players && iAttacker >= && iAttacker <= g_max_players){
        
set_tr(TR_flFraction1.0)
        return 
FMRES_SUPERCEDE
    
}
    return 
FMRES_IGNORED
}

//block knife
public tracehull(Float:v1[3], Float:v2[3], noMonstershullNumberpentToSkip){
    new 
iAttacker pentToSkip
    
new iVictim get_tr(TR_pHit)

    if ( 
iVictim >= && iVictim <= g_max_players && iAttacker >= && iAttacker <= g_max_players){
        
set_tr(TR_flFraction1.0)
        return 
FMRES_SUPERCEDE
    
}
    return 
FMRES_IGNORED
}

//block HE grenades
public damage_event(id){
    if(
id || id g_max_players)
        return 
PLUGIN_CONTINUE
    
new weapon
    
new bodypart
    
new attacker get_user_attacker(idweaponbodypart)
    if(
attacker || attacker g_max_players)
        return 
PLUGIN_CONTINUE

    
new damage read_data(2)
    if(
weapon==4//grenade
        
set_user_health(idget_user_health (attacker) + damage)
    
    return 
PLUGIN_HANDLED

__________________
Impossible is Nothing
Sylwester is offline
l4ulwtlln
Member
Join Date: Aug 2007
Old 10-31-2007 , 23:14   Re: semi godmode
Reply With Quote #6

@Wilson [29th ID]
Will it work for CS?


@connorr
I'm not familiar with the hamsandwich module so this would be impossible for me to do alone.


@Sylwester
Thank! Bullet and Knife blocking works without a problem but the way u "block" nades doesn't. u set the players health back to what ever they had after they had already taken damage so that means if the user has 1 HP, and then got hit by a nade, they would die. anyway to avoid this?
l4ulwtlln is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-01-2007 , 06:32   Re: semi godmode
Reply With Quote #7

I'm not familiar either, but in this case, the use of ham looks like fakemeta.

Code:
#include <amxmodx> #include <fakemeta> #include <hamsandwich> new g_max_clients public plugin_init() {     register_plugin( "No Weapons Damage" , "0.1" , "connor" )     RegisterHam( Ham_TakeDamage , "player" , "player_TakeDamage" ) } public plugin_cfg() {     g_max_clients = global_get( glb_maxClients ) } public player_TakeDamage( this , idinflictor , idattacker , Float:damage , damagebits ) {     if( 1 <= idattacker <= g_max_clients )         return HAM_SUPERCEDE     return HAM_IGNORED }
ConnorMcLeod is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 11-01-2007 , 08:48   Re: semi godmode
Reply With Quote #8

I fixed problem with nades by giving player 256 more hp on "player spawn" and removing it if his hp drop under 256. Player will not see any difference on his HUD but spectators gonna see wrong amount of hp.
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <fun>

#define MAX_PLAYERS 32

new g_max_players
new bool:g_restart_attempt[MAX_PLAYERS 1]

public 
plugin_init(){
    
register_plugin"NoWeaponDmg""1.0""Sylwester")
    
register_forward(FM_TraceLine"traceline")
    
register_forward(FM_TraceHull"tracehull"1)
    
register_event("Damage""damage_event""b""2!0")

    
g_max_players get_maxplayers()
    
    
register_event("ResetHUD""event_hud_reset""be")
    
register_clcmd("fullupdate""clcmd_fullupdate"
    
register_event("TextMsg""event_restart_attempt""a""2=#Game_will_restart_in")
}


public 
traceline(Float:v1[3], Float:v2[3], noMonsterspentToSkip){
    new 
iAttacker pentToSkip
    
new iVictim get_tr(TR_pHit)

    if ( 
iVictim >= && iVictim <= g_max_players && iAttacker >= && iAttacker <= g_max_players){
        
set_tr(TR_flFraction1.0)
        return 
FMRES_SUPERCEDE
    
}
    return 
FMRES_IGNORED
}


public 
tracehull(Float:v1[3], Float:v2[3], noMonstershullNumberpentToSkip){
    new 
iAttacker pentToSkip
    
new iVictim get_tr(TR_pHit)

    if ( 
iVictim >= && iVictim <= g_max_players && iAttacker >= && iAttacker <= g_max_players){
        
set_tr(TR_flFraction1.0)
        return 
FMRES_SUPERCEDE
    
}
    return 
FMRES_IGNORED
}


public 
damage_event(id){
    if(
id || id g_max_players)
        return 
PLUGIN_CONTINUE
    
new weapon
    
new bodypart
    
new attacker get_user_attacker(idweaponbodypart)
    if(
attacker || attacker g_max_players)
        return 
PLUGIN_CONTINUE

    
new damage read_data(2)
    if(
weapon==4//grenade
        
set_user_health(idget_user_health (attacker) + damage)
    
    if(
get_user_health(id)<=256)
        
set_user_health(idget_user_health(id) - 256)
    return 
PLUGIN_HANDLED
}


public 
clcmd_fullupdate() {
    return 
PLUGIN_HANDLED_MAIN
}
 
public 
event_restart_attempt() {
    new 
players[32], num
    get_players
(playersnum"a")
    for (new 
inum; ++i)
        
g_restart_attempt[players[i]] = true
}   

public 
event_hud_reset(id) {
    if (
g_restart_attempt[id]) {
        
g_restart_attempt[id] = false
        
return
    } 
    
event_player_spawn(id)
}

public 
event_player_spawn(id) {
    
set_user_health(idget_user_health(id) + 256)

__________________
Impossible is Nothing

Last edited by Sylwester; 12-11-2007 at 18:24.
Sylwester is offline
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 11-01-2007 , 11:26   Re: semi godmode
Reply With Quote #9

Quote:
Originally Posted by connorr View Post
I'm not familiar either, but in this case, the use of ham looks like fakemeta.

Code:
#include <amxmodx> #include <fakemeta> #include <hamsandwich> new g_max_clients public plugin_init() {     register_plugin( "No Weapons Damage" , "0.1" , "connor" )     RegisterHam( Ham_TakeDamage , "player" , "player_TakeDamage" ) } public plugin_cfg() {     g_max_clients = global_get( glb_maxClients ) } public player_TakeDamage( this , idinflictor , idattacker , Float:damage , damagebits ) {     if( 1 <= idattacker <= g_max_clients )         return HAM_SUPERCEDE     return HAM_IGNORED }
Well I for one am fairly familiar with HS, and that looks to me like it should work fine.
I don't think you need to include FM though.

And might I say, that's a very sly way to do it - if it works it'd be morally wrong to use any other method.
purple_pixie is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-01-2007 , 13:48   Re: semi godmode
Reply With Quote #10

I've tested and it works fine.
FM needed for global_get, but get_maxplayers() could do the trick.

Last edited by ConnorMcLeod; 11-01-2007 at 13:50.
ConnorMcLeod 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 03:05.


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