warning 202: number of arguments does not match definition - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: warning 202: number of arguments does not match definition (
/showthread.php?tid=644492)
warning 202: number of arguments does not match definition -
PierreMarley - 08.11.2017
I get this warnings on my script
Код:
if(GotWeapon(playerid, DropWeapons[Wep][dwPickup])) return SendClientMessageEx(playerid, COLOR_RED, "You already own the %s!", weaponname);
Код:
SendClientMessageEx(playerid, COLOR_WHITE, "%s", DropWeapons[Wep][dwDesc]);
Код:
SendClientMessageEx(playerid, COLOR_WHITE, "You pickup the %s that you dropped earlier.", weaponname);
I tested them on another script and everything is Good but on my script giving me those errors
Код:
warning 202: number of arguments does not match definition
Код:
warning 202: number of arguments does not match definition
Код:
warning 202: number of arguments does not match definition
Re: warning 202: number of arguments does not match definition -
Joron - 08.11.2017
In the function SendClientMessageEx, You cannot format messages in it so that's why you're getting the error.
Use format instead.
Re: warning 202: number of arguments does not match definition -
StrikerZ - 09.11.2017
Replace your SendClientMessageEx function in your script with this
PHP код:
stock SendClientMessageEx(playerid, color, fstring[], {Float, _}:...)
{
// This is the number of parameters which are not variable that are passed
// to this function (i.e. the number of named parameters).
static const
STATIC_ARGS = 3;
// Get the number of variable arguments.
new
n = (numargs() - STATIC_ARGS) * BYTES_PER_CELL;
if (n)
{
new
message[128],
arg_start,
arg_end;
// Load the real address of the last static parameter. Do this by
// loading the address of the last known static parameter and then
// adding the value of [FRM].
#emit CONST.alt fstring
#emit LCTRL 5
#emit ADD
#emit STOR.S.pri arg_start
// Load the address of the last variable parameter. Do this by adding
// the number of variable parameters on the value just loaded.
#emit LOAD.S.alt n
#emit ADD
#emit STOR.S.pri arg_end
// Push the variable arguments. This is done by loading the value of
// each one in reverse order and pushing them. I'd love to be able to
// rewrite this to use the values of pri and alt for comparison,
// instead of having to constantly load and reload two variables.
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
// Now push the number of arguments passed to format, including both
// static and variable ones and call the function.
n += BYTES_PER_CELL * 3;
#emit PUSH.S n
#emit SYSREQ.C format
// Remove all data, including the return value, from the stack.
n += BYTES_PER_CELL;
#emit LCTRL 4
#emit LOAD.S.alt n
#emit ADD
#emit SCTRL 4
return SendClientMessage(playerid, color, message);
//return print(message);
}
else
{
return SendClientMessage(playerid, color, fstring);
//return print(fstring);
}
}