sscanf problem
#1

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 )
Reply
#2

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.
Reply
#3

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
Reply
#4

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

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"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)