Half-Life и Adrenaline Gamer форум

Всё об игре в Халф-Лайф и АГ
Текущее время: 19 апр 2024, 13:37

Часовой пояс: UTC + 5 часов [ Летнее время ]




Начать новую тему Ответить на тему  [ Сообщений: 27 ]  На страницу Пред.  1, 2, 3  След.
Автор Сообщение
 Заголовок сообщения: Re: Count Down AGmini arena mod
СообщениеДобавлено: 22 дек 2015, 19:57 
Не в сети
Аватара пользователя
Зарегистрирован:
22 окт 2014, 19:26
Последнее посещение:
18 апр 2024, 17:17
Сообщения: 1025
Where the result?

_________________
https://vk.com/kgbaghl


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Count Down AGmini arena mod
СообщениеДобавлено: 23 дек 2015, 10:10 
Не в сети
Site Admin
Зарегистрирован:
01 июн 2010, 01:27
Последнее посещение:
19 апр 2024, 10:23
Сообщения: 6867
abdobiskra писал(а):

You should try to understand what the code is doing.
Код:
Sounds[which = (which + 1) % 3]
Splited into operations:
Код:
(which + 1)
current which value is incremented
Код:
(which + 1) % 3
incremented value is divided by 3 and reminder is returned
Код:
which = (which + 1) % 3
reminder is stored back into which
Код:
Sounds[which = (which + 1) % 3]
then reminder value that is already stored in which on previous step is used as indexer in Sounds array.


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Count Down AGmini arena mod
СообщениеДобавлено: 23 дек 2015, 10:27 
Не в сети
Аватара пользователя
Зарегистрирован:
22 окт 2014, 19:26
Последнее посещение:
18 апр 2024, 17:17
Сообщения: 1025
Цитата:
You should try to understand what the code is doing.

Yes it was clear :)

It should be try that !

I meant this

Код:
#include <amxmodx>


#define MSG_POS_X 2457 //
#define MSG_POS_Y 4096 //


new which = 0;
new szSoundsCount[3][] = {"fvox/one.wav", "fvox/two.wav", "fvox/three.wav"}// Here the problem can not add more than 3 sounds !

public plugin_init()
{

register_message(SVC_TEMPENTITY, "hud_text_msg")

}
public plugin_precache()
{
for(new i = 0; i < sizeof szSoundsCount; i++)
precache_sound(szSoundsCount[i])
}

public hud_text_msg()
{
if (get_msg_arg_int(1) == TE_TEXTMESSAGE && get_msg_arg_int(3) == MSG_POS_X && get_msg_arg_int(4) == MSG_POS_Y)
emit_sound(0, CHAN_VOICE, szSoundsCount[which = (which + 1) % 3], 1.0, 1.0, 0, 100)
   
}

im used emit_sound
bcz the message appear and disappear with the same sound , so if i used emit sound the message requires next sound
and
Код:
[which = (which + 1) % 3]

Is simply the order of this sounds

_________________
https://vk.com/kgbaghl


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Count Down AGmini arena mod
СообщениеДобавлено: 23 дек 2015, 12:01 
Не в сети
Site Admin
Зарегистрирован:
01 июн 2010, 01:27
Последнее посещение:
19 апр 2024, 10:23
Сообщения: 6867
Код:
{"fvox/one.wav", "fvox/two.wav", "fvox/three.wav"}
I think that the order should be reversed (three, two, one). Also, there will be a problem with on screen text: it displays 2, 1, 0.


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Count Down AGmini arena mod
СообщениеДобавлено: 23 дек 2015, 12:26 
Не в сети
Зарегистрирован:
17 май 2015, 23:48
Последнее посещение:
25 июл 2019, 07:26
Сообщения: 59
Цитата:
#include <amxmodx>


#define MSG_POS_X 2457 //
#define MSG_POS_Y 4096 //


new which = 0;
new szSoundsCount[3][] = {"fvox/one.wav", "fvox/two.wav", "fvox/three.wav"}// Here the problem can not add more than 3 sounds !

