Правила форума Гаранты форума
Размещение рекламы AMX-X компилятор

Здравствуйте, гость Вход | Регистрация

Наши новости:

14-дек
24-апр
10-апр
11-апр

3 страниц V   1 2 3

дабы попрактиковаться

Статус пользователя GOOD FELLOW
сообщение 26.7.2014, 8:38
Сообщение #21


Иконка группы

Стаж: 13 лет

Сообщений: 2294
Благодарностей: 1187
Полезность: 890

andreiwiz, обновил, попробуй)
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
nastia777
сообщение 26.7.2014, 8:41
Сообщение #22
Стаж: 13 лет

Сообщений: 606
Благодарностей: 485
Полезность: 510

GOOD FELLOW

вот твой код что ты скидывал можешь его поправить ?

когда пишет рядовой ну или (любой другой игрок с другим званием)
я всех вижу в чате как старшына (мое звание)
должно быть вот вак [admin] [звание] чат

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

#define PLUGIN "Admin Chat Colors"
#define VERSION "2.0"
#define AUTHOR "Arion"

#define ACCESS_LEVEL ADMIN_CHAT
#define ADMIN_LISTEN ADMIN_BAN

new message[192]
new sayText
new teamInfo
new maxPlayers

new g_MessageColor
new g_NameColor
new g_AdminListen

new strName[191]
new strText[191]
new alive[11]

public plugin_init()
{
register_plugin (PLUGIN, VERSION, AUTHOR)

g_MessageColor = register_cvar ("amx_color", "2") // Message colors: [1] Default Yellow, [2] Green, [3] White, [4] Blue, [5] Red

g_NameColor = register_cvar ("amx_namecolor", "6") // Name colors: [1] Default Yellow, [2] Green, [3] White, [4] Blue, [5] Red, [6] Team-color

g_AdminListen = register_cvar ("amx_listen", "1") // Set whether admins see or not all messages (Alive, dead and team-only)


sayText = get_user_msgid ("SayText")
teamInfo = get_user_msgid ("TeamInfo")
maxPlayers = get_maxplayers()



register_clcmd ("amx_color", "set_color", ACCESS_LEVEL, "<color>")
register_clcmd ("amx_namecolor", "set_name_color", ACCESS_LEVEL, "<color>")
register_clcmd ("amx_listen", "set_listen", ACCESS_LEVEL, "<1 | 0>")

register_clcmd ("say", "hook_say")
register_clcmd ("say_team", "hook_teamsay")
}




public hook_say(id)
{
read_args (message, 191)
remove_quotes (message)

if (message[0] == '@' || message[0] == '/' || message[0] == '!' || equal (message, "")) // Ignores Admin Hud Messages, Admin Slash commands,
// Gungame commands and empty messages
return PLUGIN_CONTINUE


new name[32]
get_user_name (id, name, 31)

new bool:admin = false

if (get_user_flags(id) & ACCESS_LEVEL)
admin = true


new isAlive

if (is_user_alive (id))
{
isAlive = 1
alive = "^x01"
}
else
{
isAlive = 0
alive = "^x01*DEAD* "
}

static color[10]



if (admin)
{
// Name
switch (get_pcvar_num (g_NameColor))
{
case 1:
format (strName, 191, "%s%s", alive, name)

case 2:
format (strName, 191, "%s^x04%s", alive, name)

case 3:
{
color = "SPECTATOR"
format (strName, 191, "%s^x03%s", alive, name)
}

case 4:
{
color = "CT"
format (strName, 191, "%s^x03%s", alive, name)
}

case 5:
{
color = "TERRORIST"
format (strName, 191, "%s^x03%s", alive, name)
}

case 6:
{
get_user_team (id, color, 9)

format (strName, 191, "%s^x03%s", alive, name)
}
}


// Message
switch (get_pcvar_num (g_MessageColor))
{
case 1: // Yellow
format (strText, 191, "%s", message)

case 2: // Green
format (strText, 191, "^x04%s", message)

case 3: // White
{
copy (color, 9, "SPECTATOR")
format (strText, 191, "^x03%s", message)
}

case 4: // Blue
{
copy (color, 9, "CT")
format (strText, 191, "^x03%s", message)
}

case 5: // Red
{
copy (color, 9, "TERRORIST")
format (strText, 191, "^x03%s", message)
}
}
}

else // Player is not admin. Team-color name : Yellow message
{
get_user_team (id, color, 9)

format (strName, 191, "%s^x03%s", alive, name)

format (strText, 191, "%s", message)
}

format (message, 191, "%s^x01 : %s", strName, strText)

sendMessage (color, isAlive) // Sends the colored message

return PLUGIN_HANDLED
}


