04.06.2013, 00:19
So I rewrote a script I cant believe I did it but there is one problem when you type the command with nothing in it, it says my string still. Here is the code
pawn Код:
CMD:giveweapon(playerid,params[])
{
if(PlayerInfo[playerid][pAdmin] > 3)
{
new targetid,weaponid,ammo,string[128],name[MAX_PLAYER_NAME];
if(sscanf(params,"uii",targetid,weaponid,ammo)) SendClientMessage(playerid, COLOR_RED, "Usage: /giveweapon [Player ID/Name] [weapon id] [ammo]");
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "Error: This player is not connected.");
if (weaponid > 46) return SendClientMessage(playerid,COLOR_RED, "ERROR: Invalid weapon id!");
GivePlayerWeapon(targetid, weaponid, ammo); //Gives the player the weapon
format(string, 128, "Admin %s(%d): has given you a weapon!", name, playerid);
SendClientMessage(playerid, COLOR_RED, string);
}
else return SendClientMessage(playerid, COLOR_RED, "You are not at least a level 3 admin!");
return 1;
}