public plugin_init()
{

register_message(SVC_TEMPENTITY, "hud_text_msg")

}
public plugin_precache()
{
for(new i = 0; i < sizeof szSoundsCount; i++)
precache_sound(szSoundsCount[i])
}

public hud_text_msg()
{
if (get_msg_arg_int(1) == TE_TEXTMESSAGE && get_msg_arg_int(3) == MSG_POS_X && get_msg_arg_int(4) == MSG_POS_Y)
emit_sound(0, CHAN_VOICE, szSoundsCount[which = (which + 1) % 3], 1.0, 1.0, 0, 100)

}

two player good

three players bug one one one

four players three two one!

https://youtu.be/lDmSyrn9LUw


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Count Down AGmini arena mod
СообщениеДобавлено: 23 дек 2015, 19:48 
Не в сети
Аватара пользователя
Зарегистрирован:
22 окт 2014, 19:26
Последнее посещение:
18 апр 2024, 17:17
Сообщения: 1025
Lev
Цитата:
the order should be reversed (three, two, one).
idk why the sounds do not come order !

i think shold be :
Код:
[which++ % sizeof(szSoundsCount)]
if you want to start from 0.

Цитата:
Also, there will be a problem with on screen text: it displays 2, 1, 0.

Yes there is a problem, there will be a delay in between the message and sounds

eseqiiel

this !

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

#define PLUGIN "Agmini_CountDawn"
#define AUTHOR "LetiLetiLepestok/abdobiskra"
#define VERSION "1.1"

#define MSG_POS_X 2457 //
#define MSG_POS_Y 4096 //

#define MAX_SOUNDS 3

#define ARENA "arena"

new pcvar_gamemode
new g_mod[32]
new g_sound = MAX_SOUNDS - 1

new szSoundsCount[MAX_SOUNDS][] = {"fvox/two.wav", "fvox/three.wav", "fvox/one.wav"}// Here the problem can not add more than 3 sounds !
new SND_FT[] = "barney/ba_bring.wav"

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

register_message(SVC_TEMPENTITY, "hud_text_msg")
RegisterHam(Ham_Spawn, "player", "player_spawn", 1)

pcvar_gamemode = get_cvar_pointer("sv_ag_gamemode")
get_pcvar_string(pcvar_gamemode, g_mod, charsmax(g_mod))
}
public PlaySound(sound[])
{
    client_cmd(0, "spk ^"%s^"", sound);
}
stock next_sound_to_play()
{
    g_sound = ( g_sound + 1 ) % MAX_SOUNDS
    return g_sound
}

public plugin_precache()
{
for(new i = 0; i < sizeof szSoundsCount; i++)
precache_sound(szSoundsCount[i])
precache_sound(SND_FT)
}

public hud_text_msg()
{
if(equal(g_mod, ARENA)){
if (get_msg_arg_int(1) == TE_TEXTMESSAGE && get_msg_arg_int(3) == MSG_POS_X && get_msg_arg_int(4) == MSG_POS_Y)
emit_sound(0, CHAN_VOICE, szSoundsCount[next_sound_to_play()], 1.0, 1.0, 0, 100)
}   
}

public player_spawn(id)
{
   if(equal(g_mod, ARENA)){
   if(is_user_alive(id))
   PlaySound(SND_FT)
   }
}

_________________
https://vk.com/kgbaghl


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Count Down AGmini arena mod
СообщениеДобавлено: 23 дек 2015, 23:47 
Не в сети
Site Admin
Зарегистрирован:
01 июн 2010, 01:27
Последнее посещение:
19 апр 2024, 10:23
Сообщения: 6867
Код:
if(equal(g_mod, ARENA))
you can check this in plugin_init and pause the plugin if it is not (or do not register callbacks to events, etc), because change of the mode require map restart.
Код:
[next_sound_to_play()]
not a good idea to do a function call, better just add the code right above emit_sound call.


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Count Down AGmini arena mod
СообщениеДобавлено: 24 дек 2015, 00:19 
Не в сети
Аватара пользователя
Зарегистрирован:
24 янв 2011, 03:32
Последнее посещение:
09 дек 2021, 03:04
Сообщения: 756
Откуда: Futurama
Код:
// don't use the size for the massive ..
new szSoundsCount[][] = {"fvox/three.wav", "fvox/two.wav", "fvox/one.wav"}; // 3, 2, 1 ... start
new g_sound = 0;

