sourcepawn
sourcepawn copied to clipboard
Bad example in sm.alliedmods.net/new-api/
On this page, using NormalSHook https://sm.alliedmods.net/new-api/sdktools_sound/NormalSHook
function Action(int clients[], int& numClients, char sample[], int& entity, int& channel, float& volume, int& level, int& pitch, int& flags, char soundEntry[], int& seed)
Using these callback parameters, you get error when compile.
test.sp(6) : error 100: function prototypes do not match
test.sp(9) : error 159: brackets after variable name indicate a fixed-size array, but size could not be determined - either specify sizes, an array initializer, or use dynamic syntax (such as 'char[] x')
test.sp(9) : error 159: brackets after variable name indicate a fixed-size array, but size could not be determined - either specify sizes, an array initializer, or use dynamic syntax (such as 'char[] x')
test.sp(9) : error 159: brackets after variable name indicate a fixed-size array, but size could not be determined - either specify sizes, an array initializer, or use dynamic syntax (such as 'char[] x')
test.sp(9) : fatal error 190: too many error messages on one line
Need to look from file https://sm.alliedmods.net/new-api/sdktools_sound/__raw
And get right one:
function Action (int clients[MAXPLAYERS], int &numClients, char sample[PLATFORM_MAX_PATH],
int &entity, int &channel, float &volume, int &level, int &pitch, int &flags,
char soundEntry[PLATFORM_MAX_PATH], int &seed)
I missed your issue issue earlier this year about this, but the problem is the code that generates the API pages doesn't parse and show the array sizes (among other things, like default parameters). It's been a known issue for, uh, maybe years now. I'm going to close your other one and edit this one's title into one about the mis-parsing/displaying.
I've fixed a lot of the docgen issues in a fork of mine for https://sourcemod.dev: https://github.com/SlidyBat/sourcepawn/tree/enum-struct-docgen This issue is fixed in this commit: https://github.com/SlidyBat/sourcepawn/commit/23a0869726f76c4ccf47899bcdba81072ce095df Planning on PRing in some of those changes soon.
I have totally forget, I had made this issue before :D Sorry.