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

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

Новости

30-дек
29-дек
26-дек
15-дек

35 страниц V  « 34 35

Склад маленьких плагинов

, только отборная пузатая мелочь
Статус пользователя FOXSAN
сообщение 16.11.2016, 11:11
Сообщение #681


Стаж: 8 месяцев
Город: Краснодар

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

Algalon,
Спасибо, помогло.
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя FOXSAN
сообщение 18.12.2016, 15:27
Сообщение #682


Стаж: 8 месяцев
Город: Краснодар

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

Добрый день.
Подскажите, как в плагине GHW Auto Message Displayer сделать, что бы сообщения постоянно показывались?
GHW Auto Message Displayer
Код:
/*
* It is NOT original version of 'GHW Auto Message Displayer' plugin
*
* Home post:
* http://c-s.net.ua/forum/index.php?act=find...&pid=631040
*
* Last update:
* 8/22/2013
*/

/*
* _______ _ _ __ __
* | _____/ | | | | \ \ __ / /
* | | | | | | | | / \ | |
* | | | |____| | | |/ __ \| |
* | | ___ | ______ | | / \ |
* | | |_ | | | | | | / \ |
* | | | | | | | | | | | |
* | |____| | | | | | | | | |
* |_______/ |_| |_| \_/ \_/
*
*
*
* Last Edited: 06-21-08
*
* ============
* Changelog:
* ============
*
* v3.1 8/22/2013
* - full refactoring of HUD messages reading
* - some fixes of text messages reading
*
* v3.0 1/2/2013
* - messages are displayed to dead players only
* - ability to use DHUD instead of HUD (commented by default)
* - small fixes to avoid problems when some limits are reached
*
* v2.1
* -Bug Fix
* -Changed String lengths from 128 - 256
*
* v2.0
* -Remake
*
* v1.0
* -Initial Release
*
*/

#define VERSION "3.1b"

#include <amxmodx>
#include <amxmisc>

/*---------------EDIT ME------------------*/
#define NUM_MESSAGES 25
#define USE_DHUD // comment this to use standard HUD messages; it might be enabled for cstrike only
//#define DEBUG // uncomment to get read results into server console
/*----------------------------------------*/

#define LINE_LEN 608 // read lines buffer
#define HUD_LEN 128 // max allowed HUD message length
#define TEXT_LEN 191 // max allowed text message length

#if defined USE_DHUD && AMXX_VERSION_NUM < 183
// AMXX 1.8.3 since git3790 dev build has its own support of DHUD messages
#include <dhudmessage>
#endif

new text_messages[NUM_MESSAGES][TEXT_LEN]
new hud_messages[NUM_MESSAGES][4][HUD_LEN]
new hud_message_colors[NUM_MESSAGES][4][3]
new giMsgSayText

new num_hudmessages, num_textmessages
new cur_hudmessage[33], cur_textmessage[33]
new pHudLen, pTextLen, pHudLoc

public plugin_init() {
register_plugin( "GHW Auto Message Displayer" , VERSION, "GHW_Chronic/Safety1st" )

pHudLen = register_cvar( "advertise_hud_len", "180" )
pTextLen = register_cvar( "advertise_text_len", "60" )
pHudLoc = register_cvar( "advertise_hud_loc", "1" )

set_task( 7.0, "ReadConfig" )
}

public ReadConfig() {
ReadConfigFile()

if ( num_hudmessages )
set_task( get_pcvar_float(pHudLen), "DisplayHudMessage", .flags = "b" )
if ( num_textmessages ) {
set_task( get_pcvar_float(pTextLen), "DisplayTextMessage", .flags = "b" )
giMsgSayText = get_user_msgid("SayText")
}
}

