Raised This Month: $ Target: $400
 0% 

Solved [edit] no kill zones to heal zones


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Meelo
Member
Join Date: Aug 2010
Old 06-09-2019 , 12:14   [edit] no kill zones to heal zones
Reply With Quote #1

Hello, im trying to edit this plugin but there is a problem i can't solve.. so i need to create zone and if someone enter in, it will heal him for 'x' hp.

i did change public player_damage and player_traceattack from original to:

Code:
public dmg()
{
	for(new i; i<g_iZonesNum; i++)
	{
		if(is_user_in_zone(i,i))
		{

			set_user_health((i),get_user_health(i)+5) 

		}
	}
}
and in plugin_init
set_task(1.0, "dmg", .flags="b")

the problem is - it works only for the first player on the map who will enter into created zone, i can't solve it by myself :/
Attached Files
File Type: sma Get Plugin or Get Source (nkzpl.sma - 198 views - 11.1 KB)
File Type: sma Get Plugin or Get Source (nkzpl_edit.sma - 174 views - 11.1 KB)

Last edited by Meelo; 06-09-2019 at 17:33.
Meelo is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 06-09-2019 , 12:25   Re: [edit] no kill zones to heal zones
Reply With Quote #2

i is a zone index, not a player index. I assume there's only one zone, so that's why it works only for the first player, because zone 0 = player 0, they have the same indexes.

You need to loop all players in addition to the zones loop, or assign a different task for each player or each zone, then do only one loop inside the function.
__________________

Last edited by OciXCrom; 06-09-2019 at 12:26.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Meelo
Member
Join Date: Aug 2010
Old 06-09-2019 , 13:53   Re: [edit] no kill zones to heal zones
Reply With Quote #3

thanks, it's fine now
Meelo is offline
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 17:15.


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