Change String value on a native callback?
I'd like to change String value which is got from Native Parameters.
Example) native Example(client, String:strExample[], iMaxLength); new String:strExample[32]; Example(client, strExample, sizeof(strExample)); Like this, I want to make it if i call Example(), second params of Example() will store something not NULL_STRING. like, GetClientName(). and i found this; FormatNativeString() but i couldn't know how to use this. I tried to find the ways in many websites(such as Searching google, SourceMod-Wiki) but there were the ways just for VFormat in Native. |
Re: Change String value on a native callback?
Hello Starbish,
you basically have to call SetNativeString() after you set the string to write the string buffer back for the caller. There is an example in the wiki: http://wiki.alliedmods.net/Creating_...pting)#Strings The function FormatNativeString is a formatter function with printf syntax, that parses %s, %d formatters from variable arguments, but to change the string buffer you basically don't need it, except you want to have variable argument formatting support. It's described in the API Doc. |
Re: Change String value on a native callback?
Quote:
You answered exactly what i wanted ! I really appreciated with your answer and understanding my Bad English = ) REALLY THANK YOU!!!! |
Re: Change String value on a native callback?
The native has to expect that the string can be modified (i.e. Call_PushStringEx is declared with SM_PARAM_COPYBACK in its fourth argument).
|
Re: Change String value on a native callback?
Arrays can always be overwritten I think.
|
Re: Change String value on a native callback?
Quote:
The same argument is the fourth argument to Call_PushStringEx. |
Re: Change String value on a native callback?
Quote:
|
Re: Change String value on a native callback?
Quote:
|
All times are GMT -4. The time now is 13:10. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.