public hook_teamsay(id)
{
new playerTeam = get_user_team(id)
new playerTeamName[19]

switch (playerTeam) // Team names which appear on team-only messages
{
case 1:
copy (playerTeamName, 11, "Terrorists")

case 2:
copy (playerTeamName, 18, "Counter-Terrorists")

default:
copy (playerTeamName, 9, "Spectator")
}

read_args (message, 191)
remove_quotes (message)

if (message[0] == '@' || message[0] == '/' || message[0] == '!' || equal (message, "")) // Ignores Admin Hud Messages, Admin Slash commands,
// Gungame commands and empty messages
return PLUGIN_CONTINUE


new name[32]
get_user_name (id, name, 31)

new bool:admin = false

if (get_user_flags(id) & ACCESS_LEVEL)
admin = true


new isAlive

if (is_user_alive (id))
{
isAlive = 1
alive = "^x01"
}
else
{
isAlive = 0
alive = "^x01*DEAD* "
}

static color[10]



if (admin)
{
// Name
switch (get_pcvar_num (g_NameColor))
{
case 1:
format (strName, 191, "%s(%s) %s", alive, playerTeamName, name)

case 2:
format (strName, 191, "%s(%s) ^x04%s", alive, playerTeamName, name)

case 3:
{
color = "SPECTATOR"
format (strName, 191, "%s(%s) ^x03%s", alive, playerTeamName, name)
}

case 4:
{
color = "CT"
format (strName, 191, "%s(%s) ^x03%s", alive, playerTeamName, name)
}

case 5:
{
color = "TERRORIST"
format (strName, 191, "%s(%s) ^x03%s", alive, playerTeamName, name)
}

case 6:
{
get_user_team (id, color, 9)

format (strName, 191, "%s(%s) ^x03%s", alive, playerTeamName, name)
}
}


// Message
switch (get_pcvar_num (g_MessageColor))
{
case 1: // Yellow
format (strText, 191, "%s", message)

case 2: // Green
format (strText, 191, "^x04%s", message)

case 3: // White
{
copy (color, 9, "SPECTATOR")
format (strText, 191, "^x03%s", message)
}

case 4: // Blue
{
copy (color, 9, "CT")
format (strText, 191, "^x03%s", message)
}

case 5: // Red
{
copy (color, 9, "TERRORIST")
format (strText, 191, "^x03%s", message)
}
}
}

else // Player is not admin. Team-color name : Yellow message
{
get_user_team (id, color, 9)

format (strName, 191, "%s(%s) ^x03%s", alive, playerTeamName, name)

format (strText, 191, "%s", message)
}

format (message, 191, "%s ^x01: %s", strName, strText)

sendTeamMessage (color, isAlive, playerTeam) // Sends the colored message

return PLUGIN_HANDLED
}


public set_color (id, level, cid)
{
if (!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED

new arg[1], newColor
read_argv (1, arg, 1)

newColor = str_to_num (arg)

if (newColor >= 1 && newColor <= 5)
{
set_cvar_num ("amx_color", newColor)
set_pcvar_num (g_MessageColor, newColor)

if (get_pcvar_num (g_NameColor) != 1 &&
((newColor == 3 && get_pcvar_num (g_NameColor) != 3)
|| (newColor == 4 && get_pcvar_num (g_NameColor) != 4)
|| (newColor == 5 && get_pcvar_num (g_NameColor) != 5)))
{
set_cvar_num ("amx_namecolor", 2)
set_pcvar_num (g_NameColor, 2)
}
}

return PLUGIN_HANDLED
}


public set_name_color (id, level, cid)
{
if (!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED

new arg[1], newColor
read_argv (1, arg, 1)

newColor = str_to_num (arg)

if (newColor >= 1 && newColor <= 6)
{
set_cvar_num ("amx_namecolor", newColor)
set_pcvar_num (g_NameColor, newColor)

if ((get_pcvar_num (g_MessageColor) != 1
&& ((newColor == 3 && get_pcvar_num (g_MessageColor) != 3)
|| (newColor == 4 && get_pcvar_num (g_MessageColor) != 4)
|| (newColor == 5 && get_pcvar_num (g_MessageColor) != 5)))
|| get_pcvar_num (g_NameColor) == 6)
{
set_cvar_num ("amx_color", 2)
set_pcvar_num (g_MessageColor, 2)
}
}

return PLUGIN_HANDLED
}


public set_listen (id, level, cid)
{
if (!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED

new arg[1], newListen
read_argv(1, arg, 1)

newListen = str_to_num (arg)

set_cvar_num ("amx_listen", newListen)
set_pcvar_num (g_AdminListen, newListen)

return PLUGIN_HANDLED
}


public sendMessage (color[], alive)
{
new teamName[10]

for (new player = 1; player < maxPlayers; player++)
{
if (!is_user_connected(player))
continue

if (alive && is_user_alive(player) || !alive && !is_user_alive(player) || get_pcvar_num(g_AdminListen) && get_user_flags(player) & ADMIN_LISTEN)
{
get_user_team (player, teamName, 9) // Stores user's team name to change back after sending the message

changeTeamInfo (player, color) // Changes user's team according to color choosen

writeMessage (player, message) // Writes the message on player's chat

changeTeamInfo (player, teamName) // Changes user's team back to original
}
}
}


public sendTeamMessage (color[], alive, playerTeam)
{
new teamName[10]

for (new player = 1; player < maxPlayers; player++)
{
if (!is_user_connected(player))
continue

if (get_user_team(player) == playerTeam || get_pcvar_num(g_AdminListen) && get_user_flags(player) & ADMIN_LISTEN)
{
if (alive && is_user_alive(player) || !alive && !is_user_alive(player) || get_pcvar_num(g_AdminListen) && get_user_flags(player) & ADMIN_LISTEN)
{
get_user_team (player, teamName, 9) // Stores user's team name to change back after sending the message

changeTeamInfo (player, color) // Changes user's team according to color choosen

writeMessage (player, message) // Writes the message on player's chat

changeTeamInfo (player, teamName) // Changes user's team back to original
}
}
}
}


public changeTeamInfo (player, team[])
{
message_begin (MSG_ONE, teamInfo, _, player) // Tells to to modify teamInfo (Which is responsable for which time player is)
write_byte (player) // Write byte needed
write_string (team) // Changes player's team
message_end() // Also Needed
}


public writeMessage (player, message[])
{
emessage_begin (MSG_ONE, sayText, {0, 0, 0}, player) // Tells to modify sayText (Which is responsable for writing colored messages)
ewrite_byte (player) // Write byte needed
ewrite_string (message) // Effectively write the message, finally, afterall
emessage_end () // Needed as always
}
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя GOOD FELLOW
сообщение 26.7.2014, 8:43
Сообщение #23


Иконка группы

Стаж: 13 лет

Сообщений: 2294
Благодарностей: 1187
Полезность: 890

приставку [admin] в чате надо?
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
andreiwiz
сообщение 26.7.2014, 8:45
Сообщение #24
Стаж: 11 лет

Сообщений: 335
Благодарностей: 29
Полезность: 0

GOOD FELLOW,
заходи)
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
nastia777
сообщение 26.7.2014, 8:47
Сообщение #25
Стаж: 13 лет

Сообщений: 606
Благодарностей: 485
Полезность: 510

да желательно что бы приставка была !

Очень бы было хорошо
что бы было вот так
[Admin] [звание] чат
[Vip] [звание] чат
и сделать по флагам например
d префикс admin
t префикс vip
если админка + vip то будет первый флаг главным [admin]
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
andreiwiz
сообщение 26.7.2014, 8:48
Сообщение #26
Стаж: 11 лет

Сообщений: 335
Благодарностей: 29
Полезность: 0

nastia777,
prefixManager.amxx by serfreeman1337
вот так у меня, но можно ещё и админ воткнуть, так же и вип, и девушка.

Отредактировал: andreiwiz, - 26.7.2014, 8:50
Прикрепленные файлы:
Прикрепленное изображение
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
nastia777
сообщение 26.7.2014, 8:50
Сообщение #27
Стаж: 13 лет

Сообщений: 606
Благодарностей: 485
Полезность: 510

Цитата(andreiwiz @ 26.7.2014, 8:48) *
nastia777,
prefixManager.amxx by serfreeman1337

да знаю но у меня не работает !
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя GOOD FELLOW
сообщение 26.7.2014, 8:51
Сообщение #28


Иконка группы

Стаж: 13 лет

Сообщений: 2294
Благодарностей: 1187
Полезность: 890

andreiwiz,
поправил, попробуй теперь:)
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
andreiwiz
сообщение 26.7.2014, 8:54
Сообщение #29
Стаж: 11 лет

Сообщений: 335
Благодарностей: 29
Полезность: 0

GOOD FELLOW,
заходи)
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя GOOD FELLOW
сообщение 26.7.2014, 8:56
Сообщение #30


