#include <sdktools_functions>
/* Список оружия:
"glock", "p250", "fiveseven", "deagle", "elite", "hkp2000", "tec9",
"nova", "xm1014", "mag7", "sawedoff", "m249", "negev",
"mp9", "mac10", "mp7", "ump45", "p90", "bizon",
"famas", "m4a1", "galilar", "ak47", "ssg08", "aug", "sg556", "awp", "scar20", "g3sg1",
"taser", "knife", "decoy", "flashbang", "hegrenade", "incgrenade", "molotov", "smokegrenade" };
*/
public Plugin:myinfo =
{
name = "WeaponToAll",
author = "",
description = "Provides !wta command",
version = "1.0",
url = ""
}
public OnPluginStart() {
RegAdminCmd("sm_wta", Command_WTA, ADMFLAG_KICK, "Gives weapon for all team");
}
public Action:Command_WTA(client, args) {
if(args < 2) {
ReplyToCommand(client, "[WTA] Дать оружие: /wta <ct/t/all> <Weapon>");
} else {
decl String:team[4];
GetCmdArg(1, team, 4);
if (strcmp(team, "ALL", false) == 0) {
decl String:weapon[14];
GetCmdArg(2, weapon, 14);
Function_GiveWeapon(1, weapon, "Всем")
} else if (strcmp(team, "CT", false) == 0) {
decl String:weapon[14];
GetCmdArg(2, weapon, 14);
Function_GiveWeapon(3, weapon, "Контрам")
} else if (strcmp(team, "T", false) == 0) {
decl String:weapon[14];
GetCmdArg(2, weapon, 14);
Function_GiveWeapon(2, weapon, "Террористам")
} else ReplyToCommand(client, "[WTA] Выберите корректную команду: CT, T, ALL");
}
return Plugin_Handled;
}
// 1 - ALL; 2 - T; 3 - CT
stock Function_GiveWeapon(team, const String:weapon[], const String:info[])
{
new i = strlen(weapon)+8;
decl String:give_weapon[i];
FormatEx(give_weapon, i, "weapon_%s", weapon);
for (i = 1; i <= MaxClients; i++) {
if (IsClientInGame(i) && IsPlayerAlive(i) && (team == 1 || GetClientTeam(i) == team))
{
if (GivePlayerItem(i, give_weapon) != -1) PrintToChat(i, "\x01\x05[SM] \x01%s выдано оружие \x05%s", info, give_weapon);
else break;
}
}
}