SA-MP Forums Archive
number of arguments doesn't match the 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: number of arguments doesn't match the definition (/showthread.php?tid=568863)



number of arguments doesn't match the definition - DonBonanno - 25.03.2015

Код:
			else if(GetIntVar(playerid, "CallWith") == 8736)
			{
				format(str, sizeof(str), "%s spune (telefon) %s", GetNameWithMask(playerid), text);
				ProxDetectorP(20.0, playerid, str,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
				if(!strlen(text))
				{
					SCM(playerid, COLOR_LIGHTBLUE, "Locul livrarii, catre afacere, poate tine un minim de 1.000 materiale si un maxim de 50.000");
					return 0;
				}
				SCM(playerid, COLOR_WHITE, "Va putem oferi aceste materiale la pretul de $%d", strlen(text) * 55);
				SCM(playerid, COLOR_WHITE, "Sunteti de acord ? (Da sau Nu)");
				PlayerInfo[playerid][pMaterialeWait] = strlen(text);
				PlayerInfo[playerid][pMaterialeWait] = 1;
				SetIntVar(playerid, "CallWith", 8737);
				return 0;
			}
I have this warning at this line:
Код:
SCM(playerid, COLOR_WHITE, "Va putem oferi aceste materiale la pretul de $%d", strlen(text) * 55);
I think strlen(text) * 55); is wrong..what i need to edit ?


Re: number of arguments doesn't match the definition - Misiur - 25.03.2015

Format the string first
pawn Код:
format(str, sizeof str, "Va putem oferi aceste materiale la pretul de $%d", strlen(text) * 55);
SCM(playerid, COLOR_WHITE, str);



Re: number of arguments doesn't match the definition - Sergei - 25.03.2015

Copy the line where SCM is defined. I guess it's a alias for SendClientMessage (that has 3 arguments), so that strlen thing doesn't belong in there. You need for format the string manually.


Re: number of arguments doesn't match the definition - DonBonanno - 25.03.2015

Oh..thank you very much..
I have a question.. at strlen(text) * 55); can i replace with text * 55 or is corect like that..


Re: number of arguments doesn't match the definition - CalvinC - 25.03.2015

Strlen checks the length of the text, so if you wrote "hi" it would basically be "2 * 55", while using "text * 55" would do "hi * 55", which wont work.


Re: number of arguments doesn't match the definition - DonBonanno - 25.03.2015

But i have a question there :"How many materials do you want to buy" ?
And when player write 1000 to update this :

PlayerInfo[playerid][pMaterialeWait] = strlen(text);

What i need to put there ? = strlen(text);

If player write 1000 i wan't something like that:
PlayerInfo[playerid][pMaterialeWait] = 1000


Re: number of arguments doesn't match the definition - Misiur - 25.03.2015

Wrong function! strval - changes text into number, strlen - counts the number of characters in string


Re: number of arguments doesn't match the definition - DonBonanno - 25.03.2015

After i need to put PlayerInfo[playerid][pMaterialeWait] = text; aight ?


Re: number of arguments doesn't match the definition - Misiur - 25.03.2015

If pMaterialeWait is an integer, then
pawn Код:
PlayerInfo[playerid][pMaterialeWait] = strval(text);



Re: number of arguments doesn't match the definition - DonBonanno - 25.03.2015

So, strval is not a counting right ? Is not like strlen..
If player write 1000
pMaterialeWait = strval(text); and strval(text) is 1000 right ?