Raised This Month: $ Target: $400
 0% 

Optimizing Code


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Whitez
Member
Join Date: Apr 2016
Location: London, UK
Old 05-31-2016 , 14:04   Optimizing Code
Reply With Quote #1

Is there any better way to do this without using 3 set tasks?
Note each user has 3 personal channels

PHP Code:

new UserChannelUsed[33][3]

public 
FunctionCalled(id)
{
    if(!
UserChannelUsed[id][0])
    {
        
send message idchannel 0
        
        UserChannelUsed
[id][0] = true
        set_task
(1.5"reset-channel0"id
    }
    else if(!
UserChannelUsed[id][1])
    {
        
send message idchannel 1
        
        UserChannelUsed
[id][1] = true
        set_task
(1.5"reset-channel1"id
    }
    else if(!
UserChannelUsed[id][2])
    {
        
UserChannelUsed[id][2] = true
        send message id
channel 2
        set_task
(1.5"reset-channel2"id
    }
    else return
}

public 
reset-channel0(id)
{
    
UserChannelUsed[id][0] = false
}

public 
reset-channel1(id)
{
    
UserChannelUsed[id][1] = false
}

public 
reset-channel2(id)
{
    
UserChannelUsed[id][2] = false


Last edited by Whitez; 05-31-2016 at 14:07.
Whitez is offline
 



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 18:43.


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