public plugin_precache() {
  g_sound = 0; // you have to reset it 

  for(new i = 0; i < sizeof szSoundsCount; i++) {
    precache_sound(szSoundsCount[i])
  }

  precache_sound(SND_FT)
}

public hud_text_msg() {
 if(
    equal(g_mod, ARENA) && // i am not sure about the first condition. try to use the LEV's comment about ..
    (get_msg_arg_int(1) == TE_TEXTMESSAGE) &&
    (get_msg_arg_int(3) == MSG_POS_X) &&
    (get_msg_arg_int(4) == MSG_POS_Y)) {
   
    if(sizeof(szSoundsCount) == g_sound) {
      g_sound = 0;
    }

    emit_sound(0, CHAN_VOICE, szSoundsCount[g_sound++], 1.0, 1.0, 0, 100)
  }
}


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Count Down AGmini arena mod
СообщениеДобавлено: 24 дек 2015, 05:58 
Не в сети
Зарегистрирован:
17 май 2015, 23:48
Последнее посещение:
25 июл 2019, 07:26
Сообщения: 59
abdobiskra

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

#define PLUGIN "Agmini_CountDawn"
#define AUTHOR "LetiLetiLepestok/abdobiskra"
#define VERSION "1.1"

#define MSG_POS_X 2457 //
#define MSG_POS_Y 4096 //

#define MAX_SOUNDS 3

#define ARENA "arena"

new pcvar_gamemode
new g_mod[32]
new g_sound = MAX_SOUNDS - 1

new szSoundsCount[MAX_SOUNDS][] = {"fvox/two.wav", "fvox/three.wav", "fvox/one.wav"}// Here the problem can not add more than 3 sounds !
new SND_FT[] = "barney/ba_bring.wav"

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

register_message(SVC_TEMPENTITY, "hud_text_msg")
RegisterHam(Ham_Spawn, "player", "player_spawn", 1)

pcvar_gamemode = get_cvar_pointer("sv_ag_gamemode")
get_pcvar_string(pcvar_gamemode, g_mod, charsmax(g_mod))
}
public PlaySound(sound[])
{
    client_cmd(0, "spk ^"%s^"", sound);
}
stock next_sound_to_play()
{
    g_sound = ( g_sound + 1 ) % MAX_SOUNDS
    return g_sound
}

public plugin_precache()
{
for(new i = 0; i < sizeof szSoundsCount; i++)
precache_sound(szSoundsCount[i])
precache_sound(SND_FT)
}

public hud_text_msg()
{
if(equal(g_mod, ARENA)){
if (get_msg_arg_int(1) == TE_TEXTMESSAGE && get_msg_arg_int(3) == MSG_POS_X && get_msg_arg_int(4) == MSG_POS_Y)
emit_sound(0, CHAN_VOICE, szSoundsCount[next_sound_to_play()], 1.0, 1.0, 0, 100)
}   
}

public player_spawn(id)
{
   if(equal(g_mod, ARENA)){
   if(is_user_alive(id))
   PlaySound(SND_FT)
   }
}

three players bug one one one :%)


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Count Down AGmini arena mod
СообщениеДобавлено: 24 дек 2015, 11:11 
Не в сети
Аватара пользователя
Зарегистрирован:
22 окт 2014, 19:26
Последнее посещение:
18 апр 2024, 17:17
Сообщения: 1025
Lev писал(а):
Код:
if(equal(g_mod, ARENA))
you can check this in plugin_init and pause the plugin if it is not (or do not register callbacks to events, etc), because change of the mode require map restart.
Код:
[next_sound_to_play()]
not a good idea to do a function call, better just add the code right above emit_sound call.

