Raised This Month: $ Target: $400
 0% 

Set Task not working correctly


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
tm.
Member
Join Date: Apr 2010
Old 07-13-2010 , 03:08   Re: Set Task not working correctly
Reply With Quote #4

This should do what you've asked:
PHP Code:
#include <amxmodx>

new bool:g_AllowLoto[33];

public 
plugin_init()
{
    
register_plugin("Stuff""1.0""vL.");
}

public 
client_putinserver(id
{
    
set_task(600.0"AllowLoto"id);
}

public 
AllowLoto(id)
{
    
g_AllowLoto[id] = true;
}

public 
client_disconnect(id)
{
    
g_AllowLoto[id] = false;
    
remove_task(id);
}

public 
the_loto_thing(id)
{
    if(!
g_AllowLoto[id])
        return 
PLUGIN_HANDLED;
    
    
// your code
    
    
g_AllowLoto[id] = false;
    
set_task(600.0"AllowLoto"id);
    
    return 
PLUGIN_CONTINUE;

It's a bit redundant how you did it. The task set in plugin_init will not do anything because you don't have an id to use in plugin_init. And why do you need to know when the player spawns? Maybe I'm missing something.
tm. 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 07:14.


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