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



Errors on sscanf - Christopher. - 22.02.2010

This is my SetLevel command i have coded using SSCANF, But i am getting errors on the Level setting.
Код:
dcmd_setlevel(playerid,params[])
{
	if (PlayerInfo[playerid][Level] > 1)
	{
	  new LevelUpAnnouncement[128], AdministratorName[MAX_PLAYER_NAME], LevelPlayer[MAX_PLAYER_NAME], PlayerFile[128], id;
	
		if (sscanf(params, "ud", id, Level)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /setlevel [playerid/partname] [level]");
		else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
		else
		{
		  if(PlayerInfo[id][LoggedIn] == 1)
		  {

	 			GetPlayerName(id, LevelPlayer, sizeof(LevelPlayer));

		  	GetPlayerName(playerid, AdministratorName, sizeof(AdministratorName));

			  format(LevelUpAnnouncement, sizeof(LevelUpAnnouncement),"Administrator %s made %s a Administrator [Level: %d]",AdministratorName, LevelPlayer, Level);

			  SendClientMessageToAll(AdministrationAnnouncement, LevelUpAnnouncement);

				PlayerInfo[id][Level] = Level;

				format(PlayerFile, sizeof(PlayerFile), "Users/%s.max", LevelPlayer);

				dini_IntSet(PlayerFile, "AdminLevel", Level);

			 	PlayerPlaySound(id, 1057, 0.0, 0.0, 0.0);
		 	}
		 	else
		 	{
		 	  SendClientMessage(playerid, AdministrationError, "Error: The player must be logged in to use this command!");
			}
		}
  }
	else
	{
		SendClientMessage(playerid, AdministrationError, NotAdminError);
	}
}
These are the errors:
Код:
C:\Users\Christopher\Desktop\AdminMax.pwn(810) : warning 213: tag mismatch
C:\Users\Christopher\Desktop\AdminMax.pwn(821) : warning 213: tag mismatch
C:\Users\Christopher\Desktop\AdminMax.pwn(825) : warning 213: tag mismatch
C:\Users\Christopher\Desktop\AdminMax.pwn(829) : warning 213: tag mismatch
Код:
Line 810:

if (sscanf(params, "ud", id, Level)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /setlevel [playerid/partname] [level]")

Line 821:

format(LevelUpAnnouncement, sizeof(LevelUpAnnouncement),"Administrator %s made %s a Administrator [Level: %d]",AdministratorName, LevelPlayer, Level);

Line 825:

PlayerInfo[id][Level] = Level;

Line 829:

dini_IntSet(PlayerFile, "AdminLevel", Level);
Dose anyone know what would make these errors occur?, Thanks.



Re: Errors on sscanf - SlashPT - 22.02.2010

im not sure but

pawn Код:
if (sscanf(params, "ud", id, Level)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /setlevel [playerid/partname] [level]");
try this


Re: Errors on sscanf - gotenks918 - 22.02.2010

I know this doesn't really relate to your problem, but you should use ZCMD.


Re: Errors on sscanf - SlashPT - 22.02.2010

yep faster and easier


Re: Errors on sscanf - Christopher. - 22.02.2010

Quote:
Originally Posted by gotenks918
I know this doesn't really relate to your problem, but you should use ZCMD.
Looking into it now thanks

Quote:
Originally Posted by DarK TeaM PT
im not sure but

pawn Код:
if (sscanf(params, "ud", id, Level)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /setlevel [playerid/partname] [level]");
try this
Didn't work :/