Two Dimensional Array
Code:
new g_playername[33][33]do i need to use two dimensional array? :S |
Re: Two Dimensional Array
You could pass the name to task.
PHP Code:
PHP Code:
|
Re: Two Dimensional Array
Quote:
|
Re: Two Dimensional Array
Or just get the name only when you need it. Also, use set_user_info(id, "name", namvarhere). Also, your code makes no sense.
|
Re: Two Dimensional Array
Can i pass 2 arguments in set_task and how?
fysiks it's poor example and not fully written, just a part xD what if name changes while doing the function? i need to restore it. |
Re: Two Dimensional Array
Yes, you can pack as much data as you need in the array.
new iData[ 35 ]; iData[ 0 ] = 55; //random integer iData[ 1 ] = 99; //random integer get_user_name( id , iData[ 2 ] , charsmax( iData ) - 2 ); You can also do multiple strings but you need to space them properly in the array so they can be retrieved in the called function. That's just an example, if you can't figure it out show exactly what data you want passed to the function. Edit: If you are worried about data changing between when set_task() is called and the task function you should just use global arrays or monitor the change and remove_task() then set_task() with corrected data. |
Re: Two Dimensional Array
Quote:
Only way is to pass it with the task, or use global array. I can use global array, but like in the case i posted above, it need's to be two dimensional (or does it?), and i think that is wasting of resource, for such a task. edit: by the way thanks everyone for helping :) |
Re: Two Dimensional Array
Your first code looks ok (youre already using a 2d array), should be charsmax( g_playername[] ) though.
You will need to hook name changes and update g_playername[] if name gets changed or just get name in the task function. |
Re: Two Dimensional Array
Quote:
|
| All times are GMT -4. The time now is 19:39. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.