Raised This Month: $ Target: $400
 0% 

Float array into integer array


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-04-2007 , 16:13   Re: Float array into integer array
Reply With Quote #7

I would do with an enum(), I think.

Code:
    enum t_TaskTest     {         Float:fValue1,         iValue2,         String     };             new g_Params[ t_TaskTest ];     function( id )     {         g_Params[ fValue1 ] = _:14.25;         g_Params[ iValue2 ] = 10;         g_Params[ String  ] = EncodeText( "Hello word!" );         set_task( 1.0, "TestTask", id, g_Params, t_TaskTest );     }         public TestTask( g_Params[] )     {         static sText[16];         DecodeText( g_Params[ String ], sText, charsmax( sText ) );                 log_amx( "fValue = %.2f | iValue = %i | String = %s", g_Params[ fValue1 ], g_Params[ iValue2 ], sText );     }     EncodeText( const text[] )     {         return engfunc( EngFunc_AllocString, text )     }     DecodeText( const text, string[], const length )     {         global_get( glb_pStringBase, text, string,  length )     }

And it returns :
Code:
[Untitled.amxx] fValue = 14.25 | iValue = 10 | String = Hello word!
It requires fakemeta if you planned to use with string.
__________________

Last edited by Arkshine; 12-04-2007 at 16:16.
Arkshine 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 11:10.


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