Иконка группы

Стаж: 13 лет

Сообщений: 2294
Благодарностей: 1187
Полезность: 890

andreiwiz, мне на работу бежать надо) протестируйте пожалуйста с кем-то
если опять все бредово, то подумаю еще
и надеюсь, что по опытнее помогут:)
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
andreiwiz
сообщение 26.7.2014, 8:58
Сообщение #31
Стаж: 11 лет

Сообщений: 335
Благодарностей: 29
Полезность: 0

GOOD FELLOW,
отпишу потом)
и ещё надо будет тебе, мне не много помочь))
* идейка появилась) добавить ещё в message убил вас с ножа, и отнял N денег, и квар может ещё добавить? сколько денег отнимается если вас убили с ножа.
* и вот моя просьба)
вобщем, плагин kill_rewards, бонусы за убийства,
там есть настройка
Скрытый текст
// Включение восстановления патронов при убийстве / switching-on rewards ammo for kills
amxr_refill_on 0 ( no умолчанию ( Default ) - 1 )
// Сколько % патронов восстановить при убийстве / How many % ammo restore on kill
amxr_refill_prc 50 ( по умолчанию ( Default ) - 50 )
// Сколько % патронов восстановить при убийстве в голову / How many % ammo restore on headshot kill
amxr_refill_prchs 90 ( по умолчанию ( Default ) - 90 )


и я это отключил, потому что не тестил данный квар)
так как у меня стоит gg_ammo, и хотелось бы туда вписать часть кода от него, что бы пополнялась вся обойма при убийстве, не за хедшот, а просто за убийство как в gg_ammo...
в архиве cfg kill_rewards, .sma, и sma gg_ammo. Если нужно)

Отредактировал: andreiwiz, - 26.7.2014, 9:11
Прикрепленные файлы:
Прикрепленный файл  Desktop.rar ( 18,6 килобайт ) Кол-во скачиваний: 2
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
andreiwiz
сообщение 26.7.2014, 9:15
Сообщение #32
Стаж: 11 лет

Сообщений: 335
Благодарностей: 29
Полезность: 0

PS. убил с ножа я, и xa_nub получил все сбережения HMPP # AndreiWIZ :)
убил он меня, и якобы получил бонус я)) но денег не добавилось;)
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
dimka198
сообщение 26.7.2014, 20:16
Сообщение #33
Стаж: 12 лет

