About y_timers
#6

Quote:
Originally Posted by JessThompson
Посмотреть сообщение
To my knowledge I don't think you can stop tasks so you will need to convert it into a timer, I have done this below for ya'

Код:
/* Place this at the top of yo' script */
new Timer:AutoMoneyBag = {Timer:-1, ...}; 

/* Place this where you want the timer to start */ 

AutoMoneyBag = repeat autoMoneyBagTimer(); 

/* Replace this with your old function */

timer autoMoneyBagTimer[TIME HERE IN MS]() 
{ 
    if(Moneybagid != -1) 
    { 
        new MoneybagID = Moneybagid; 
        DestroyPickup(moneyBagInfo[MoneybagID][bagID]); 
        //DestroyDynamic3DTextLabel(moneyBagInfo[MoneybagID][bagLabel]); 
        Moneybagid = -1; 
        MessageAll(-1, "{cafca6}[Moneybag] {FFFFFF}Shit! The event has ended, no one found the Moneybag"); 
    } 
    else 
    { 
        new randomBag = random(MAX_BAG_LOCATIONS), world = moneyBagInfo[randomBag][bagWorld]; 
  
        moneyBagInfo[randomBag][bagID] = CreatePickup(1550, 23, moneyBagInfo[randomBag][bagXYZ][0], moneyBagInfo[randomBag][bagXYZ][1], moneyBagInfo[randomBag][bagXYZ][2], world); 
        //moneyBagInfo[randomBag][bagLabel] = CreateDynamic3DTextLabel("[Moneybag]", COLOR_YELLOW, moneyBagInfo[randomBag][bagXYZ][0], moneyBagInfo[randomBag][//bagXYZ][1], moneyBagInfo[randomBag][bagXYZ][2] - 0.1, 40.0, .worldid = 5, .interiorid = 13); 
        Moneybagid = randomBag;         
        MessageAll(-1, "{cafca6}[Moneybag] {FFFFFF} A Moneybag is hidden inside {FFDC2E}%s{FFFFFF}!", moneyBagInfo[randomBag][bagTitle]); 
    } 
} 

/* Place this where you want to stop said timer */ 

if(AutoMoneyBag!= Timer:-1) 
{ 
    stop AutoMoneyBag; 
    AutoMoneyBag= Timer:-1; 
} 
else 
{ 
    printf("The timer is already long gone!")
}
Thank you sir.
Reply


Messages In This Thread
About y_timers - by sams90 - 23.04.2017, 12:22
Re: About y_timers - by JessThompson - 24.04.2017, 06:33
Re: About y_timers - by JessThompson - 24.04.2017, 06:36
Re: About y_timers - by sams90 - 24.04.2017, 06:41
Re: About y_timers - by JessThompson - 24.04.2017, 06:49
Re: About y_timers - by sams90 - 24.04.2017, 07:07

Forum Jump:


Users browsing this thread: 1 Guest(s)