AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   ... (https://forums.alliedmods.net/showthread.php?t=334330)

Cristian505 09-16-2021 06:17

...
 
...

HamletEagle 09-16-2021 07:28

Re: ArrayGetString2
 
Firstly, do not post code screenshots. Copy and paste the actual code.
Secondly, why in the world are you using style 1 natives? They are deprecated and should never be used. Notice the big red warning: http://amxmodx.org/api/amxmodx/param_convert.
I already told you to use get_string in your previous topic. Why did you completely ignore this and made a new topic? If you needed further help with get_string you should have posted in the original topic.

Cristian505 09-16-2021 07:52

Re: ArrayGetString2
 
...

hitD 09-16-2021 08:39

Re: ArrayGetString2
 
Stick to the old thread, second it should work, instead of using 1 style native switch to 0. Also you should read carefully API method as it clarify you.
If you can't do that here is the answer why it doesn't work. As in your image, it shows that you tried to use get_string with style 1.
"If used outside of a native callback, or the native was
created with style 1, an error will be thrown."

Also your get_string parameters are wrong.

HamletEagle 09-16-2021 08:48

Re: ArrayGetString2
 
Quote:

Originally Posted by Cristian505 (Post 2757910)
get_string() no work lol

No, it works, you just failed to use it. Show what you tried.

Cristian505 09-16-2021 10:09

Re: ArrayGetString2
 
...

Cristian505 09-16-2021 10:53

Re: ArrayGetString2
 
...

HamletEagle 09-16-2021 11:04

Re: ArrayGetString2
 
Code:

native get_string(param, dest[], maxlen)
param
Argument to retrieve, starting from 1

Why are you passing a dynamic array in there, how is that supposed to work? You have to pass a number corresponding to the index of the parameter you want to retrieve.

If you have a native like: native example(strParam[], anotherStrParam[]) then you would pass 1 to retrieve the value of strParam and 2 to retrieve the value of anotherStrParam.

Tag mismatch is not an error, it is a warning that happens when 2 tags do not match. For example, your ZombieName is a dynamic array tagged as "Array:" while the native does not expect such a tag for the first parameter("param" is not tagged).

Cristian505 09-16-2021 11:22

Re: ArrayGetString2
 
...

HamletEagle 09-16-2021 14:03

Re: ArrayGetString2
 
For the last time, SHOW WHAT YOU TRIED. Show the code. I can't read your mind and see what mistake you made.

You literally just have to call get_param(1, stringVar, charsmax(stringVar)) and then stringVar will contain the string which you can then add inside the array using ArrayPushString.


All times are GMT -4. The time now is 17:02.

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