Сообщений: 1541
Благодарностей: 283
Полезность: 13

GOOD FELLOW,
а что по поводу игрушки?реально реализовать?
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя GOOD FELLOW
сообщение 26.7.2014, 20:17
Сообщение #34


Иконка группы

Стаж: 13 лет

Сообщений: 2294
Благодарностей: 1187
Полезность: 890

dimka198, вообще - реально, но мне нужно время будет:)
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя Bloo
сообщение 26.7.2014, 20:25
Сообщение #35


Стаж: 12 лет

Сообщений: 15547
Благодарностей: 6971
Полезность: 1206

GOOD FELLOW, ну раз уж такой добрый :) , сможешь сделать плагин запрета дозакупки грен? Т.е. каждый игрок за раунд может купить 1 HE 2 FB и 1 SG. Есть подобные, но они все какие то баговы, видимо по тому что очень старые, конкретные баги которые встречаются в подобных плагинах:
Запрет покупки Defuse Kit
Лимит распространяется на всю команду
Полный запрет покупки грен без учета лимита
Лимит ставится на карту, а не раунд
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя GOOD FELLOW
сообщение 26.7.2014, 20:34
Сообщение #36


Иконка группы

Стаж: 13 лет

Сообщений: 2294
Благодарностей: 1187
Полезность: 890

Bloo,
могу подредачить уже имеющийся)) если есть
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя Bloo
сообщение 26.7.2014, 20:38
Сообщение #37


Стаж: 12 лет

Сообщений: 15547
Благодарностей: 6971
Полезность: 1206

GOOD FELLOW, вот в этом дополнительно запрещается покупка Defuse Kit. Все баги не могу щас точно сказать, и проверить не могу, т.к. сервер офф, лучше тогда будет повременить, я все точно проверю и все опишу.
Код:
/**
Credit:
AMXX Dev Team: Restrict Weapons
hoboman313: Hobo Nade Management (offsets, etc.)
OT: Flashbang Remote Control (gravity check)

Description:
Limit the number of grenades a player can buy/use
Block limited action before they can be performed instead of taking away
hp from players afterward

Compatibility:
Tested to work with all known weapon drop plugins:
Real Nade Drops, Real Weapon Drop, Weapons Drop Ability, etc.

CVars:
nl_limit_buy 1:
nl_limit_use 0:
0: no limit
1: enabled

nl_buy_flash 3:
nl_buy_hegren 2:
nl_buy_sgren 2:
nl_buy_all 5:
nl_use_flash 3:
nl_use_hegren 2:
nl_use_sgren 2:
nl_use_all 5:
0: no limit
positive values: limit amount

nl_early_msg 1:
0: message when exceeding limit
1: message when reaching limit

Command:
nl_reset:
Reset count for all players

Client commands:
say /nl:
say_team /nl:
Display limits in chat

Changelog:
0.5.2:
Minor optimization: no longer uses add string native

0.5.1:
Minor code optimization
Reorganized some code; added comments

0.5:
Improved compatibility of grenade throw detection
Improved behavior when switching to last weapon
Added primary attack check (optional)
Added ML support
Added say /nl command, report limits set by the server
Removed many loops; uses trie in some part
Removed dependency on csx module
CVar changes:
Changed nbl prefix to nl
Removed nbl_limit_type, now always per respawn
Renamed nbl_limit_msg to nl_early_msg
Removed nade-specific limit cvars
Added nade-specific limit cvars for each action type
Added nl_limit_buy, works similarly to nl_limit_use
Negative values no longer have any effect
Changed some default values (see CVars section for details)

0.4:
Added nbl_limit_use cvar
Added nbl_limit_msg cvar
Added nbl_all cvar
Setting a limit to 0 now disables that specific limit
Various bug fixes
Reorganized some code
Fixed tag mismatch compiler warnings

0.3:
Bug fix for rebuy/autobuy

0.2:
Bug fix
Added nbl_reset command

0.1:
Initial release
**/

// In case something was missed by the CurWeapon hook
// Will be called every frame when the attack button is held down
// #define USE_CHECK_PRIMARY_ATTACK

// Affect:
// buy command (rebuy/autobuy)
// class name (last weapon switch)
// model (grenade throw)
// Not really necessary as far as I can tell
// #define CASE_INSENSITIVE_TRIE

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>

/// Constants & globals ///
// Constants
const player_id_max = 33
enum action_id { action_buy, action_use, action_id_max }
const nade_id_max = 3
new action_cmd[][] = {"buy", "use"}
new nade_cmd[][] = {"flash", "hegren", "sgren", "all"}
new nade_wid[] = {CSW_FLASHBANG, CSW_HEGRENADE, CSW_SMOKEGRENADE}
new nade_wname[][] = {"weapon_flashbang", "weapon_hegrenade", "weapon_smokegrenade"}
new nade_wname_i = 7 // "weapon_" prefix length
new nade_model[][] = {"w_flashbang.mdl", "w_hegrenade.mdl", "w_smokegrenade.mdl"}
new nade_model_i = 7 // "models/" prefix length
new nade_menu_name[] = "BuyItem" // Old-style menu
new nade_menu_id = -34 // VGUI menu
new nade_menu_key[] = {MENU_KEY_3, MENU_KEY_4, MENU_KEY_5}
new nade_ammo_max[] = {2, 1, 1}
new nade_ammo_offset[] = {387, 388, 389}
new last_item_offset = 375
new last_item_alt[] = "weapon_knife"
// These will be initialized in plugin_init
new Trie:nade_cmd_trie
new Trie:nade_wname_trie
new Trie:nade_model_trie

