Question of the function SendMes
The websites associated with the SAMP opinion goes, they say, this function (see code) sometimes leads to paint server.
Like, if you use the format, and SCM(SendClientMessage) then everything will fire.
Is it possible to do so, so as not to saw the entire code under the format, and SCM (because too many of them), but just something to replace it?
CODE:
PHP код:
``` #define BYTES_PER_CELL (cellbits / 8) stock SendMes(playerid, color, fstring[], {Float, _}:...) { static const STATIC_ARGS = 3; new n = (numargs() - STATIC_ARGS) * BYTES_PER_CELL; if (n) { new message[128], arg_start, arg_end; #emit CONST.alt  fstring #emit LCTRL              5 #emit ADD #emit STOR.S.pri         arg_start #emit LOAD.S.alt         n #emit ADD #emit STOR.S.pri         arg_end do { #emit LOAD.I #emit PUSH.pri arg_end -= BYTES_PER_CELL; #emit LOAD.S.pri         arg_end } while (arg_end > arg_start); // Push the static format parameters. #emit PUSH.S             fstring #emit PUSH.C             128 #emit PUSH.ADR           message n += BYTES_PER_CELL * 3; #emit PUSH.S             n #emit SYSREQ.C           format n += BYTES_PER_CELL; #emit LCTRL              4 #emit LOAD.S.alt         n #emit ADD #emit SCTRL              4 return SendClientMessage(playerid, color, message); } else { return SendClientMessage(playerid, color, fstring); } }  ```
Here's an example:
PHP код:
``` [12:43:48] [debug] Server crashed while executing new.amx [12:43:48] [debug] AMX backtrace: [12:43:48] [debug] #0 native format () [004711b0] from samp-server-cr.exe [12:43:48] [debug] #1 000afde8 in SendMes (playerid=0, color=-6750038, fstring[]=@0x002a952c "", ... <2 variable arguments>) at C:\Users\Vladislav\Desktop\RolePlay\gamemodes\new.pwn:4180 [12:43:48] [debug] #2 001409f8 in public OnDialogResponse (playerid=0, dialogid=49, response=1, listitem=6, inputtext[]=@0x0031e348 "") at C:\Users\Vladislav\Desktop\Aqua RolePlay\gamemodes\new.pwn:12049  ```
Here are the lines in which the error occurred:
PHP код:
``` (4180)n += BYTES_PER_CELL; (12049)SendMes(playerid, COLOR_ORANGE, "Вы назначили %s руководить организацией: %s",sendername(playerd), FracInfo[listitem+1][fName]);  ```
__________________________
P.S.:Sorry for the bad English.
He took advantage of the translator
You simply didn't make any sense.
As far as I know, there is no better function to replace that one with #emit, and thats the only way, and yes it will cause crashes in some situations.

Forum Jump:

Users browsing this thread: 1 Guest(s)