public ReadConfigFile() {
new szConfigFile[192]
get_localinfo( "amxx_configsdir", szConfigFile, 63 )
format( szConfigFile, charsmax(szConfigFile), "%s/messages.ini", szConfigFile )

new Fsize = file_size(szConfigFile, 1 /* return number of lines */ )
new read[LINE_LEN], trash, j, position, startpos, endpos
for(new i=0;i<Fsize;i++)
{
read_file(szConfigFile,i,read,LINE_LEN - 1,trash)
if(containi(read,"Text")==0)
{
i++
if(num_textmessages==NUM_MESSAGES) {
log_amx("Could not add new text message because text message limit is reached; max = %d", NUM_MESSAGES)
continue // do not read any text messages anymore
}
read_file(szConfigFile,i,read,LINE_LEN - 1,trash)
replace_all(read,LINE_LEN - 1,"[blue]","^x03")
replace_all(read,LINE_LEN - 1,"[/blue]","^x01")
replace_all(read,LINE_LEN - 1,"[red]","^x03")
replace_all(read,LINE_LEN - 1,"[/red]","^x01")
replace_all(read,LINE_LEN - 1,"[green]","^x04")
replace_all(read,LINE_LEN - 1,"[/green]","^x01")
replace_all(read,LINE_LEN - 1,"[Blue]","^x03")
replace_all(read,LINE_LEN - 1,"[/Blue]","^x01")
replace_all(read,LINE_LEN - 1,"[Red]","^x03")
replace_all(read,LINE_LEN - 1,"[/Red]","^x01")
replace_all(read,LINE_LEN - 1,"[Green]","^x04")
replace_all(read,LINE_LEN - 1,"[/Green]","^x01")
format(text_messages[num_textmessages],TEXT_LEN - 1,"^x04^x01%s",read)
#if defined DEBUG
server_print( "^nTEXT: %s^n", text_messages[num_textmessages] )
#endif
num_textmessages++
}
else if(containi(read,"Hud")==0)
{
i++
if(num_hudmessages==NUM_MESSAGES) {
log_amx("Could not add new HUD message because HUD message limit is reached; max = %d", NUM_MESSAGES)
continue // do not read any HUD messages anymore
}
read_file(szConfigFile,i,read, LINE_LEN - 1,trash)
j = 0, position = 0
while(position < strlen(read) && j<4)
{
while(!contain(read[position]," ")) position++
if(!containi(read[position],"[blue]"))
{
startpos = position + 6
endpos = containi(read[startpos],"[/blue]")
if(endpos == -1) {
#if defined DEBUG
server_print( "^nHUD problem - can't find closing tag: %s^n", read[startpos] )
#endif
break
}
endpos += startpos
position = endpos + 7
hud_message_colors[num_hudmessages][j][0] = 0
hud_message_colors[num_hudmessages][j][1] = 100
hud_message_colors[num_hudmessages][j][2] = 255
}
else if(!containi(read[position],"[red]"))
{
startpos = position + 5
endpos = containi(read[startpos],"[/red]")
if(endpos == -1) {
#if defined DEBUG
server_print( "^nHUD problem - can't find closing tag: %s^n", read[startpos] )
#endif
break
}
endpos += startpos
position = endpos + 6
hud_message_colors[num_hudmessages][j][0] = 255
hud_message_colors[num_hudmessages][j][1] = 0
hud_message_colors[num_hudmessages][j][2] = 0
}
else if(!containi(read[position],"[green]"))
{
startpos = position + 7
endpos = containi(read[startpos],"[/green]")
if(endpos == -1) {
#if defined DEBUG
server_print( "^nHUD problem - can't find closing tag: %s^n", read[startpos] )
#endif
break
}
endpos += startpos
position = endpos + 8
hud_message_colors[num_hudmessages][j][0] = 0
hud_message_colors[num_hudmessages][j][1] = 255
hud_message_colors[num_hudmessages][j][2] = 0
}
else if(!containi(read[position],"[yellow]"))
{
startpos = position + 8
endpos = containi(read[startpos],"[/yellow]")
if(endpos == -1) {
#if defined DEBUG
server_print( "^nHUD problem - can't find closing tag: %s^n", read[startpos] )
#endif
break
}
endpos += startpos
position = endpos + 9
hud_message_colors[num_hudmessages][j][0] = 255
hud_message_colors[num_hudmessages][j][1] = 255
hud_message_colors[num_hudmessages][j][2] = 0
}
else if(!containi(read[position],"[orange]"))
{
startpos = position + 8
endpos = containi(read[startpos],"[/orange]")
if(endpos == -1) {
#if defined DEBUG
server_print( "^nHUD problem - can't find closing tag: %s^n", read[startpos] )
#endif
break
}
endpos += startpos
position = endpos + 9
hud_message_colors[num_hudmessages][j][0] = 255
hud_message_colors[num_hudmessages][j][1] = 128
hud_message_colors[num_hudmessages][j][2] = 64
}
else if(!containi(read[position],"[pink]"))
{
startpos = position + 6
endpos = containi(read[startpos],"[/pink]")
if(endpos == -1) {
#if defined DEBUG
server_print( "^nHUD problem - can't find closing tag: %s^n", read[startpos] )
#endif
break
}
endpos += startpos
position = endpos + 7
hud_message_colors[num_hudmessages][j][0] = 255
hud_message_colors[num_hudmessages][j][1] = 0
hud_message_colors[num_hudmessages][j][2] = 128
}
else if(!containi(read[position],"[indigo]"))
{
startpos = position + 8
endpos = containi(read[startpos],"[/indigo]")
if(endpos == -1) {
#if defined DEBUG
server_print( "^nHUD problem - can't find closing tag: %s^n", read[startpos] )
#endif
break
}
endpos += startpos
position = endpos + 9
hud_message_colors[num_hudmessages][j][0] = 0
hud_message_colors[num_hudmessages][j][1] = 255
hud_message_colors[num_hudmessages][j][2] = 255
}
else if(!containi(read[position],"[white]"))
{
startpos = position + 7
endpos = containi(read[startpos],"[/white]")
if(endpos == -1) {
#if defined DEBUG
server_print( "^nHUD problem - can't find closing tag: %s^n", read[startpos] )
#endif
break
}
endpos += startpos
position = endpos + 8
hud_message_colors[num_hudmessages][j][0] = 255
hud_message_colors[num_hudmessages][j][1] = 255
hud_message_colors[num_hudmessages][j][2] = 255
}
else{
startpos = position
endpos = containi(read[startpos],"[") // may be where are next pair of tags?
if(endpos == -1) {
// no, there are not ;)
endpos = LINE_LEN
position = LINE_LEN
}
else {
endpos += startpos
position = endpos
}
hud_message_colors[num_hudmessages][j][0] = 255
hud_message_colors[num_hudmessages][j][1] = 255
hud_message_colors[num_hudmessages][j][2] = 255
}

copy(hud_messages[num_hudmessages][j], min(HUD_LEN - 1,endpos - startpos), read[startpos])
#if defined DEBUG
server_print( "^nHUD: %s^n", hud_messages[num_hudmessages][j] )
#endif
j++
}
num_hudmessages++
}
}
}

