Название полученного оружия в чат!

Сообщения
165
Реакции
-8
Код:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>

new weapons[24][] = {"weapon_usp","weapon_glock18","weapon_deagle","weapon_p228","weapon_elite","weapon_fiveseven",    "weapon_m3","weapon_xm1014","weapon_tmp","weapon_mac10","weapon_mp5navy","weapon_p90",
                "weapon_ump45","weapon_famas","weapon_galil",    "weapon_ak47","weapon_m4a1","weapon_sg552",    "weapon_aug",    "weapon_scout","weapon_sg550","weapon_awp","weapon_g3sg1","weapon_m249"}

public plugin_init()
{
    register_plugin("Random Weapon T", "1.0", "Noovey")

    register_event("HLTV", "evNewRound", "a", "1=0", "2=0")
}

public evNewRound()
    set_task(0.01, "randPlayer")

public randPlayer()
{
    new players[32], count
    get_players(players, count, "ae", "TERRORIST")

    new player = players[random(count)]

    if(!player)
        return PLUGIN_HANDLED

    cs_set_weapon_ammo(give_item(player, weapons[random_num(0, 23)]), 1)

    return PLUGIN_HANDLED
}
 
Сообщения
165
Реакции
-8
Minni, там reapi , мне нужен hldrs , если сможешь помоги плиз !
 
Сообщения
1,698
Реакции
1,510
Помог
26 раз(а)
You can take the classname of the given item entity.
 
Сообщения
109
Реакции
79
Помог
1 раз(а)
Форматирование (BB-код):
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>

new weapons[24][] = {"weapon_usp","weapon_glock18","weapon_deagle","weapon_p228","weapon_elite","weapon_fiveseven",    "weapon_m3","weapon_xm1014","weapon_tmp","weapon_mac10","weapon_mp5navy","weapon_p90",
                "weapon_ump45","weapon_famas","weapon_galil",    "weapon_ak47","weapon_m4a1","weapon_sg552",    "weapon_aug",    "weapon_scout","weapon_sg550","weapon_awp","weapon_g3sg1","weapon_m249"}

public plugin_init()
{
    register_plugin("Random Weapon T", "1.0", "Noovey")

    register_event("HLTV", "evNewRound", "a", "1=0", "2=0")
}

public evNewRound()
    set_task(0.01, "randPlayer")

public randPlayer()
{
    new players[32], count
    get_players(players, count, "ae", "TERRORIST")

    new player = players[random(count)]

    if(!player)
        return PLUGIN_HANDLED

    new randomweapon = random_num(0, charsmax(weapons)-1)
    give_item(player, weapons[randomweapon])
    client_print_color(player, player, "^1You have taken ^3%s",weapons[randomweapon][7])

    return PLUGIN_HANDLED
}
 
Сообщения
1,420
Реакции
2,511
Помог
58 раз(а)
Yek'-ta,

Код:
-new randomweapon = random_num(0, charsmax(weapons)-1)
+new randomweapon = random_num(0, charsmax(weapons))
14 Июл 2019
Just an example.

Код:
#include <amxmodx>
#include <amxmisc>
#include <reapi>

new const g_szWeapons[][] =
{
    "weapon_usp", "weapon_glock18", "weapon_deagle", "weapon_p228", "weapon_elite", "weapon_fiveseven", "weapon_m3", "weapon_xm1014",
    "weapon_tmp", "weapon_mac10", "weapon_mp5navy", "weapon_p90", "weapon_ump45", "weapon_famas", "weapon_galil", "weapon_ak47",
    "weapon_m4a1", "weapon_sg552", "weapon_aug", "weapon_scout", "weapon_sg550", "weapon_awp", "weapon_g3sg1", "weapon_m249"
};

new const g_szWeaponNames[][] =
{
    "USP", "Glock 18", "Deagle", "P228", "Elite", "Five-SeveN", "M3", "XM1014",
    "TMP", "Mac-10", "MP5 Navy", "P90", "UMP-45", "FAMAS", "Galil", "AK-47",
    "M4A1", "SG552", "AUG", "Scout", "SG550", "AWP", "G3SG1", "M249"
};

public plugin_init()
{
    register_plugin("Random Weapon New Round", "1.0", "w0w")
    RegisterHookChain(RG_CSGameRules_RestartRound, "refwd_NewRound_Post", true);
}

public refwd_NewRound_Post()
{
    new iPlayers[MAX_PLAYERS], iPlayerCount;
    get_players_ex(iPlayers, iPlayerCount, GetPlayers_ExcludeDead|GetPlayers_MatchTeam, "TERRORIST");

    if(!iPlayerCount)
        return;

    new iPlayer = iPlayers[random(iPlayerCount)];

    if(!iPlayer)
        return;

    new iRandomWeapon = random_num(0, charsmax(g_szWeapons));

    new iWeapon = rg_give_item(iPlayer, g_szWeapons[iRandomWeapon]);

    if(iWeapon == NULLENT)
        return;

    new WeaponIdType:iId = get_member(iWeapon, m_iId);
    rg_set_user_bpammo(iPlayer, iId, rg_get_weapon_info(iId, WI_MAX_ROUNDS));

    client_print_color(iPlayer, print_team_default, "^4* ^1You got ^4%s", g_szWeaponNames[iRandomWeapon]);
}
 

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу