Help set_task
Hello
it looks like set_task ignores a delay or idk.. code: Code:
plugin_init()Code:
public zaciatok_kola(id)Code:
public Task_HPRegenLoop(id) |
Re: Help set_task
1. set_task() expects a float for the interval, use 2.0 instead of 2.
2. What is the value of g_item_sti[]? 3. Add an is_user_alive() check before executing the set_task() calls in zaciatok_kola(). 4. You can reduce code (which also fixes a player potentially getting over MaxHP[] in the first if-statement if a player has MaxHP[]-1 hp and then it adds [addhealths]): Replace PHP Code:
PHP Code:
|
Re: Help set_task
Quote:
g_item_sti[id] is bool, item in game from shop and it checks if it is bought or not Thanks for reply, gonna test it |
Re: Help set_task
The first function, task_hpregenloop , is doing wierd things, it adds hp twice and then wait for 2 second..
so itīs like set_user_health(id, get_user_health(id) + 5) set_user_health(id, get_user_health(id) + 5) wait(2sec) set_user_health(id, get_user_health(id) + 5) set_user_health(id, get_user_health(id) + 5) wait(2sec) ... :D |
Re: Help set_task
[SOLVED] Just added if(is_user_alive(id) like you said and it works thanks
|
Re: [SOLVED]Help set_task
Sorry for spam, but it doesnt work again, it worked for a while and now again same problem :/
|
Re: Help set_task
Its hard to troubleshoot code without having the full code. Based on what you provided, my suggestions should have fixed the issue.
Another suggestion, use the same function and call set_task() only once. PHP Code:
|
Re: Help set_task
I think i found a problem, it works only if i am alone on the server, when we are2, it goes twice faster and if 3 then 3 times faster :D
|
Re: Help set_task
It's because you're not removing the task when the client disconnects, so the same task is assigned to the same client id and is executed multiple times. Another reason can be that you're using 0 as the client index.
|
Re: Help set_task
Code:
public Task_HPRegenLoop ( id )you can try first to check g_item_reg[id] and user alive then store team and hp then make switch. |
| All times are GMT -4. The time now is 07:34. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.