Raised This Month: $51 Target: $400
 12% 

Solved [ H3LP ] 3d 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 , 11:12   [ H3LP ] 3d dynamic array
Reply With Quote #1

Hello, I'm getting some trouble with 3d arrays. This is the code I'm using:

Code:
enum _:eKnifeSounds {     SND_KNIFE_DEPLOY = 0,     SND_KNIFE_DEPLOY1,     SND_KNIFE_HIT1,     SND_KNIFE_HIT2,     SND_KNIFE_HIT3,     SND_KNIFE_HIT4,     SND_KNIFE_WALL1,     SND_KNIFE_WALL2,     SND_KNIFE_SLASH1,     SND_KNIFE_SLASH2,     SND_KNIFE_STAB, }; new const g_szKnivesSounds[][eKnifeSounds][] = {     { "boxing_deploy1", "boxing_deploy1", "boxing_hit1", "boxing_hit2", "boxing_hit3", "boxing_hit4",     "boxing_hitwall1", "boxing_hitwall1", "boxing_slash1", "boxing_slash2", "boxing_stab" } }

Output:
Code:
sound/weapons/oy1.wav
sound/weapons/.wav
sound/weapons/all1.wav
sound/weapons/h1.wav
sound/weapons/h2.wav
__________________









Last edited by CrazY.; 06-27-2018 at 20:41.
CrazY. is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 06-27-2018 , 11:36   Re: [ H3LP ] 3d dynamic array
Reply With Quote #2

And what is the problem? This?
Code:
sound/weapons/oy1.wav
sound/weapons/.wav
sound/weapons/all1.wav sound/weapons/h1.wav sound/weapons/h2.wav
__________________

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

What I expected was:

Code:
sound/weapons/boxing_deploy1
sound/weapons/boxing_deploy1
sound/weapons/boxing_hit1
sound/weapons/boxing_hit2
sound/weapons/boxing_hit3
sound/weapons/boxing_hit4
sound/weapons/boxing_hitwall1
sound/weapons/boxing_hitwall2
sound/weapons/boxing_slash1
sound/weapons/boxing_slash2
sound/weapons/boxing_stab
__________________









Last edited by CrazY.; 06-27-2018 at 11:58.
CrazY. is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-27-2018 , 12:01   Re: [ H3LP ] 3d dynamic array
Reply With Quote #4

You only need a 2d
new g_szKnivesSounds[eKnifeSounds][]
__________________
Bugsy is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 06-27-2018 , 12:08   Re: [ H3LP ] 3d dynamic array
Reply With Quote #5

I believe I need 3d. Here's how I'm using:

Code:
enum _:eKnife {     KNIFE_NAME[32],     KNIFE_SOUND, }; enum _:eKnifeSounds {     SND_KNIFE_DEPLOY = 0,     SND_KNIFE_DEPLOY1,     SND_KNIFE_HIT1,     SND_KNIFE_HIT2,     SND_KNIFE_HIT3,     SND_KNIFE_HIT4,     SND_KNIFE_WALL1,     SND_KNIFE_WALL2,     SND_KNIFE_SLASH1,     SND_KNIFE_SLASH2,     SND_KNIFE_STAB, }; // -1, emit default CS knife sounds new const g_rgKnives[][eKnife] = {     { "Default Knife", -1 },     { "Boxing Gloves", 0 // g_szKnivesSounds[0][eKnifeSounds] },     { "Example", 1 // g_szKnivesSounds[1][eKnifeSounds] } }; new const g_szKnivesSounds[][eKnifeSounds][] = {     { "boxing_deploy1", "boxing_deploy1", "boxing_hit1", "boxing_hit2", "boxing_hit3", "boxing_hit4",     "boxing_hitwall1", "boxing_hitwall1", "boxing_slash1", "boxing_slash2", "boxing_stab" },         { "example_deploy1", "example_deploy1", "example_hit1", "example_hit2", "example_hit3", "example_hit4",     "example_hitwall1", "example_hitwall1", "example_slash1", "example_slash2", "example_stab" } }
__________________









Last edited by CrazY.; 06-27-2018 at 12:20.
CrazY. is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 06-27-2018 , 12:14   Re: [ H3LP ] 3d dynamic array
Reply With Quote #6

Show part of the code where KNIFE_SOUND is used and how you output
__________________
edon1337 is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 06-27-2018 , 12:17   Re: [ H3LP ] 3d dynamic array
Reply With Quote #7

Code:
for (new i = 0; i < sizeof g_szKnivesSounds; i++) {     for (new s = SND_KNIFE_DEPLOY; s <= SND_KNIFE_STAB; s++)     {         formatex(szSound, charsmax(szSound), "weapons/%s.wav", g_szKnivesSounds[i][s]);         server_print("g_szKnivesSounds[%d][%d] = %s", i, s, szSound);         //precache_sound(szSound);     } }

Spoiler
__________________









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

I Think At

Code:
formatex(szSound, charsmax(szSound), "weapons/%s.wav", g_szKnivesSounds[g_rgKnives[iKnifeId][KNIFE_SOUND]][iSoundId])
This:

Code:
g_szKnivesSounds[g_rgKnives[iKnifeId][KNIFE_SOUND]][iSoundId]
Should Be:

Code:
g_szKnivesSounds[iKnifeId][iSoundId]
(If not then please paste full source code :_ )
__________________

[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 12:25.
Ghosted is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 06-27-2018 , 12:27   Re: [ H3LP ] 3d dynamic array
Reply With Quote #9

The problem is not in emit sound, the problem is in 3d array. g_rgKnives[iKnifeId][KNIFE_SOUND] is nothing more than the sound index that I set in g_rgKnives.
__________________








CrazY. is offline
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 06-27-2018 , 12:32   Re: [ H3LP ] 3d dynamic array
Reply With Quote #10

Quote:
Originally Posted by CrazY. View Post
The problem is not in emit sound, the problem is in 3d array. g_rgKnives[iKnifeId][KNIFE_SOUND] is nothing more than the sound index that I set in g_rgKnives.
Can you post full source code?
__________________

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


Probably Left AM
Ghosted 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 05:56.


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