public DisplayHudMessage() {
new Float:loc[3]
switch (get_pcvar_num(pHudLoc) ) {
case 2: {
loc[0] = 0.57
loc[1] = 0.60
}
default: {
loc[0] = -1.0
#if defined USE_DHUD
loc[1] = 0.14
#else
loc[1] = 0.19
#endif
}
}

new iPlayers[32], iPlayersNum, iPlayer
get_players( iPlayers, iPlayersNum, "bch" ) // display messages to dead players only
for ( new i = 0; i < iPlayersNum; i++ ) {
iPlayer = iPlayers[i]
loc[2] = loc[1] // reset Y position
for ( new j = 0; j < 4; j++ ) {
if ( hud_messages[cur_hudmessage[iPlayer]][j][0] ) {
#if defined USE_DHUD
set_dhudmessage( hud_message_colors[cur_hudmessage[iPlayer]][j][0],hud_message_colors[cur_hudmess
age[iPlayer]][j][1],hud_message_colors[cur_hudmessage[iPlayer]][j][2],loc[0],loc[
2], 0, 6.0, 12.0,0.1,0.2 )
show_dhudmessage( iPlayer, hud_messages[cur_hudmessage[iPlayer]][j] )
loc[2] += 0.03
#else
set_hudmessage( hud_message_colors[cur_hudmessage[iPlayer]][j][0],hud_message_colors[cur_hudmess
age[iPlayer]][j][1],hud_message_colors[cur_hudmessage[iPlayer]][j][2],loc[0],loc[
2], 0, 6.0, 12.0,0.1,0.2,-1 )
show_hudmessage( iPlayer, hud_messages[cur_hudmessage[iPlayer]][j] )
loc[2] += 0.02
#endif
}
}
cur_hudmessage[iPlayer] = ++cur_hudmessage[iPlayer] % num_hudmessages
}
}

public DisplayTextMessage() {
new iPlayers[32], iPlayersNum, iPlayer
get_players( iPlayers, iPlayersNum, "bch" ) // display messages to dead players only
for ( new i = 0; i < iPlayersNum; i++ ) {
iPlayer = iPlayers[i]

message_begin( MSG_ONE_UNRELIABLE, giMsgSayText, _, iPlayer )
write_byte(iPlayer)
write_string( text_messages[cur_textmessage[iPlayer]] )
message_end()

cur_textmessage[iPlayer] = ++cur_textmessage[iPlayer] % num_textmessages
}
}

Содержимое messages.ini:
messages.ini
Hud
[Green]В группе сервера[/Green][Blue]www.***[/Blue][Green]Проводится конкурс на выдачу[/Green][Orange]VIP[/Orange]

Заранее спасибо
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя pogorelovios
сообщение 7.1.2017, 15:04
Сообщение #683
Стаж: 5 месяцев 20 дней

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

Тестил кто нибудь плагин instant_autoteambalance без появления Auto-Team Balance next round? Были кики с причиной "Reliable channel overflowed"?
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
35 страниц V  « 34 35
 
Ответить в данную темуНачать новую тему
 
0 пользователей и 2 гостей читают эту тему: