SA-MP Forums Archive
prob with sscanf - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: prob with sscanf (/showthread.php?tid=220366)



prob with sscanf - THE_KNOWN - 03.02.2011

Код:
CMD:accept(playerid, params)
{
	new id,name[MAX_PLAYERS], query[128],string[128];
	if(sscanf(params,"u",id)) return SendClientMessage(playerid, red, "USAGE:/accept [id]");
	if(leader[playerid]<1) return SendClientMessage(playerid, red, "Your not a leader.");
	if(req[id] != org[playerid]) return SendClientMessage(playerid, red, "The player is not requesting to join your org.");
   	GetPlayerName(playerid, Name, sizeof(Name));
	GetPlayerName(id,name,sizeof(name));
	format(query,sizeof(query), "UPDATE ostats SET org=%d, req=0 WHERE name='%s'",org[playerid],name);
	format(string, sizeof(string), "Your application for %s has been accepted.",oname[playerid]);
	SendClientMessage(id, COLOR_ORANGE, string);
	new string1[128];
	format(string1, 128, "You have accepted %s into your organisation.",name);
	SendClientMessage(playerid, COLOR_ORANGE, string1);
	return 1;
}
argument type mismatch(argument 1)

line:
if(sscanf(params,"u",id)) return SendClientMessage(playerid, red, "USAGE:/accept [id]");


Re: prob with sscanf - JaTochNietDan - 03.02.2011

The parameter "params" should be an array, but you're initializing it in the function otherwise, it should be initialized like so:

pawn Код:
CMD:accept(playerid, params[])