SA-MP Forums Archive
Warning with sendclientmessage? - 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 with sendclientmessage? (/showthread.php?tid=623658)



Warning with sendclientmessage? - buhs - 03.12.2016

Can u guys help me with this sendclientmessage error?
Warning what's shown:
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

Cmd:
HTML Code:
SendClientMessage(playerid, -1, "*"COL_YELLOW" You have given %s "COL_WHITE"%i"COL_GREEN" %s", PlayerName(playerid), amount, string);



Re: Warning with sendclientmessage? - Micko123 - 03.12.2016

You can't format in SendPlayerMessage.. You can only send message without any usage of %s %d..
You can do it this way
PHP Code:
new string[128];
format(stringsizeof(string), "*"COL_YELLOW" You have given %s "COL_WHITE"%i"PlayerName(playerid), amount);
SendClientMessage(playerid, -1string); 



Re: Warning with sendclientmessage? - Yaa - 03.12.2016

PHP Code:
new str[120];
format(strsizeof(str), "*"COL_YELLOW" You have given %s "COL_WHITE"%i"COL_GREEN""PlayerName(playerid), amount,);
SendClientMessage(playerid, -1str); 



Re: Warning with sendclientmessage? - Logic_ - 03.12.2016

Are the above strings even 100 characters long?

PHP Code:
new str[90]; // 90 is enuf 
format(strsizeof(str), "*"COL_YELLOW" You have given %s "COL_WHITE"%i"PlayerName(playerid), amount,); // no need to use COLOR_GREEN...
SendClientMessage(playerid, -1str); 



Re: Warning with sendclientmessage? - buhs - 03.12.2016

Quote:
Originally Posted by Yaa
View Post
PHP Code:
new str[120];
format(strsizeof(str), "*"COL_YELLOW" You have given %s "COL_WHITE"%i"COL_GREEN""PlayerName(playerid), amount,);
SendClientMessage(playerid, -1str); 
Thanks, worked!


Re: Warning with sendclientmessage? - Logic_ - 03.12.2016

The above code worked, but you are wasting 20+ unused memory. Optimization should be your higher priority than a code that works.