Quote:
Originally Posted by nacknic
|
You have to save the .sma file as "UTF-8 without BOM" to get UTF-8 characters to work in plugins.
Quote:
Originally Posted by nacknic
thanks to your help, i success what i want to do:
in your script you do loop and print string/sub-strings like chars by usin %c in print coomand.
i added format() because i want really change to chars to read and exam char by char:
Code:
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "nacknic"
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say", "xmath")
}
public xmath(id)
{
new args[64], c[64];
read_args(args, charsmax(args));
remove_quotes(args);
new iLen = strlen(args);
for(new i; i < iLen; i++) {
format(c[i], charsmax(c), "%c", args[i]);
}
if(c[0] == '!' && c[1] == 'c') client_print(id, print_chat, "work");
else client_print(id, print_chat, "didn't works");
}
is there efficient way , read char and not format to char like i do ?
|
What are you trying to do? I don't know why you are using a loop with
format() to simply copy a string or, more importantly, why are you copying the string at all anyways? Just use
args directly. If you need to copy a string into a new variable use
copy(c, charsmax(c), args).
Also note that the second argument in
format() is not correct in your for loop. To do it properly, you'd need to use
charsmax(c) - i. This is probably not the most comprehendable for someone new to programming so I'd recommend using copy() as I stated above, removing the 'c' variable, or explain what you are actually trying to do.
__________________