Raised This Month: $ Target: $400
 0% 

push 2D array to GlobalForward?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ProjectSky
AlliedModders Donor
Join Date: Aug 2020
Old 01-04-2023 , 05:19   push 2D array to GlobalForward?
Reply With Quote #1

idk how to implement it

PHP Code:
int[][] iTotalKillData = new int[MaxClients][8];
int iPlayerCount;
Call_StartForward(g_hForwardRoundPrint);
Call_PushArray(iTotalKillDataiPlayerCount); // error: only accept 1D array
Call_Finish(); 
ProjectSky is offline
McTavish
Senior Member
Join Date: May 2021
Old 01-04-2023 , 10:10   Re: push 2D array to GlobalForward?
Reply With Quote #2

Quote:
Originally Posted by ProjectSky View Post
idk how to implement it

PHP Code:
int[][] iTotalKillData = new int[MaxClients][8];
int iPlayerCount;
Call_StartForward(g_hForwardRoundPrint);
Call_PushArray(iTotalKillDataiPlayerCount); // error: only accept 1D array
Call_Finish(); 
I'm bad but I can help

In the code snippet you provided, it looks like you are trying to pass a 2D array (iTotalKillData) to a function that only accepts a 1D array. This is why you are getting the error message "only accept 1D array."

One way to fix this error is to flatten the 2D array into a 1D array before passing it to the function. Here's an example of how you can do that:

Code:
int[][] iTotalKillData = new int[MaxClients][8];
int[] flatArray = iTotalKillData.SelectMany(x => x).ToArray();
int iPlayerCount;
Call_StartForward(g_hForwardRoundPrint);
Call_PushArray(flatArray, iPlayerCount);
Call_Finish();
This code uses the SelectMany method to flatten the 2D array into a 1D array, which can then be passed to the function.
__________________
No Steam = No Support.

Last edited by McTavish; 01-04-2023 at 10:15.
McTavish is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 01-04-2023 , 10:47   Re: push 2D array to GlobalForward?
Reply With Quote #3

@McTavish, where you found or got SelectMany ??
__________________
Do not Private Message @me
Bacardi is offline
ProjectSky
AlliedModders Donor
Join Date: Aug 2020
Old 01-04-2023 , 19:51   Re: push 2D array to GlobalForward?
Reply With Quote #4

Quote:
Originally Posted by McTavish View Post
I'm bad but I can help

In the code snippet you provided, it looks like you are trying to pass a 2D array (iTotalKillData) to a function that only accepts a 1D array. This is why you are getting the error message "only accept 1D array."

One way to fix this error is to flatten the 2D array into a 1D array before passing it to the function. Here's an example of how you can do that:

Code:
int[][] iTotalKillData = new int[MaxClients][8];
int[] flatArray = iTotalKillData.SelectMany(x => x).ToArray();
int iPlayerCount;
Call_StartForward(g_hForwardRoundPrint);
Call_PushArray(flatArray, iPlayerCount);
Call_Finish();
This code uses the SelectMany method to flatten the 2D array into a 1D array, which can then be passed to the function.
answer from chatgpt?
ProjectSky is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 01-04-2023 , 19:56   Re: push 2D array to GlobalForward?
Reply With Quote #5

fucking hell

*edit
Call_Push(Array) accept any value.

What if you create adt_trie array, pass handle, but then you need delete after call.

I maybe could look that, but later. I format my PC

Last edited by Bacardi; 01-04-2023 at 20:06.
Bacardi 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 19:14.


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