You can pack anything into an array and pass it to a function via set_task as long as you keep the data organized so it can be retrieved in the called function. The easiest way to do this is with an enum to create a 'hacked' structure. Also make sure your called function has parameters in the correct order; the data/array is first then task-id.
PHP Code:
#include <amxmodx>
#include <amxmisc>
//You can include anything including integers, strings, arrays, floats
enum _:TaskData
{
PlayerIndex,
PlayerName[ 33 ],
SteamID[ 35 ],
Health,
Float:Whatever,
ArrayNumbers[ 3 ]
}
public plugin_init()
{
register_plugin( "Set_task Example" , "0.1" , "bugsy" );
register_clcmd( "say test" , "CmdTask" );
}
public CmdTask( id )
{
new tdData[ TaskData ];
tdData[ PlayerIndex ] = id;
get_user_name( id , tdData[ PlayerName ] , charsmax( tdData[ PlayerName ] ) );
get_user_authid( id , tdData[ SteamID ] , charsmax( tdData[ SteamID ] ) );
tdData[ Health ] = get_user_health( id );
tdData[ Whatever ] = _:55.25;
tdData[ ArrayNumbers ][ 0 ] = 12;
tdData[ ArrayNumbers ][ 1 ] = 34;
tdData[ ArrayNumbers ][ 2 ] = 56;
set_task( 1.0 , "YourFunc" , 12345 , tdData , sizeof( tdData ) );
}
public YourFunc( tdIncoming[ TaskData ] , iTaskID )
{
server_print( "TaskID=%d ^"%d^" ^"%s^" ^"%s^" ^"%d^" ^"%f^" [%d,%d,%d]" , iTaskID , tdIncoming[ PlayerIndex ] ,
tdIncoming[ PlayerName ] ,
tdIncoming[ SteamID ] ,
tdIncoming[ Health ] ,
tdIncoming[ Whatever ] ,
tdIncoming[ ArrayNumbers ][ 0 ] ,
tdIncoming[ ArrayNumbers ][ 1 ] ,
tdIncoming[ ArrayNumbers ][ 2 ] );
}
Code:
TaskID=12345 "1" "bugsy" "STEAM_0:0:123456" "100" "55.250000" [12,34,56]
__________________