SA-MP Forums Archive
sscanf problem - 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: sscanf problem (/showthread.php?tid=185180)



sscanf problem - dark_clown - 23.10.2010

hi, im making my admin script from scratch, but im trying to do warn all on my
own i made it all from scratch, but im not getting any errors or warnigns but yes console warnings -.-
Code:
dcmd_warn(playerid,params[])
{
	new id, string[128],pName[MAX_PLAYER_NAME], p2Name[MAX_PLAYER_NAME];
	GetPlayerName(playerid,pName,sizeof(pName));
	if(PInfo[playerid][Level] < 2) return SendClientMessage(playerid,red, "ERROR: You must be level 2");
 	if(sscanf(params,"uz",id)) return SendClientMessage(playerid, LGREEN, "USAGE: /warn [playerid] [reason]");
 	if(PInfo[id][Warnings] == MAX_WARNINGS)
 	{
 	    GetPlayerName(id,p2Name, sizeof(p2Name));
 	    format(string, sizeof (string),"%s has been kicked [Reason: %s](Warnings: %d/%d)",p2Name, params[2],PInfo[id][Warnings], MAX_WARNINGS);
 	    SendClientMessageToAll(ORANGE,string);
 	    Kick(id);
  	}
  	else
  	{
  	    GetPlayerName(playerid,pName,sizeof(pName));
 	    GetPlayerName(id,p2Name, sizeof(p2Name));
  		PInfo[id][Warnings]++;
		format(string, sizeof(string), "Administrator %s has warned %s [Reason: %s][Warnings: %d/%d]",pName, p2Name, params[2], PInfo[id][Warnings], MAX_WARNINGS);
		SendClientMessageToAll(ORANGE,string);
	}
	return 1;
}
but i get this in console

any one know why?
(i think this job is for jeffry , btw hi jeffry )


Re: sscanf problem - CJ101 - 23.10.2010

Quote:

new reason[100];
if(sscanf(params,"uz",id,reason))

Your paramater count is off. If you have two characters in where "uz" is, you need two things after the next comma.


Re: sscanf problem - dark_clown - 23.10.2010

Quote:
Originally Posted by cj101
View Post
Your paramater count is off. If you have two characters in where "uz" is, you need two things after the next comma.
still had to give some tweaks but thanks


Re: sscanf problem - Scenario - 23.10.2010

Oh and by the way, you shouldn't use "z", it should be "s" - otherwise sscanf will give you a warning.


Re: sscanf problem - dark_clown - 23.10.2010

Quote:
Originally Posted by RealCop228
View Post
Oh and by the way, you shouldn't use "z", it should be "s" - otherwise sscanf will give you a warning.
thats what i changed in the "tweaks"