// CVars
// Initial values will be replaced by cvar pointers by register_cvar_num
new action_limit[] = {1, 0}
new nade_limit[][] = {{3, 2, 2, 5}, {3, 2, 2, 5}}
new early_msg = 1

// Other globals
new nade_count[player_id_max][_:action_id_max][nade_id_max + 1]

/// Utilities ///
// String
// Length constants for temporary buffers
const str_len = 128
const str_len2 = 32
const str_len3 = 16

// As a convention, the last parameter is always the output string
#define concat(%1,%2,%3) concat_l(%1,%2,%3,sizeof %3)
#define concat_sd(%1,%2,%3) concat_l_sd(%1,%2,%3,sizeof %3)
#define concat_s_s(%1,%2,%3) concat_l_s_s(%1,%2,%3,sizeof %3)
#define str_copy(%1,%2) str_l_copy(%1,%2,sizeof %2)
#define str_upper(%1,%2) str_l_upper(%1,%2,sizeof %2)
#define num_str(%1,%2) num_l_str(%1,%2,sizeof %2)
#define mls_str(%1,%2,%3,%4) (mls_l_str_l(%1,%2,%3,%4,sizeof %4),%4)
// With explicit length as the last parameter
#define concat_l(%1,%2,%3,%4) (formatex(%3,%4-1,"%s%s",%1,%2),%3)
#define concat_l_sd(%1,%2,%3,%4) (formatex(%3,%4-1,"%s%d",%1,%2),%3)
#define concat_l_s_s(%1,%2,%3,%4) (formatex(%3,%4-1,"%s_%s",%1,%2),%3)
#define str_l_copy(%1,%2,%3) (copy(%2,%3-1,%1),%2)
#define str_l_upper(%1,%2,%3) (strtoupper(str_l_copy(%1,%2,%3)),%2)
#define num_l_str(%1,%2,%3) (num_to_str(%1,%2,%3-1),%2)
#define mls_l_str_l(%1,%2,%3,%4,%5) formatex(%4,%5-1,"%L",%1,%2,%3)

// Message
const Float:welcome_msg_delay = 25.0
#define action_ml(%1,%2) action_l_ml(%1,%2,sizeof %2)
#define nade_ml(%1,%2) nade_l_ml(%1,%2,sizeof %2)
#define action_l_ml(%1,%2,%3) str_l_upper(action_cmd[%1],%2,%3)
#define nade_l_ml(%1,%2,%3) str_l_upper(nade_cmd[%1],%2,%3)

// CVar/command
register_cvar_num(&p, const c[])
{
new s[str_len3]
p = register_cvar(c, num_str(p, s))
}
register_saycmd(const cmd[], const func[], flag, const info[])
{
new say_prefix[][] = {"say ", "say_team "}, s[str_len2]
for(new i; i < sizeof say_prefix; i++)
register_clcmd(concat(say_prefix[i], cmd, s), func, flag, info)
}

// CVar access
cvar_enabled(c, n = 0, &v = 0)
return (v = get_pcvar_num©) > n
limiting_nade(j, i, &l = 0)
return cvar_enabled(nade_limit[j][i], 0, l)
limiting_action(actn)
return cvar_enabled(action_limit[actn])
limiting_id_action(id, actn)
return is_user_alive(id) && limiting_action(actn)

// Trie access
#if defined CASE_INSENSITIVE_TRIE
trie_name_nid(Trie:t, const n[], &i)
{
new s[str_len2]
return trie_name_str_nid(t, str_copy(n, s), i)
}
trie_name_str_nid(Trie:t, s[], &i) return TrieGetCell(t, (strtolower(s), s), i)
#else
trie_name_nid(Trie:t, const n[], &i) return TrieGetCell(t, n, i)
trie_name_str_nid(Trie:t, s[], &i) return trie_name_nid(t, s, i)
#endif