Well I think it was done Update :)

Turanga_Leela

It did not succeed?

Цитата:
// don't use the size for the massive ..
new szSoundsCount[][] = {"fvox/three.wav", "fvox/two.wav", "fvox/one.wav"}; // 3, 2, 1 ... start
new g_sound = 0;

public plugin_precache() {
g_sound = 0; // you have to reset it

for(new i = 0; i < sizeof szSoundsCount; i++) {
precache_sound(szSoundsCount[i])
}

precache_sound(SND_FT)
}

public hud_text_msg() {
if(
equal(g_mod, ARENA) && // i am not sure about the first condition. try to use the LEV's comment about ..
(get_msg_arg_int(1) == TE_TEXTMESSAGE) &&
(get_msg_arg_int(3) == MSG_POS_X) &&
(get_msg_arg_int(4) == MSG_POS_Y)) {

if(sizeof(szSoundsCount) == g_sound) {
g_sound = 0;
}

emit_sound(0, CHAN_VOICE, szSoundsCount[g_sound++], 1.0, 1.0, 0, 100)
}
}

eseqiiel

I do not know what exactly is your problem but it works for me to try to restart the server?

last Update

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

#define PLUGIN "Agmini_CountDawn"
#define AUTHOR "LetiLetiLepestok/abdobiskra"
#define VERSION "1.1"

#define MSG_POS_X 2457 // exclusive position of HUD message with countdown (AG mini. arena, lts, lms etc)
#define MSG_POS_Y 4096 //

#define ARENA "arena"

new pcvar_gamemode
new g_mod[32]
new g_sound = 0
new gGm

new szSoundsCount[3][] = {"fvox/two.wav", "fvox/three.wav", "fvox/one.wav"}// do not reorder this sounds !
new SND_FT[] = "barney/ba_bring.wav"

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

register_message(SVC_TEMPENTITY, "hud_text_msg")
RegisterHam(Ham_Spawn, "player", "player_spawn", 1)

pcvar_gamemode = get_cvar_pointer("sv_ag_gamemode")
get_pcvar_string(pcvar_gamemode, g_mod, charsmax(g_mod))

gGm = equal(g_mod, ARENA) // Lev ida
}
public PlaySound(sound[])
{
    client_cmd(0, "spk ^"%s^"", sound);
}

public plugin_precache()
{
for(new i = 0; i < sizeof szSoundsCount; i++)
precache_sound(szSoundsCount[i])
precache_sound(SND_FT)
}

public hud_text_msg()
{

if (gGm && get_msg_arg_int(1) == TE_TEXTMESSAGE && get_msg_arg_int(3) == MSG_POS_X && get_msg_arg_int(4) == MSG_POS_Y){
emit_sound(0, CHAN_VOICE, szSoundsCount[g_sound++ % sizeof(szSoundsCount)], 1.0, ATTN_NORM, 0, PITCH_NORM)
}   
}

public player_spawn(id)
{
   if(gGm && is_user_alive(id))
   PlaySound(SND_FT)
}

_________________
https://vk.com/kgbaghl


Вернуться к началу
 Профиль 
  
Показать сообщения за:  Поле сортировки  
Начать новую тему Ответить на тему  [ Сообщений: 27 ]  На страницу Пред.  1, 2, 3  След.

Часовой пояс: UTC + 5 часов [ Летнее время ]


Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 10


Вы не можете начинать темы
Вы не можете отвечать на сообщения
Вы не можете редактировать свои сообщения
Вы не можете удалять свои сообщения
Вы не можете добавлять вложения

Найти:
Перейти:  
cron
Создано на основе phpBB® Forum Software © phpBB Group
Русская поддержка phpBB