SA-MP Forums Archive
error 035: argument type mismatch (argument 2) - 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: error 035: argument type mismatch (argument 2) (/showthread.php?tid=633825)



error 035: argument type mismatch (argument 2) - Tudounaozi - 07.05.2017

Код:
COMMAND:f(playerid, params[])
{
	new text[128],fcolor[255],string[255],sendername[MAX_PLAYER_NAME];
	if(sscanf(params, "s[128]", text)) SendClientMessage(playerid, COLOR_GREY, "用法: /f [text]");
	else
	{
	    if (GetPVarInt(playerid, "PlayerLogged") == 0) return SendClientMessage(playerid, COLOR_WHITE, "请先登录游戏.");
	    if(GetPVarInt(playerid, "Mute") == 1) return SendClientMessage(playerid, COLOR_LIGHTRED, "你已被禁言!");
	    if (GetPVarInt(playerid, "Member") == 0) return SendClientMessage(playerid, COLOR_WHITE, "你不在一个组织里.");
	    if(FactionInfo[GetPVarInt(playerid, "Member")][fDisabled] == 1) return SendClientMessage(playerid, COLOR_WHITE, "组织频道被关闭了!");
   		switch(GetPVarInt(playerid, "Member"))
		{
	        case 1: fcolor = "0x8080FF96";
	        case 2: fcolor = "COLOR_PINK";
	        case 6: fcolor = "0x8080FF96";
	        case 8: fcolor = "COLOR_GREEN";
	        default: fcolor = "0x7BDDA5AA";
	    }
	   	format(sendername, sizeof(sendername), "%s", PlayerName(playerid));
	    GiveNameSpace(sendername);
        format(string, sizeof(string), "** (( %s %s: %s )) **", FactionRank[GetPVarInt(playerid, "Member")][GetPVarInt(playerid, "Rank")], sendername, text);
	    SendFactionMessage(GetPVarInt(playerid, "Member"),fcolor,string);
	}
	return 1;
}
This one is reporting for error:

SendFactionMessage(GetPVarInt(playerid, "Member"),fcolor,string);


Re: error 035: argument type mismatch (argument 2) - GoldenLion - 07.05.2017

Colors are integers.


Re: error 035: argument type mismatch (argument 2) - Tudounaozi - 07.05.2017

Quote:
Originally Posted by GoldenLion
Посмотреть сообщение
Colors are integers.
So how do I change? I kinda confused on this..


Re: error 035: argument type mismatch (argument 2) - GoldenLion - 07.05.2017

Change "fcolor[255]" to "fcolor" and when you assign values to it, it has to be like this:
Код:
fcolor = 0x8080FF96;
instead of
Код:
fcolor = "0x8080FF96";
for example. Also you don't need 255 cells for "string" because the output text can't be longer than 144 characters so simply change 255 to 144. And another thing: you don't need sscanf here, you can use the params and isnull.


Re: error 035: argument type mismatch (argument 2) - Tudounaozi - 07.05.2017

Quote:
Originally Posted by GoldenLion
Посмотреть сообщение
Change "fcolor[255]" to "fcolor" and when you assign values to it, it has to be like this:
Код:
fcolor = 0x8080FF96;
instead of
Код:
fcolor = "0x8080FF96";
for example. Also you don't need 255 cells for "string" because the output text can't be longer than 144 characters so simply change 255 to 144. And another thing: you don't need sscanf here, you can use the params and isnull.
Fixed, thank you very much!