SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 03/12/2016, 03:40 PM   #1
buhs
Little Clucker
 
Join Date: Oct 2016
Posts: 18
Reputation: 0
Default Warning with sendclientmessage?

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);
buhs is offline   Reply With Quote
Old 03/12/2016, 03:48 PM   #2
Micko123
High-roller
 
Micko123's Avatar
 
Join Date: Feb 2016
Location: 127.0.0.1:7777
Posts: 1,199
Reputation: 45
Default Re: Warning with sendclientmessage?

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); 
__________________

"You see that guy?? He was a beginner just like you.."

Quote:
Originally Posted by Calgon View Post
The SA-MP community gives the best advice with relationships, you have come to the right place my friend.


Micko123 is offline   Reply With Quote
Old 03/12/2016, 03:49 PM   #3
Yaa
Banned
 
Join Date: May 2016
Location: = GetPlayerHouse("Yaa", 0.2);
Posts: 597
Reputation: 42
Default Re: Warning with sendclientmessage?

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); 
Yaa is offline   Reply With Quote
Old 03/12/2016, 04:07 PM   #4
Logic_
Banned
 
Join Date: Jun 2015
Posts: 1,506
Reputation: 305
Default Re: Warning with sendclientmessage?

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); 
Logic_ is offline   Reply With Quote
Old 03/12/2016, 04:14 PM   #5
buhs
Little Clucker
 
Join Date: Oct 2016
Posts: 18
Reputation: 0
Default Re: Warning with sendclientmessage?

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!
buhs is offline   Reply With Quote
Old 03/12/2016, 04:16 PM   #6
Logic_
Banned
 
Join Date: Jun 2015
Posts: 1,506
Reputation: 305
Default Re: Warning with sendclientmessage?

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

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SendClientMessage Sheperc Scripting Help 3 27/01/2016 07:49 PM
SendClientMessage ShaneOvSina Scripting Help 2 22/04/2014 03:03 PM
SendClientMessage Carxi Scripting Help 9 30/03/2014 10:08 PM
SendClientMessage Bug Blackazur Scripting Help 4 05/12/2013 11:52 PM
Help with SendClientMessage arjanforgames Scripting Help 4 09/07/2013 05:29 PM


All times are GMT. The time now is 11:42 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.