Sscanf error.
#5

Quote:
Originally Posted by danielpalade
Посмотреть сообщение
I really have no idea how to fix this.

This is my error:
Код:
error 035: argument type mismatch (argument 1)
This is my command
Код:
CMD:givemoney(playerid, params)
{
	new id, idname[MAX_PLAYERS], string[256], amount;
	GetPlayerName(id, idname, sizeof(idname));
	if(IsPlayerConnected(id))
	{
		if(sscanf(params, "ui", id,amount)) return SendClientMessage(playerid, COLOR_GREY, "Syntax: {FFFFFF}/givemoney [playerid] [money]");
		GivePlayerMoney(id, amount);
		format(string, sizeof(string), "AdmCmd: You have given %s %d$.", idname, amount);
		SendClientMessage(playerid, COLOR_ADMIN, string);
	}
	else return SendClientMessage(playerid, COLOR_LOL, "Acel jucator nu este connectat.");
	return 1;
}
I dont think that IsPlayerConnected(id) will actually check if the player is connected as it is before the sscanf function is called.

try this:

Код:
CMD:givemoney(playerid, params)
{
	new id, idname[MAX_PLAYERS], string[256], amount;
	GetPlayerName(id, idname, sizeof(idname));
	if(sscanf(params, "ui", id,amount)) return SendClientMessage(playerid, COLOR_GREY, "Syntax: {FFFFFF}/givemoney [playerid] [money]");
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_LOL, "Acel jucator nu este connectat.");
	GivePlayerMoney(id, amount);
	format(string, sizeof(string), "AdmCmd: You have given %s %d$.", idname, amount);
	SendClientMessage(playerid, COLOR_ADMIN, string);
	return 1;
}
Reply


Messages In This Thread
Sscanf error. - by danielpalade - 31.07.2015, 13:30
Re: Sscanf error. - by PMH - 31.07.2015, 13:35
Re: Sscanf error. - by danielpalade - 31.07.2015, 13:39
AW: Sscanf error. - by Kaliber - 31.07.2015, 14:11
Re: Sscanf error. - by Jakwob - 31.07.2015, 15:00
AW: Re: Sscanf error. - by Kaliber - 31.07.2015, 15:08

Forum Jump:


Users browsing this thread: 1 Guest(s)