/// Main ///
public plugin_init()
{
register_plugin("Nade Limit", "0.5", "K.Nk")
register_dictionary("nadelimit.txt")

register_concmd("nl_reset", "reset_count_all", ADMIN_LEVEL_A)
register_cvar_num(early_msg, "nl_early_msg")

new s[str_len2], s2[str_len2]
// Action-specific cvars
for(new j; j < _:action_id_max; j++)
{
register_cvar_num(action_limit[j],
concat_s_s("nl_limit", action_cmd[j], s))
// Nade-specific cvars
for(new i; i <= nade_id_max; i++)
register_cvar_num(nade_limit[j][i],
concat_s_s(concat_s_s("nl", action_cmd[j], s), nade_cmd[i], s2))
}
// Initialize tries
nade_cmd_trie = TrieCreate()
nade_wname_trie = TrieCreate()
nade_model_trie = TrieCreate()
// Other nade-specific stuff
for(new i; i < nade_id_max; i++)
{
// Buy menu/command hook
register_menucmd(register_menuid(nade_menu_name, 1),
nade_menu_key[i], concat_sd("buy_command", i, s))
register_menucmd(nade_menu_id,
nade_menu_key[i], concat_sd("buy_command", i, s))
register_clcmd(nade_cmd[i], concat_sd("buy_command", i, s))
#if defined USE_CHECK_PRIMARY_ATTACK
// Primary attack hook
RegisterHam(Ham_Weapon_PrimaryAttack,
nade_wname[i], concat_sd("primary_attack", i, s))
#endif
// CurWeapon hook
register_event("CurWeapon", concat_sd("cur_weapon", i, s), "be",
"1=1", concat_sd("2=", nade_wid[i], s2))
// Populate tries
TrieSetCell(nade_cmd_trie, nade_cmd[i], i)
TrieSetCell(nade_wname_trie, nade_wname[i][nade_wname_i], i)
TrieSetCell(nade_model_trie, nade_model[i], i)
}
// SetModel hook
register_forward(FM_SetModel, "set_model_post", 1)
// Reset condition hook
RegisterHam(Ham_Spawn, "player", "reset_count", 1)
// Say command
register_saycmd("/nl", "say_nl", 0, "- display nade limit info.")
}

/// Misc. ///
// Count reset
public reset_count(pid)
{
// Can't assign multidimensional array directly, so loop
new zeros[nade_id_max]
for(new j; j < _:action_id_max; j++)
nade_count[pid][j] = zeros
}
public reset_count_all()
for(new i; i < player_id_max; i++)
reset_count(i)

// Welcome message
public client_putinserver(pid)
is_user_bot(pid) ||
set_task(welcome_msg_delay, "show_welcome_msg", pid)
public show_welcome_msg(id)
// Don't display welcome message if no limit is set
// Check if any action limit is set
for(new j; j < _:action_id_max; j++)
if(limiting_action(j))
// Check if any nade limit for action j is set
for(new i; i <= nade_id_max; i++)
if(limiting_nade(j, i))
{
// Now display welcome message
client_print(id, print_chat, "%L", id, "WELCOME")
return
}

// Say command, report limits
public say_nl(id)
{
new j, s2[str_len2], s3[str_len3]
// For each action type
for(; j < _:action_id_max; j++)
{
new s[str_len]
// Get limit info in s
say_action(id, j, s, s2, s3)
// Print s
client_print(id, print_chat, "%L",
id, concat_s_s("REPORT", action_ml(j, s2), s3), s)
}
return PLUGIN_HANDLED
}

say_action(id, j, s[], s2[], s3[],
s_len = sizeof s, s2_len = sizeof s2, s3_len = sizeof s3)
limiting_action(j) &&
// Get nade limits for action j, starting at nid = 0
say_nade(id, j, 0, 0, s, s2, s3, s_len, s2_len, s3_len) ||
// Report disabled if no nade limit
mls_l_str_l(id, "REPORT_DISABLED", "", s, s_len)

say_nade(id, j, i, k, s[], s2[], s3[], s_len, s2_len, s3_len)
{
if(i <= nade_id_max)
{
new l, r
if(limiting_nade(j, i, l))
{
r = mls_l_str_l(id, \
concat_l_s_s("REPORT_NADE", nade_l_ml(i, s, s_len), s2, s2_len), \
num_l_str(l, s3, s3_len), s, s_len)
k++ && (r = mls_l_str_l(id, "REPORT_NADE_SEPARATOR", s, s2, s2_len),
str_l_copy(s2, s, s_len))
}
// Get next nade limit
return say_nade(id, j, i + 1, k, s[r], s2, s3, s_len - r, s2_len, s3_len)
}
return k
}

/// Check helpers ///
print_limit_msg(pid, actn, nid)
{
new s[str_len2], s2[str_len2], s3[str_len2], s4[str_len2]
client_print(pid, print_center, "%L", pid,
// "NOTIFY_*"
concat_s_s("NOTIFY", action_ml(actn, s), s2),
// "NOTIFY_NADE_*"
mls_str(pid, concat_s_s("NOTIFY_NADE", nade_ml(nid, s3), s4), "", s3))
return true
}

limit_check_and_notify(pid, actn, nid)
return \
limit_reached(pid, actn, nade_id_max) &&
print_limit_msg(pid, actn, nade_id_max) ||
limit_reached(pid, actn, nid) &&
print_limit_msg(pid, actn, nid)

limit_reached(id, j, i, &l = 0)
return limiting_nade(j, i, l) && nade_count[id][j][i] >= l
limit_reached_any(id, j, i)
return limit_reached(id, j, i) || limit_reached(id, j, nade_id_max)
nade_count_inc(id, actn, i)
{
nade_count[id][actn][i]++
nade_count[id][actn][nade_id_max]++
}

/// Buy check ///
buy_limit_check(pid, nid)
{
if(limit_check_and_notify(pid, action_buy, nid))
return PLUGIN_HANDLED
else
// Ammo check
get_pdata_int(pid, nade_ammo_offset[nid]) < nade_ammo_max[nid] && (
// Nade will be bought, increase counter
nade_count_inc(pid, action_buy, nid),
// Early message
cvar_enabled(early_msg) &&
limit_check_and_notify(pid, action_buy, nid))
return PLUGIN_CONTINUE
}

