how to fix number of arguments does not match definition
#1

i want change the GameText to SendClientMessage, but i get a warning

"number of arguments does not match definition"

this is my code anyone can help me? thx for help.

Код:
				//format(string, sizeof(string), "~w~You can Rent this bike~n~Cost:~g~$%d~n~~w~To rent type ~g~/rentbike~w~~n~to get out type ~r~/exit",SBizzInfo[0][sbEntranceCost]);
				SendClientMessage(playerid, COLOR_WHITE, " You can Rent this bike cost $%d",SBizzInfo[0][sbEntranceCost]);
				SendClientMessage(playerid, COLOR_WHITE, " /rentbike or /exit ");
				TogglePlayerControllable(playerid, 0);
				//GameTextForPlayer(playerid, string, 5000, 3);
Reply
#2

Which line is it on?
Reply
#3

Sorry for double post, i see 1 problem.

Код:
//format(string, sizeof(string), "~w~You can Rent this bike~n~Cost:~g~$%d~n~~w~To rent type ~g~/rentbike~w~~n~to get out type ~r~/exit",SBizzInfo[0][sbEntranceCost]);
				SendClientMessage(playerid, COLOR_WHITE, " You can Rent this bike cost $%d",SBizzInfo[0][sbEntranceCost]");
				SendClientMessage(playerid, COLOR_WHITE, " /rentbike or /exit ");
				TogglePlayerControllable(playerid, 0);
				//GameTextForPlayer(playerid, string, 5000, 3);
You missed that " on top sendclientmessage.
Reply
#4

Код:
//format(string, sizeof(string), "~w~You can Rent this bike~n~Cost:~g~$%d~n~~w~To rent type ~g~/rentbike~w~~n~to get out type ~r~/exit",SBizzInfo[0][sbEntranceCost]");
				SendClientMessage(playerid, COLOR_WHITE, " You can Rent this bike cost $%d",SBizzInfo[0][sbEntranceCost]");
				SendClientMessage(playerid, COLOR_WHITE, " /rentbike or /exit ");
				TogglePlayerControllable(playerid, 0);
				//GameTextForPlayer(playerid, string, 5000, 3);
Try that, sorry for posting again i saw 1 more error.
Reply
#5

Quote:
Originally Posted by XxCozzaxX
Sorry for double post, i see 1 problem.

Код:
//format(string, sizeof(string), "~w~You can Rent this bike~n~Cost:~g~$%d~n~~w~To rent type ~g~/rentbike~w~~n~to get out type ~r~/exit",SBizzInfo[0][sbEntranceCost]);
				SendClientMessage(playerid, COLOR_WHITE, " You can Rent this bike cost $%d",SBizzInfo[0][sbEntranceCost]");
				SendClientMessage(playerid, COLOR_WHITE, " /rentbike or /exit ");
				TogglePlayerControllable(playerid, 0);
				//GameTextForPlayer(playerid, string, 5000, 3);
You missed that " on top sendclientmessage.
it is not work...............

Код:
				//format(string, sizeof(string), "~w~You can Rent this bike~n~Cost:~g~$%d~n~~w~To rent type ~g~/rentbike~w~~n~to get out type ~r~/exit",SBizzInfo[0][sbEntranceCost]);
				SendClientMessage(playerid, COLOR_WHITE, " You can Rent this bike cost $%d",SBizzInfo[0][sbEntranceCost]);
				SendClientMessage(playerid, COLOR_WHITE, " /rentbike /exit");
				TogglePlayerControllable(playerid, 0);
				//GameTextForPlayer(playerid, string, 5000, 3);
Reply
#6

First of All, SendClientMessage doesn't Formats Strings, to send a defined string before you must first format it then send it with SendClientMessage(playerid,color,string[]); which in this case, is:

SendClientMessage(playerid,COLOR_WHITE, string);



Second, SendClientMessage Colour is only defined on the COLOR row, You can not use the GameText colours in a SendClientMessage, because SendClientMessage only uses ONE defined colour..


Your Code Fixed would be like this...

pawn Код:
SendClientMessage(playerid, COLOR_WHITE, "You can rent this Bike");
format(string, sizeof(string), "Cost: $%d", SBizzInfo[0][sbEntranceCost]);
SendClientMessage(playerid, 0x00FF00FF, string);
SendClientMessage(playerid, COLOR_WHITE, "To Get out Type /exit");
SendClientMessage(playerid, COLOR_WHITE, " /rentbike or /exit ");
TogglePlayerControllable(playerid, 0);
format(string, sizeof(string), "~w~You can Rent this bike~n~Cost:~g~$%d~n~~w~To rent type ~g~/rentbike~w~~n~to get out type ~r~/exit",SBizzInfo[0][sbEntranceCost]);
GameTextForPlayer(playerid, string, 5000, 3);

Reply
#7

Quote:
Originally Posted by CueЯvo
First of All, SendClientMessage doesn't Formats Strings, to send a defined string before you must first format it then send it with SendClientMessage(playerid,color,string[]); which in this case, is:

SendClientMessage(playerid,COLOR_WHITE, string);



Second, Se....................
I have a question, I can use the new?

For example

pawn Код:
new aa = SBizzInfo [0] [sbEntranceCost]
SendClientMessage(playerid, COLOR_WHITE, " cost %d ",aa);
Reply
#8

Yes, but you must put that on a formatted string before including it on the SendClientMessage

Besides, using new is faster

pawn Код:
format(string, sizeof(string), "Cost: $%d", aa);
SendClientMessage(playerid, COLOR_WHITE, string);

for more information check the wiki.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)