- Ошибка
-
ошибка на скрине
- Компилятор
- Локальный
- Amx Mod X
- Исходный код
-
#include < amxmodx >
#include < amxmisc >
#include < cstrike >
#include < hamsandwich >
#include < fakemeta >
const PRIMARY_W = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<SW_M4A1)|(1<<CSW_TMP)|(1<<CW_G3SG1)|(1<<CW_SG552)|(1<<SW_AK47)|(1<<CSW_P90)
#define MENU_KEYS (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)
new g_HashRound;
#define BONUS_ROUND 2 // с какого раунда выдавать бонусы;
public plugin_init() {
register_plugin("Bonus Steam", "1.0", "gordonfreeman");
register_menu("bonus_menu", MENU_KEYS, "addBonus", 0);
register_event("TextMsg", "bonus_restart", "a", "2=#Game_Commencing", "2=#Game_will_restart_in");
register_event("HLTV", "bonus_round", "a", "1=0", "2=0");
RegisterHam(Ham_Spawn, "player", "openBonus");
}
public plugin_cfg() {
new const szMapTypes[][] = {"cs_", "de_"};
new szMapname[32], bool:bMapType;
get_mapname(szMapname, charsmax(szMapname));
for(new i, iMapTypeNum = sizeof szMapTypes; i < iMapTypesNum; i++) {
if(equali(szMapname, szMapTypes[i], strlen(szMapTypes[i]))) { bMapType = true; break; }
}
if(!bMapType) { pause("d"); }
}
public bonus_round() { g_HashRound += 1; }
public bonus_restart() { g_HashRound = 0; }
public openBonus(id) {
if(!is_user_connected(id)) { return PLUGIN_HANDLED; }
if(g_HashRound <= BONUS_ROUND) { return PLUGIN_HANDLED; }
if(is_user_admin(id)) { return PLUGIN_HANDLED; }
if(!w_steam(id)) { return PLUGIN_HANDLED; }
set_task(0.2, "menuBonus", id);
return PLUGIN_HANDLED;
}
public menuBonus(id) {
new szHashId[256], szLen;
new keys = MENU_KEY_1|MENU_KEY_2;
szLen = formatex(szHashId[szLen], charsmax(szHashId), "\yБонус за \rSteam^n^n");
szLen += formatex(szHashId[szLen], charsmax(szHashId) - szLen, "\y[1] \wВзять^n");
szLen += formatex(szHashId[szLen], charsmax(szHashId) - szLen, "\y[2] \wОтказаться");
show_menu(id, key, szHashId, 20, "bonus_menu");
return PLUGIN_HANDLED;
}
public addBonus(id, key) {
switch(key) {
case 0: giveBonus(id);
case 1: return PLUGIN_HANDLED;
}
return PLUGIN_HANDLED;
}
public giveBonus(id) {
new szRandom = random_num(1, 6);
switch(szRandom) {
case 1: {
w_drop(id, 1);
w_give(id, "weapon_m4a1");
cs_set_user_bpammo(id, CSW_M4A1, 90);
w_print(id, "^1[^4STEAM^1] Вы получаете ^4M4A1 ^1за ^3Steam");
}
case 2: {
w_drop(id, 1);
w_give(id, "weapon_ak47");
cs_set_user_bpammo(id, CSW_AK47, 90);
w_print(id, "^1[^4STEAM^1] Вы получаете ^4AK47 ^1за ^3Steam");
}
case 3: {
w_drop(id, 1);
w_give(id, "weapon_famas");
cs_set_user_bpammo(id, CSW_FAMAS, 90);
w_print(id, "^1[^4STEAM^1] Вы получаете ^4FAMAS ^1за ^3Steam");
}
case 4: {
w_drop(id, 1);
w_give(id, "weapon_galil");
cs_set_user_bpammo(id, CSW_GALIL, 90);
w_print(id, "^1[^4STEAM^1] Вы получаете ^4GALIL ^1за ^3Steam");
}
case 5: {
cs_set_user_armor(id, 100, CsArmorType:2);
w_print(id, "^1[^4STEAM^1] Вы получаете ^4Броник ^1за ^3Steam");
}
case 6: {
w_give(id,"weapon_hegrenade"); w_give(id,"weapon_flashbang");
w_give(id,"weapon_flashbang"); w_give(id,"weapon_smokerenade");
w_print(id, "^1[^4STEAM^1] Вы получаете ^4Гранаты ^1за ^3Steam");
}
}
return PLUGIN_HANDLED;
}
stock w_give(id, weapon[]) {
if(!equal(weapon,"weapon_",7)) return 0;
new wEnt = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,weapon));
if(!pev_valid(wEnt)) return 0;
set_pev(wEnt,pev_spawnflags,SF_NORESPAWN);
dllfunc(DLLFunc_Spawn,wEnt);
if(!ExecuteHamB(Ham_AddPlayerItem,id,wEnt)) {
if(pev_valid(wEnt)) set_pev(wEnt,pev_flags,pev(wEnt,pev_flags) | FL_KILLME);
return 0;
}
ExecuteHamB(Ham_Item_AttachToPlayer,wEnt,id);
return 1;
}
stock w_print(const id, const input[], any:...) {
new iCount = 1, iPlayers[32];
static szMsg[191];
vformat(szMsg, charsmax(szMsg), input, 3);
if(id) iPlayers[0] = id;
else get_players(iPlayers, iCount, "ch");
for (new i; i < iCount; i++)
{
if (is_user_connected(iPlayer[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, iPlayers[i]);
write_byte(iPlayers[i]);
write_string(szMsg);
message_end();
}
}
}
stock bool:w_steam(index) {
static dp_pointer
if(dp_pointer || (dp_pointer = get_cvar_pointer("dp_r_id_provider")))
{
server_cmd("dp_clientinfo %d", index)
server_exec()
return (get_pcvar_num(dp_pointe) == 2) ? true : false
}
return false
}
stock w_drop(id, dropwhat) {
static weapons[32], num, i, weaponid;
num = 0;
get_user_weapons(id, weapons, num);
for (i = 0; i < num; i++)
{
weaponid = weapons[i]
if((dropwhat == 1 && ((1<<weaponid) & PRIMARY_W))) {
static wname[32];
get_weaponname(weaponid, wname, charsmax(wname));
engclient_cmd(id, "drop", wname);
}
}
}
-
В этой теме было размещено решение! Перейти к решению.
Вложения
-
19.7 KB Просмотры: 634