// Forward from cstrike module for rebuy/autobuy
public CS_InternalCommand(id, const cmd[])
{
if(limiting_id_action(id, action_buy))
{
new i
if(trie_name_nid(nade_cmd_trie, cmd, i))
return buy_limit_check(id, i)
}
return PLUGIN_CONTINUE
}

public buy_command0(id) return buy_command(id, 0)
public buy_command1(id) return buy_command(id, 1)
public buy_command2(id) return buy_command(id, 2)
buy_command(id, i)
return \
limiting_id_action(id, action_buy) ?
buy_limit_check(id, i) :
PLUGIN_CONTINUE

/// Use check ///
use_weapon_switch(id)
{
// Switch to last weapon,
// unless that weapon is a nade and the limit for that nade is reached,
// then we use the default alternative
new ent = get_pdata_cbase(id, last_item_offset)
if(pev_valid(ent))
{
new s[str_len2], i
pev(ent, pev_classname, s, str_len2 - 1)
// Check entity class name, is it a nade?
// If so, has its limit been reached?
if(!trie_name_str_nid(nade_wname_trie, s[nade_wname_i], i) ||
!limit_reached_any(id, action_use, i))
{
// Switch to last weapon
client_cmd(id, "lastinv")
return
}
}
// Switch to default alternative
client_cmd(id, last_item_alt)
}

// Grenade throw detection
// Similar to the grenade_throw forward from csx module, but more reliable
public set_model_post(ent, const mdl[])
{
if(pev_valid(ent))
{
new Float:f
pev(ent, pev_gravity, f)
// Thrown grenade has gravity
if(f != 0.0)
{
// Now get the owner
new id = pev(ent, pev_owner)
if(limiting_id_action(id, action_use))
{
new i
// Is this actually a nade?
if(trie_name_nid(nade_model_trie, mdl[nade_model_i], i))
{
// So a nade's been thrown, increase counter
// Check the limit before that however so early message
// would work correctly
new b = limit_check_and_notify(id, action_use, i)
// Now increase counter
nade_count_inc(id, action_use, i)
// Early message
b || cvar_enabled(early_msg) &&
limit_check_and_notify(id, action_use, i)
}
}
}
}
return FMRES_IGNORED
}

#if defined USE_CHECK_PRIMARY_ATTACK
public primary_attack0(ent) primary_attack(ent, 0)
public primary_attack1(ent) primary_attack(ent, 1)
public primary_attack2(ent) primary_attack(ent, 2)
primary_attack(ent, i)
pev_valid(ent) &&
cur_weapon(pev(ent, pev_owner), i)
#endif

public cur_weapon0(id) cur_weapon(id, 0)
public cur_weapon1(id) cur_weapon(id, 1)
public cur_weapon2(id) cur_weapon(id, 2)
cur_weapon(id, i)
limiting_id_action(id, action_use) &&
limit_check_and_notify(id, action_use, i) &&
use_weapon_switch(id)
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя GOOD FELLOW
сообщение 26.7.2014, 20:39
Сообщение #38


Иконка группы

Стаж: 13 лет

Сообщений: 2294
Благодарностей: 1187
Полезность: 890

Код:
/*Grenade Spam Punish
*
* by [gOf]-Soul from http://www.gofclan.org
*
* This is a very simple plugin I wrote to control grenade spamming.
* There were a couple different plugins out that would seem to control
* grenade spamming. But they blocked if you would try to buy extra
* grenades. The ones I tried only blocked you from buying them via
* the regular menu. This plugin keeps you from throwing more grenades
* than the allotted number of grenades allowed by the configuration file
*
* The plugin requires that you use the engine module of amxmodx because
* I remove any grenades from the environment that should NOT have been
* thrown. If you do not want to enable the engine module you can remove
* the requirement by removing the remove_entity(greindex) line at the
* bottom of the script.
*
* Config Flags
* -----------------------------------------------------------------------------
* cvar : mp_grenspampunish
* description: cvar that determins if the grenade spam punish plugin is
* enabled possible values are 1 and 0. To enable the plugin
* set it to 1 to disable the plugin just set it to 0.
* default : 1 (enabled)
*
* cvar : mp_grenspampunish_maxflash
* description: Maximum number of flash bangs allowed to be thrown per round
* default : 2
*
* cvar : mp_grenspampunish_maxhe
* description: Maximum number of he grenades allowed to be thrown per round
* default : 1
*
* cvar : mp_grenspampunish_maxsmoke
* description: Maximum number of smoke grenades allowed to be thrown per round
* default : 1
*
* cvar : mp_grenspampunish_damage
* description: Amount of damage to inflict if someone violates the spam plugin
* Damage of 100 will automatically kill them. The plugin uses the
* user_slap to inflict the damage
* default : 100
*
*
* To load settings for a certain map then place them into the map specific
* config files i.e. amxmodx/configs/maps/de_dust.cfg
*
* -----------------------------------------------------------------------------
*
* **************
* * CHANGE LOG *
* **************
* v1.4
* -Changed Array Declaration to get rid of out of bound error for
* the grencount array
*
* v1.3
* -Took out cstrike reference
* -Code cleanup (thanks to vittu)
*
* v1.2
* -Removed the config file. Place configuration directly into amxx.cfg
* -For map specific configs use the map specific config features provided
* by AmxModx
* -Updated for pcvars - requires 1.70 and higher to use
* -Updated to more dependable register_logevent("funcNewRound", 2, "1=Round_Start")
* instead of ResetHud event
* -Fixed bug of not clearing number of throws when a person joins the server
* caused someone to get punished on first throw
*
* v1.1
* -Updated the plugin to not write the grenade count information
* to the vault. Just used a global variable
*
* -Added map specific grenade counts so that you could specify higher
* grenade throw limits for certain maps like fy_pool_day
*
*/


