Errors on sscanf
#1

Ok so i have got a GiveWeapon command, I've got the params of the sscanf so it has the weapon id too, This is the command:
Код:
dcmd_giveweapon(playerid, params[])
{
	new Weapon;
	new string[128];

	new WeaponPlayer[MAX_PLAYER_NAME];
	new AdministratorName[MAX_PLAYER_NAME];
	new id;

	if (PlayerInfo[playerid][Level] > 1)
	{

		if (sscanf(params, "ui", id, Weapon)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /giveweapon [playerid/partname] [amount]");
		else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
		else
		{

		  GetPlayerName(id, WeaponPlayer, sizeof(WeaponPlayer));

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

			if(!strlen(Weapon)) return SendClientMessage(playerid, AdministrationError, "USAGE: /weapon [PlayerID] [WeaponID]");
			if(!IsNumeric(Weapon)) return SendClientMessage(playerid, AdministrationError, "Error: Invalid WeaponID");
			if(Weapon > 46) return SendClientMessage(playerid, AdministrationError, "Error: Weapon ID's must be 1-46");

			format(string, sizeof(string), "%s was given a weapon by Administrator %s. [Weapon: %d ]", WeaponPlayer, AdministratorName, Weapon);
			
			GivePlayerWeapon(id, Weapon, 5000);

			SendClientMessageToAll(AdministrationAnnouncement, string);

			LogCommand(string);

		}
	}
	else
	{
		SendClientMessage(playerid, AdministrationError, NotAdminError);
	}
	return 1;
}
The errors:
Код:
C:\Users\Christopher\Desktop\AdminMax.pwn(781) : error 035: argument type mismatch (argument 1)
C:\Users\Christopher\Desktop\AdminMax.pwn(782) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Line 781 and 782:
Код:
if(!strlen(Weapon)) return SendClientMessage(playerid, AdministrationError, "USAGE: /weapon [PlayerID] [WeaponID]");
if(!IsNumeric(Weapon)) return SendClientMessage(playerid, AdministrationError, "Error: Invalid WeaponID");
Dose anyone have any idea why that would return a error?, Thanks

Reply


Messages In This Thread
Errors on sscanf - by Christopher. - 21.02.2010, 19:27
Re: Errors on sscanf - by aircombat - 21.02.2010, 19:30
Re: Errors on sscanf - by Christopher. - 21.02.2010, 19:33
Re: Errors on sscanf - by aircombat - 21.02.2010, 19:39
Re: Errors on sscanf - by Christopher. - 21.02.2010, 19:46
Re: Errors on sscanf - by aircombat - 21.02.2010, 19:51
Re: Errors on sscanf - by Christopher. - 23.02.2010, 16:26
Re: Errors on sscanf - by dice7 - 23.02.2010, 16:31
Re: Errors on sscanf - by Miguel - 23.02.2010, 16:40
Re: Errors on sscanf - by Christopher. - 23.02.2010, 17:17

Forum Jump:


Users browsing this thread: 7 Guest(s)