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

[HELP] Set_Task question


Post New Thread Reply   
 
Thread Tools Display Modes
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 02-11-2016 , 00:51   Re: [HELP] Set_Task question
Reply With Quote #11

i think its better to use aray counter than to create another 32 tasks (if all players use command).

Last edited by siriusmd99; 02-11-2016 at 00:51.
siriusmd99 is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 02-12-2016 , 10:13   Re: [HELP] Set_Task question
Reply With Quote #12

Yep, you are right

I have one more question

How do i remove this task?
PHP Code:
set_task(3.0"lighting_task"___"b"
__________________
Depresie is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 02-12-2016 , 11:04   Re: [HELP] Set_Task question
Reply With Quote #13

With remove_task(), but you have to assign it a unique ID first (3rd argument).
klippy is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 02-12-2016 , 11:08   Re: [HELP] Set_Task question
Reply With Quote #14

set_task(3.0, "lighting_task", _, _, TASK_LIGHT, "b")

?

like this?
__________________

Last edited by Depresie; 02-12-2016 at 11:08.
Depresie is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 02-12-2016 , 11:33   Re: [HELP] Set_Task question
Reply With Quote #15

http://amxmodx.org/api/amxmodx/set_task

I told you 3rd, not 5th. Like so:
PHP Code:
set_task(3.0, ,"lighting_task"TASK_LIGHT__"b"); 
To remove that task, just use
PHP Code:
remove_task(TASK_LIGHT); 

Last edited by klippy; 02-12-2016 at 11:33.
klippy is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 02-12-2016 , 12:32   Re: [HELP] Set_Task question
Reply With Quote #16

yeah, figured that out thx
__________________
Depresie is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-12-2016 , 18:31   Re: [HELP] Set_Task question
Reply With Quote #17

You can also specify the parameter directly instead of using placeholders.

PHP Code:
set_task(3.0, ,"lighting_task"TASK_LIGHT__"b"); 

set_task(3.0, ,"lighting_task"TASK_LIGHT, .flags="b"); 
And if you are creating this task on individual players, add their id to the task id. You then need to subtract the task id to get the player id in the called function. It looks like you have that part figured out.

You do not need to use task_exists() before calling remove_task(). You should only use that if you want to know if the task exists for some reason.
__________________

Last edited by Bugsy; 02-12-2016 at 18:36.
Bugsy is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 02-12-2016 , 18:39   Re: [HELP] Set_Task question
Reply With Quote #18

Quote:
Originally Posted by Bugsy View Post
And if you are creating this task on individual players, add their id to the task id. You then need to subtract the task id to get the player id in the called function. It looks like you have that part figured out.
I must add something to that: make sure your per-player task IDs are spaced out by at least 32, like so:
PHP Code:
#define FIRST_PLAYER_TASK 640
#define SECOND_PLAYER_TASK 672
#define THIRD_PLAYER_TASK 704
// ... 
so when adding player ID to it, you don't interfere with other tasks' "ID range".
klippy is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-12-2016 , 19:49   Re: [HELP] Set_Task question
Reply With Quote #19

To not confuse him, KliPPy means having a 32 increment buffer between task-ids that are for a different purpose, not a separate task id for player1, player2, etc. Your naming could be taken the wrong way 'FIRST_PLAYER_', 'SECOND_PLAYER_'...

So along the lines of what he posted:
PHP Code:
#define TASK_SETFIRE 640
#define TASK_SETNOCLIP 672
#define TASK_WELCOMEMSG 704 
__________________

Last edited by Bugsy; 02-12-2016 at 19:49.
Bugsy is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 02-12-2016 , 20:20   Re: [HELP] Set_Task question
Reply With Quote #20

It is a global task, not per player
I know how to get them right per player, i've been reading around your posts bugs, they helped me alot ^_^

Thanks Kippy about the task tip, i understood your point, very nice, i bet many people are doing that mistake..
__________________
Depresie 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 07:43.


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