#include <amxmodx>
#include <amxmisc>
#include <engine>

#define PLUGIN "Grenade Spam Punish"
#define VERSION "1.4"
#define AUTHOR "[gOf]-Soul"

new grencount[33][3]
//new currentMap[64]

new p_grenspampunish
new p_grenspampunish_maxflash
new p_grenspampunish_maxhe
new p_grenspampunish_maxsmoke
new p_grenspampunish_damage

public plugin_init(){
register_plugin(PLUGIN , VERSION , AUTHOR )

register_logevent("funcNewRound", 2, "1=Round_Start")

p_grenspampunish=register_cvar("mp_grenspampunish","1") // enable/disable plugin
p_grenspampunish_maxflash=register_cvar("mp_grenspampunish_maxflash","2") // number of FB's allowed per round
p_grenspampunish_maxhe=register_cvar("mp_grenspampunish_maxhe","1") // number of HE's allowed per round
p_grenspampunish_maxsmoke = register_cvar("mp_grenspampunish_maxsmoke","1") // number of SG's allowed per round
p_grenspampunish_damage = register_cvar("mp_grenspampunish_damage","100") // health to remove upon punishment

//new configsdir[128]
//get_configsdir(configsdir, 127)
//server_cmd("exec %s/amxx.cfg", configsdir)

//new currmap[128]
//get_mapname(currmap,127)
//server_cmd("exec %s/maps/%s.cfg",configsdir, currmap)

return PLUGIN_CONTINUE
}

public client_putinserver(id){
//reset he grenades count
grencount[id][0] = 0

//reset smoke grenades count
grencount[id][1] = 0

//reset flash grenades count
grencount[id][2] = 0
}

public funcNewRound() {
if ( !get_pcvar_num(p_grenspampunish) )
return PLUGIN_CONTINUE

new players[32], numPlayerCount, idxPlayer
get_players(players, numPlayerCount)
for(idxPlayer = 0; idxPlayer < numPlayerCount; idxPlayer++)
{

//reset he grenades count
grencount[players[idxPlayer]][0] = 0

//reset smoke grenades count
grencount[players[idxPlayer]][1] = 0

//reset flash grenades count
grencount[players[idxPlayer]][2] = 0

}

return PLUGIN_CONTINUE
}

public grenade_throw( index , greindex , wId ){
if ( !get_pcvar_num(p_grenspampunish) )
return PLUGIN_CONTINUE

new punishlevel,grencountindex
new playername[32],greName[32]
get_user_name(index, playername, 32)

//Example of a switch statement
switch (wId)
{
case CSW_HEGRENADE:
{
copy(greName,31,"HE Grenades")
punishlevel = get_pcvar_num(p_grenspampunish_maxhe)
grencountindex = 0
}
case CSW_SMOKEGRENADE:
{
copy(greName,31,"Smoke Grenades")
punishlevel = get_pcvar_num(p_grenspampunish_maxsmoke)
grencountindex = 1
}
case CSW_FLASHBANG:
{
copy(greName,31,"Flash Grenades")
punishlevel = get_pcvar_num(p_grenspampunish_maxflash)
grencountindex = 2
}
}

grencount[index][grencountindex]=grencount[index][grencountindex]+1

if (punishlevel < grencount[index][grencountindex]){
client_print(index ,print_chat,"You have exceeded the maximum number of %s that you can throw.",greName)
client_print(index ,print_chat,"You are only allowed %d %s per round.",punishlevel,greName)

user_slap(index, get_pcvar_num(p_grenspampunish_damage))

remove_entity(greindex)
//set_hudmessage (r, g, b, x, y, effects, fxtime, holdtime, fadeintime, fadeouttime, channel=4 )
set_hudmessage(255 ,0 ,0 ,-1.0 ,0.32 ,0 ,6.0 ,10.0,1.0,1.0,4 )
show_hudmessage(0,"%s was punished because they were grenade spamming", playername)
}
return PLUGIN_CONTINUE
}


вроде этот легче и именно тот, что тебе нужно?
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 1 раз
   + Цитировать сообщение
Статус пользователя Bloo
сообщение 26.7.2014, 20:44
Сообщение #39


Стаж: 12 лет

Сообщений: 15547
Благодарностей: 6971
Полезность: 1206

GOOD FELLOW, вроде оно, как будет возможность проверю. Вроде все что было на оленях перебирал. Спасибо!
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
dimka198
сообщение 26.7.2014, 20:49
Сообщение #40
Стаж: 12 лет

Сообщений: 1541
Благодарностей: 283
Полезность: 13

Цитата(GOOD FELLOW @ 26.7.2014, 22:17) *
dimka198, вообще - реально, но мне нужно время будет:)

окей)напиши тогда))
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
3 страниц V   1 2 3
 
Ответить в данную темуНачать новую тему
 
0 пользователей и 1 гостей читают эту тему: