17.03.2012, 09:17
This is good ? Or bugget:
Код:
if(strcmp(cmd, "/giveweapon", true) == 0)
{
if(PlayerInfo[playerid][Level] >= 2) {
new player1, tmp[256],weap,ammo;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, red, "USAGE: /giveweapon [playerid] [weapon id]");
return 1; }
player1 = strval(tmp);
tmp = strtok(cmdtext, idx);
weap = strval(tmp);
if(!IsValidWeapon(weap)) return SendClientMessage(playerid,red,"ERROR: Incorrect Weapon ID");
tmp = strtok(cmdtext, idx);
ammo = strval(tmp);
GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(adminname));
if(IsPlayerConnected(player1)) {
CMDMessageToAdmins(playerid,"GIVEWEAPON");
GivePlayerWeapon(player1, weap, ammo);
format(string, sizeof(string), "You have given %s weapon id: %d with %d rounds of ammo", playername,weap,ammo); SendClientMessage(playerid,blue,string);
format(string,256,"Administrator %s has given you weapon id: %d with %d rounds of ammo",adminname,weap,ammo); if(player1 != playerid) { SendClientMessage(player1,blue,string); }
return 1;
} else {
SendClientMessage(playerid, red, "Player is not connected");
return 1; }
} else {
SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command"); }
return 1; }

