Raised This Month: $ Target: $400
 0% 

remove task with get_gametime


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MiloSx7
Member
Join Date: Oct 2011
Location: Serbia, Nish
Old 05-25-2013 , 06:49   Re: remove task with get_gametime
Reply With Quote #1

I'm struggling and i can't seem to make it. I've been trying something like this:

PHP Code:
new Float:gametime[33]

gametime[id] = get_gametime() //When a player buys a potion 
and then I've checked like millions of combinations, but nothing seems to work...
PHP Code:
if(get_gametime() > gametime 20.0)
if(
get_gametime() < gametime 20.0)
if(
gametime get_gametime() + 20.0)
//And so on... 
Either the potion never stops working, or it just stops the same second as i buy it...

And when i to do the check as you told me
PHP Code:
public MinorPot(id)
{
    
id -= 15031
    
    
if(gametime[id] - 20.0 get_gametime())
    {
        
set_user_health(idget_user_health(id) + 1)
        
set_task(0.2"MinorPot"id 15031)
    }

This also never stops working. But I've done the math well. If gametime[id] was 2:40 and - 20.0 will make it 2:20, so basically its going to check and should stop for 20 seconds, when gametime[id] and get_gametime is 2:20, and stops working completely after get_gametime goes under 2:20. But the problem is its going to work forever, even after the round ends, until the map is changed...

I'm going to keep trying various combinations until someone answers back with a solution, or when i actually make it by myself

Thanks guys
__________________
MiloS

Last edited by MiloSx7; 05-25-2013 at 07:24.
MiloSx7 is offline
Send a message via MSN to MiloSx7
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-25-2013 , 07:48   Re: remove task with get_gametime
Reply With Quote #2

Just use flag "a" (repeat) and set repeat time to 100 (or 99, i always forget which one) :

PHP Code:
const TASK_PLAYER_HEAL 15031;

HealPlayerid )
{
    
set_task(0.2"MinorPot"id TASK_PLAYER_HEAL__"a"100);
}

public 
MinorPotid )
{
    
id -= TASK_PLAYER_HEAL;
    if( 
is_user_alive(id) )
    {
        
set_user_health(idget_user_health(id) + 1);
    }

__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 16:19.


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