Raised This Month: $32 Target: $400
 8% 

Anti Spawn Kill V1.5 (Updated 15/7/2017 )


Post New Thread Reply   
 
Thread Tools Display Modes
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 09-19-2016 , 11:18   Re: Anti Spawn Kill
Reply With Quote #11

why do you use client_PreThink to check weither player took damage or not? Couldn't this be done with Ham_TakeDamage?

I'm also not a fan of using godmode. The way i've been doing it is like this: (KEEP IN MIND THAT I COULDN'T TEST THIS YET)
PHP Code:
new Float:fSafeTime[33
PHP Code:
RegisterHam(Ham_Spawn"player""FwPlayerSpawnPost"1)
RegisterHam(Ham_TakeDamage"player""FwPlayerTakeDamagePre"0
PHP Code:
public FwPlayerSpawnPost(id) {
    if(!
get_pcvar_num(pCvarPlugin) || !get_pcvar_num(pCvarSpawnProtection)) {
        return 
HAM_SUPERCEDE
    
}
    
    new 
Float:fProtectTime get_pcvar_float(pCvarSpawnProtectionTime)
    
fSafeTime[id] = get_gametime() + fProtectTime
    
    
return HAM_IGNORED
}

public 
FwPlayerTakeDamagePre(idinflictorattackerFloat:damagedmgbits) {
    if(
get_pcvar_num(pCvarPlugin) &&  get_pcvar_num(pCvarSpawnProtection) && fSafeTime[id] >=  get_gametime()) {
        return 
HAM_SUPERCEDE
    
}
    
    return 
HAM_IGNORED

__________________

Last edited by Napoleon_be; 09-19-2016 at 11:18.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 09-20-2016 , 14:08   Re: Anti Spawn Kill
Reply With Quote #12

Nice plugin man, hamlet sleeping right now so you're lucky )

For sure you should just use godmode and remove takedamge .
__________________
Project: Among Us

Last edited by Craxor; 09-20-2016 at 14:10.
Craxor is offline
Send a message via ICQ to Craxor
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-21-2016 , 12:32   Re: Anti Spawn Kill
Reply With Quote #13

Quote:
I'm also not a fan of using godmode
Well, there is nothing wrong with using godmode and in fact, should be better. It sets takedamage to DAMAGE_NO. Inside CBasePlayer::TraceAttack there is a check for that field. If it's DAMAGE_NO, then TakeDamage won't be called, and this results in less code called internally. Both ways are ok, the difference is trivial.
__________________
HamletEagle is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 09-27-2016 , 15:51   Re: Anti Spawn Kill
Reply With Quote #14

Quote:
Originally Posted by Napoleon_be View Post
why do you use client_PreThink to check weither player took damage or not? Couldn't this be done with Ham_TakeDamage?

I'm also not a fan of using godmode. The way i've been doing it is like this: (KEEP IN MIND THAT I COULDN'T TEST THIS YET)
PHP Code:
new Float:fSafeTime[33
PHP Code:
RegisterHam(Ham_Spawn"player""FwPlayerSpawnPost"1)
RegisterHam(Ham_TakeDamage"player""FwPlayerTakeDamagePre"0
PHP Code:
public FwPlayerSpawnPost(id) {
    if(!
get_pcvar_num(pCvarPlugin) || !get_pcvar_num(pCvarSpawnProtection)) {
        return 
HAM_SUPERCEDE
    
}
    
    new 
Float:fProtectTime get_pcvar_float(pCvarSpawnProtectionTime)
    
fSafeTime[id] = get_gametime() + fProtectTime
    
    
return HAM_IGNORED
}

public 
FwPlayerTakeDamagePre(idinflictorattackerFloat:damagedmgbits) {
    if(
get_pcvar_num(pCvarPlugin) &&  get_pcvar_num(pCvarSpawnProtection) && fSafeTime[id] >=  get_gametime()) {
        return 
HAM_SUPERCEDE
    
}
    
    return 
HAM_IGNORED

I use it to remove ( if you even checked LOL ) the spawn protection if the player takes a shot ( I think I could've done it with Ham_Weapon_PrimaryAttack )
eyal282 is offline
1ka
Senior Member
Join Date: Jun 2012
Old 09-27-2016 , 16:33   Re: Anti Spawn Kill
Reply With Quote #15

lasermine damage? on spawn
__________________
Sorry for my bad english.

Last edited by 1ka; 09-27-2016 at 16:33.
1ka is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-07-2016 , 11:50   Re: Anti Spawn Kill
Reply With Quote #16

I've searched a bit and found no other plugin, so I'm okay with that. For approval:
1.In HamBurger_Spawn always check is_user_alive before doing anything.
2.In HamBurger_Damage firstly check if victim is still connected.
3.Remove client_PreThink for detecting IN_ATTACK and IN_ATTACK2 Switch to PrimaryAttack and SecondaryAttack with proper checks. If you want to be sure that player actually fired a bullet, go for FM_PlaybackEvent. But I think you are only interested if he press the button, so first way is good enough.
__________________
HamletEagle is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 10-07-2016 , 15:07   Re: Anti Spawn Kill
Reply With Quote #17

Quote:
Originally Posted by HamletEagle View Post
I've searched a bit and found no other plugin, so I'm okay with that. For approval:
1.In HamBurger_Spawn always check is_user_alive before doing anything.
2.In HamBurger_Damage firstly check if victim is still connected.
3.Remove client_PreThink for detecting IN_ATTACK and IN_ATTACK2 Switch to PrimaryAttack and SecondaryAttack with proper checks. If you want to be sure that player actually fired a bullet, go for FM_PlaybackEvent. But I think you are only interested if he press the button, so first way is good enough.
I also fixed a bug that allows players to shoot in the last second.
eyal282 is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 10-12-2016 , 18:17   Re: Anti Spawn Kill
Reply With Quote #18

Quote:
Originally Posted by HamletEagle View Post
I've searched a bit and found no other plugin, so I'm okay with that. For approval:
1.In HamBurger_Spawn always check is_user_alive before doing anything.
2.In HamBurger_Damage firstly check if victim is still connected.
3.Remove client_PreThink for detecting IN_ATTACK and IN_ATTACK2 Switch to PrimaryAttack and SecondaryAttack with proper checks. If you want to be sure that player actually fired a bullet, go for FM_PlaybackEvent. But I think you are only interested if he press the button, so first way is good enough.

@HamletEagle

When exactly will you approve? All are done.
eyal282 is offline
tousif
AlliedModders Donor
Join Date: Nov 2014
Location: India
Old 10-14-2016 , 12:22   Re: Anti Spawn Kill
Reply With Quote #19

Quote:
Originally Posted by eyal282 View Post
@HamletEagle

When exactly will you approve? All are done.
When he gets time he will review the changes and if nothing more is left to modify then he may approve .

Last edited by tousif; 10-14-2016 at 12:23.
tousif is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 01-08-2017 , 09:57   Re: Anti Spawn Kill
Reply With Quote #20

It will be better to create only one task in plugin_init and loop all players inside it, than having 32 tasks at the same time. If you are not sure how to do that I'll show you.

Edit: Unapproved until you make the changes.
__________________

Last edited by HamletEagle; 01-11-2017 at 10:11.
HamletEagle 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 20:17.


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