Thanks Vet and Bugsy!
Quote:
Originally Posted by Vet
In the example you cited, I'd assume the author was referring the the value of the variable being deleted rather than the variable itself.
|
Variable discussed is an array and if it is destroyed, I think value should be lost.
Quote:
Originally Posted by Vet
In your code, you don't really need to sent a parameter. You could simplely obtain the plrid again by subtracting out the BASE_TASK_ID
|
Thanks, I thinked about such way as a backup.
Quote:
Originally Posted by Vet
Typically, the scope of a variable is only as wide as the routine its defined in. Thus, the life of your variables is only valid as long as each routine is executing. As soon as the sub/function is exited, the variables are released. A variable defined globally (not within a sub/function, like args in the second example)), lives and is visible throughout the entire plugin.
|
Quote:
Originally Posted by Bugsy
The variable will be passed without issue
|
So can we came to one opinion about variable lifetime?
Quote:
Originally Posted by Bugsy
but you need to do additional checking in showinfo to confirm the player is still connected after 30 seconds.
ie.
- id 21 connects
- set_task called with id 21 as a param
- 10 seconds later id 21 disconnects
- 20 seconds later, showInfo(21) gets called from set_task but player no longer connected. any functions called on id 21 will error without first checking is_user_connected()
|
Thanks for this valuable notice.
BTW If we have
PHP Code:
public client_disconnect(plrid)
{
remove_task(BASE_TASK_ID + plrid);
return PLUGIN_CONTINUE;
}
will this be enough to skip checking is_user_connected()?