21.02.2010, 19:27
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:
The errors:
Line 781 and 782:
Dose anyone have any idea why that would return a error?, Thanks
Код:
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;
}
Код:
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.
Код:
if(!strlen(Weapon)) return SendClientMessage(playerid, AdministrationError, "USAGE: /weapon [PlayerID] [WeaponID]"); if(!IsNumeric(Weapon)) return SendClientMessage(playerid, AdministrationError, "Error: Invalid WeaponID");

