Raised This Month: $ Target: $400
 0% 

Variable life time?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Flasher
Senior Member
Join Date: Apr 2008
Old 02-16-2009 , 19:11   Variable life time?
Reply With Quote #1

Hi. I have a question.
What is a variable life time?
For this case:
PHP Code:
public client_putinserver(plrid)
{
    new 
param[1];
    
param[0] = plrid;
    
set_task(30.0"showInfo"BASE_TASK_ID plridparam1);
    return 
PLUGIN_CONTINUE;
}

public 
showInfo(param[])
{
    new 
plrid param[0];
    
//....

How long this task can be delayed to function to get an alive variable? For me this is working, but I doesn't know can I depend on this or not.
Or this is a bad code practise?
Because here: http://www.amxmodx.org/funcwiki.php?go=func&id=253
phatency wrote:
PHP Code:
new args[1]; 
public 
test1(id

    
args[0] = id
    
set_task(60.0,"MyFunction",0,args,1,"a",5); 


//args is defined outside function 
//because it might get deleted before MyFunction is called, 
//if it were defined inside test1. 
Flasher 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 17:04.


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