stock SendMessage(playerid, color, fstring[], {Float, _}:...)
{
static const STATIC_ARGS = 3;
new n = (numargs() - STATIC_ARGS) * BYTES_PER_CELL;
if(n)
{
new message[144], 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);
#emit PUSH.S fstring
#emit PUSH.C 144
#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
if(playerid == INVALID_PLAYER_ID)
{
#pragma unused playerid
return SendClientMessageToAll(color, message);
}
else return SendClientMessage(playerid, color, message);
}
else
{
if(playerid == INVALID_PLAYER_ID)
{
#pragma unused playerid
return SendClientMessageToAll(color, fstring);
}
else return SendClientMessage(playerid, color, fstring);
}
}
new FALSE = false;
#define SendFormattedMessage(%0,%1,%2,%3) do{new string[128];format(string,sizeof(string),(%2),(%3));SendClientMessage((%0),(%1),string);}while(FALSE)
#emit PUSH.C 144
C:\Users\Kevin\Desktop\SAMP\KRLG\gamemodes\KRLG.pwn(25) : warning 202: number of arguments does not match definition C:\Users\Kevin\Desktop\SAMP\KRLG\gamemodes\KRLG.pwn(25) : warning 202: number of arguments does not match definition C:\Users\Kevin\Desktop\SAMP\KRLG\gamemodes\KRLG.pwn(31) : error 020: invalid symbol name "" C:\Users\Kevin\Desktop\SAMP\KRLG\gamemodes\KRLG.pwn(31) : warning 215: expression has no effect C:\Users\Kevin\Desktop\SAMP\KRLG\gamemodes\KRLG.pwn(32) : error 017: undefined symbol "STATIC_ARGS" C:\Users\Kevin\Desktop\SAMP\KRLG\gamemodes\KRLG.pwn(31) : warning 203: symbol is never used: ""
#include <a_samp>
#undef MAX_PLAYERS
#define MAX_SLOTS 500
#define BYTES_PER_CELL 4
native dir_create(directory[]);
native dir_exists(directory[]);
native WP_Hash(buffer[], len, const str[]);
main()
{
return 1;
}
public OnGameModeInit()
{
AddPlayerClass(0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0);
//SendMessage(0, 0xFFFFFFAA, "Hi %s", "Test");
return 1;
}
public OnPlayerConnect(playerid)
{
SendMessage(playerid, 0x00FF00AA, "Hi %s", GetPlayerName(playerid)); //Line 25
return 1;
}
stock SendMessage(playerid, color, fstring[], {Float, _}:...)
{
const static STATIC_ARGS = 3; //Line 31
new n = (numargs() - STATIC_ARGS) * BYTES_PER_CELL; //Line 32
if(n)
{
new message[144], 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);
#emit PUSH.S fstring
#emit PUSH.C 144
#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
if(playerid == INVALID_PLAYER_ID)
{
#pragma unused playerid
return SendClientMessageToAll(color, message);
}
else return SendClientMessage(playerid, color, message);
}
else
{
if(playerid == INVALID_PLAYER_ID)
{
#pragma unused playerid
return SendClientMessageToAll(color, fstring);
}
else return SendClientMessage(playerid, color, fstring);
}
}
new
string[2]
;
format(string, sizeof(string), "");
Solution:
- Use "format" at least once to make sure that compiler doesn't ignore the native. (For example add "format" under OnGameMode/FilterScriptInit): pawn Код:
|