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

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


Post New Thread Reply   
 
Thread Tools Display Modes
eyal282
Veteran Member
Join Date: Aug 2011
Old 02-09-2017 , 16:26   Re: Anti Spawn Kill
Reply With Quote #21

Quote:
Originally Posted by HamletEagle View Post
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.
You mean start of round? I made it because I also want to allow deathmatch spawn.
eyal282 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 02-10-2017 , 06:55   Re: Anti Spawn Kill
Reply With Quote #22

Where do you see I said anything about round start? I said to start a task from plugin_init with flag b(so it never stops). Then, in that task use get_players to loop all players and do the same thing as you do now. The difference is that instead of 32 tasks, there will be only one.
Again, if you are not sure how to do that, I'll show you, even if it's just about moving a set_task to plugin_init and doing a loop.
__________________

Last edited by HamletEagle; 02-10-2017 at 06:56.
HamletEagle is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 02-10-2017 , 16:46   Re: Anti Spawn Kill
Reply With Quote #23

1. You should name the forwards properly, example HamBurger_Spawn should be something like fw_HamSpawn and HamBurger_Damage should be fw_HamTakeDamage for better readability.

2. Before removing a task make sure it exists, you never know.

3. In my opinion you should check for pev_valid == 2 first.
PHP Code:
id get_pdata_cbase(Weapon414); 
__________________

Last edited by edon1337; 02-15-2017 at 07:27.
edon1337 is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 02-12-2017 , 13:34   Re: Anti Spawn Kill
Reply With Quote #24

Quote:
Originally Posted by HamletEagle View Post
Where do you see I said anything about round start? I said to start a task from plugin_init with flag b(so it never stops). Then, in that task use get_players to loop all players and do the same thing as you do now. The difference is that instead of 32 tasks, there will be only one.
Again, if you are not sure how to do that, I'll show you, even if it's just about moving a set_task to plugin_init and doing a loop.
Okay now I'm confused. Could you show me?
eyal282 is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 02-14-2017 , 16:28   Re: Anti Spawn Kill
Reply With Quote #25

Quote:
Originally Posted by edon1337 View Post
1. You should name the forwards properly, example HamBurger_Spawn should be something like fw_HamSpawn and HamBurger_Damage should be fw_HamTakeDamage for better readability.

2. Before removing a task make sure it exists, you never know.
[/php]
1) As long as his prefixes are the same, it's okay for in my opinion. I can read it quiet well.

2) remove_task automaticly checks if a task exists, there's no need for an extra check. Would only be waste of cpu and unecessary checks.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 02-15-2017 , 07:28   Re: Anti Spawn Kill
Reply With Quote #26

Quote:
Originally Posted by Napoleon_be View Post
1) As long as his prefixes are the same, it's okay for in my opinion. I can read it quiet well.

2) remove_task automaticly checks if a task exists, there's no need for an extra check. Would only be waste of cpu and unecessary checks.
1. Eh
2. Oh, didn't know.
__________________
edon1337 is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 06-29-2017 , 09:59   Re: Anti Spawn Kill V1.1
Reply With Quote #27

I updated it to be better, hoping it will be approved.
eyal282 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-08-2017 , 11:42   Re: Anti Spawn Kill V1.2 (Updated 4/7/2017 )
Reply With Quote #28

Create the task in plugin_init, not in RoundStart. That way you no longer need to remove and create it each round.
If you wonder how to change the task time if you only set it in plugin init, it's easy. Check the cvar in the task public and if the value is different from the last value used call change_task native with new task time. Probably something like:
PHP Code:
new LastValue

public plugin_init()
{
    
cTimer register_cvar("amx_antisk_timer""5")
    
    
LastValue get_pcvar_num(cTimer)
    
set_task(1.0"ShowTimer"TASKID_SK,_,_,"a"Timer=LastValue+1)
}

public 
ShowTimer()
{
    new 
CurrentValue get_pcvar_num(cTimer)
    if(
LastValue != CurrentValue)
    {
        
change_task(TASKID_SKCurrentValue)
    }



PHP Code:
<= attacker <= 32 
Not all servers have 32 players. Either use get_maxplayers(but cache it and use that variable) or is_user_connected.

What's the point of using both TakeDamage and set_user_godmode? set_user_godmod is enough to block damage.

Do not create variables inside a loop, do it before.
In RemoveProtection use new instead of static.
I would like you to use real offset names, so people understand your code:
PHP Code:
const m_pPlayer 41
get_pdata_cbase
(Weaponm_pPlayer 4
__________________

Last edited by HamletEagle; 07-15-2017 at 08:19.
HamletEagle is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 07-10-2017 , 18:31   Re: Anti Spawn Kill V1.2 (Updated 4/7/2017 )
Reply With Quote #29

Quote:
Originally Posted by HamletEagle View Post
Create the task in plugin_init, not in RoundStart. That way you no longer need to remove and create it each round. If you wonder how to change the task time if you only set it in plugin init, it's easy. Check the cvar in the task public and if the value is different from the last value used call change_task native with new task time. Probably something like:
PHP Code:
new LastValue

public plugin_init()
{
    
cTimer register_cvar("amx_antisk_timer""5")
    
    
LastValue get_pcvar_num(cTimer)
    
set_task(1.0"ShowTimer"TASKID_SK,_,_,"a"Timer=LastValue+1)
}

public 
ShowTimer()
{
    new 
CurrentValue get_pcvar_num(cTimer)
    if(
LastValue != CurrentValue)
    {
        
change_task(TASKID_SKCurrentValue)
    }

PHP Code:
<= attacker <= 32 
Not all servers have 32 players. Either use get_maxplayers(but cache it and use that variable) or is_user_connected.

What's the point of using both TakeDamage and set_user_godmode? set_user_godmod is enough to block damage.

Do not create variables inside a loop, do it before.
In RemoveProtection use new instead of static.
I would like you to use real offset names, so people understand your code:
PHP Code:
const m_pPlayer 41
get_pdata_cbase
(Weaponm_pPlayer 4
A server needs to decide whether or not to block fall damage within spawn protection.

One question: can I change the task timer when it's time is over? Or should I use "b" flag? How does it work?

Last edited by eyal282; 07-10-2017 at 18:42.
eyal282 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-11-2017 , 12:42   Re: Anti Spawn Kill V1.2 (Updated 4/7/2017 )
Reply With Quote #30

Use flag b, then on cvar change just alter the time. I'm not sure to understand to what are you answering here:
Quote:
A server needs to decide whether or not to block fall damage within spawn protection.
__________________

Last edited by HamletEagle; 07-11-2017 at 12:42.
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 22:44.


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