[SOLVED] Sscanf Errors ;S Please Help!
#1

Hi,

When I use sscanf I the following errors...
Код:
C:\Users\Alex\Desktop\Mini-Wars\filterscripts\System.pwn(424) : warning 219: local variable "name" shadows a variable at a preceding level
C:\Users\Alex\Desktop\Mini-Wars\filterscripts\System.pwn(428) : error 035: argument type mismatch (argument 2)
C:\Users\Alex\Desktop\Mini-Wars\filterscripts\System.pwn(428) : error 035: argument type mismatch (argument 2)
C:\Users\Alex\Desktop\Mini-Wars\filterscripts\System.pwn(429) : error 035: argument type mismatch (argument 1)
C:\Users\Alex\Desktop\Mini-Wars\filterscripts\System.pwn(424) : warning 204: symbol is assigned a value that is never used: "name"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
Please help me with this
Thanks.

EDIT:
Here's my code;
Код:
dcmd_kick(playerid, params[])
{
	if(pInfo[playerid][level] >= 1) {
		if(!strlen(params))
		{
			SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /kick [playerid/name] [reason]");
			return 1;
		}
		new kickid;
		new reason[128];
		new string[128];
		new kickname[48];
		new adminname[48];
		sscanf(params, "uz", kickid, reason);
		GetPlayerName(kickid,kickname,sizeof(kickname));
		GetPlayerName(playerid,adminname,sizeof(adminname));
		
		if(!IsPlayerConnected(kickid) || kickid == INVALID_PLAYER_ID || (pInfo[kickid][level] == 5))
		{
			SendClientMessage(playerid,COLOR_RED,"ERROR: Player is not connected or is the highest admin level");
			return 1;
		}
		
		format(string,256,"KICK: %s has been kicked by %s [reason: %s] ",kickname,adminname,reason);
		SendClientMessageToAll(COLOR_WHITE,string);
	}
	else
	{
 		SendClientMessage(playerid,COLOR_RED,"ERROR: You aren't a Perfect Member / level 1+ admin");
 	}
	return 1;

}
Reply
#2

Код:
dcmd_kick(playerid, params[])
{
	if(pInfo[playerid][level] < 1) return SendClientMessage(playerid,COLOR_RED,"ERROR: You aren't a Perfect Member / level 1+ admin");
	new kickid;
	new kickname[21];
	new adminname[21];
	new reason[128];
	if(sscanf(params, "uz", kickid, reason)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /kick [playerid/name] [reason]");
	new string[128];
	GetPlayerName(kickid,kickname,sizeof(kickname));
	GetPlayerName(playerid,adminname,sizeof(adminname));
	if(!IsPlayerConnected(kickid) || kickid == INVALID_PLAYER_ID || (pInfo[kickid][level] == 5))
	{
		return SendClientMessage(playerid,COLOR_RED,"ERROR: Player is not connected or is the highest admin level");
	}
		format(string,256,"KICK: %s has been kicked by %s [reason: %s] ",kickname,adminname,reason);
	SendClientMessageToAll(COLOR_WHITE,string);
	return 1;
}
Reply
#3

Quote:
Originally Posted by big comfy couch
Код:
dcmd_kick(playerid, params[])
{
	if(pInfo[playerid][level] < 1) return SendClientMessage(playerid,COLOR_RED,"ERROR: You aren't a Perfect Member / level 1+ admin");
	new kickid;
	new kickname[21];
	new adminname[21];
	new reason[128];
	if(sscanf(params, "uz", kickid, reason)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /kick [playerid/name] [reason]");
	new string[128];
	GetPlayerName(kickid,kickname,sizeof(kickname));
	GetPlayerName(playerid,adminname,sizeof(adminname));
	if(!IsPlayerConnected(kickid) || kickid == INVALID_PLAYER_ID || (pInfo[kickid][level] == 5))
	{
		return SendClientMessage(playerid,COLOR_RED,"ERROR: Player is not connected or is the highest admin level");
	}
		format(string,256,"KICK: %s has been kicked by %s [reason: %s] ",kickname,adminname,reason);
	SendClientMessageToAll(COLOR_WHITE,string);
	return 1;
}
It's still not working...
Код:
C:\Users\Alex\Desktop\Mini-Wars\filterscripts\System.pwn(410) : warning 219: local variable "name" shadows a variable at a preceding level
C:\Users\Alex\Desktop\Mini-Wars\filterscripts\System.pwn(414) : error 035: argument type mismatch (argument 2)
C:\Users\Alex\Desktop\Mini-Wars\filterscripts\System.pwn(414) : error 035: argument type mismatch (argument 2)
C:\Users\Alex\Desktop\Mini-Wars\filterscripts\System.pwn(415) : error 035: argument type mismatch (argument 1)
C:\Users\Alex\Desktop\Mini-Wars\filterscripts\System.pwn(410) : warning 204: symbol is assigned a value that is never used: "name"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
Reply
#4

- BUMP -
Reply
#5

This is the correct lines?
Cause if I'm not wrong, I can't see any lines containing the variable 'name' which gives errors.
Reply
#6

Quote:
Originally Posted by lrZ^ aka LarzI
This is the correct lines?
Cause if I'm not wrong, I can't see any lines containing the variable 'name' which gives errors.
The error lines are in the sscanf part...
See; https://sampwiki.blast.hk/wiki/Sscanf

Thanks (:
Reply
#7

search through your script (ctrl+f) and replace every line containing the variable 'name' (even the defininition 'new name...' with name2 or something like that, so it doesn't interfere with the sscanf code.
Reply
#8

Quote:
Originally Posted by lrZ^ aka LarzI
search through your script (ctrl+f) and replace every line containing the variable 'name' (even the defininition 'new name...' with name2 or something like that, so it doesn't interfere with the sscanf code.
Thanks (; It solved now Thank you so much ^^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)