Raised This Month: $ Target: $400
 0% 

Solved [ H3LP ] 2d dynamic array


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 06-27-2018 , 16:28   [ H3LP ] 2d dynamic array
Reply With Quote #1

Hello, is there any way to pass 2d array through native?

Example:
Code:
new const g_szClassWeapons[][] = { "Weapon 1", "Weapon 2", "Weapon 3" }; public test() {     native_test(g_szClassWeapons, sizeof g_szClassWeapons); } ... public _native_test(iPluginId, iParamsCount) {     new szWeapon[][];     new iArraySize = get_param(2);     get_array(1, szWeapon, iArraySize);     for (new i = 0; i < iArraySize; i++)         server_print("Weapon[%d] = %s", i, szWeapon[i]); }
__________________









Last edited by CrazY.; 06-27-2018 at 18:28.
CrazY. is offline
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 06-27-2018 , 16:46   Re: [ H3LP ] 2d dynamic array
Reply With Quote #2

What is this? code is splitted into 2 sections where first is another plugin and second is another? if not then this wont work.

PluginID & NumParams are parameters for register_native [Style = 0]

PS: new szWeapon[][]; << huh? (this is uninitalized, how compiler must set excact size of dimensions for that variable)
__________________

[MOD] CS Weapon Mod V1.7.1
[MM] MetaMod-C V1.0
[MOD] CS NPC Mod (5%)


Probably Left AM

Last edited by Ghosted; 06-27-2018 at 16:50.
Ghosted is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 06-27-2018 , 16:50   Re: [ H3LP ] 2d dynamic array
Reply With Quote #3

It's just a example.
__________________








CrazY. is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 06-27-2018 , 17:38   Re: [ H3LP ] 2d dynamic array
Reply With Quote #4

Quote:
Originally Posted by CrazY. View Post
It's just a example.
Use dynamic arrays and return the array id using a native.

When you want to retrieve something simply call arraygetstring depends on array type.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 06-27-2018 , 18:28   Re: [ H3LP ] 2d dynamic array
Reply With Quote #5

I've solved this with bit-fields, not with array precisely.
__________________








CrazY. is offline
Reply



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 12:24.


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