AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Zombie Plague Mod (https://forums.alliedmods.net/forumdisplay.php?f=126)
-   -   Subplugin Submission [ZP] Extra-item: Silent Hill Radio (https://forums.alliedmods.net/showthread.php?t=97832)

HoRRoR [CSM] 07-20-2009 08:32

[ZP] Extra-item: Silent Hill Radio
 
2 Attachment(s)
Description:
[EN] This adds to a new item for people. Depending on how far you are from the zombies, the radio produces certain sounds. Cost: 8 ap
Following the acquisition of the item, type in the console /radio to turn on/off the radio.

[RU] Этот предмет добавляет радио прямиком из игры Silent Hill 3. Радио шумит по-разному, в зависимости от того, как близко к вам зомби. Стоит 8 аммопаков. Чтобы включить или выключить радио, введите в чате /radio

Sounds from Silent Hill 3 :D
p.s. no screenshots, because they are meaningless

Pach 07-26-2009 01:40

Re: [ZP] Extra-item: Silent Hill Radio
 
Quote:

Originally Posted by HoRRoR [CSM] (Post 876958)
Description:
This adds to a new item for people. Depending on how far you are from the zombies, the radio produces certain sounds. Cost: 8 ap
Following the acquisition of the item, type in the console /radio to turn on/off the radio.

Sounds from Silent Hill 3 :D
p.s. no screenshots, because they are meaningless

Дай пожалуйсто русское описание!

meTaLiCroSS 07-26-2009 01:41

Re: [ZP] Extra-item: Silent Hill Radio
 
Quote:

Originally Posted by Pach (Post 881895)
Дай пожалуйсто русское описание!

English Please!!

@Horror

good job dude.

HoRRoR [CSM] 07-26-2009 04:07

Re: [ZP] Extra-item: Silent Hill Radio
 
2 meTaLiCroSS:
He asked to add a russian description :)

meTaLiCroSS 07-26-2009 14:27

Re: [ZP] Extra-item: Silent Hill Radio
 
Quote:

Originally Posted by HoRRoR [CSM] (Post 881959)
2 meTaLiCroSS:
He asked to add a russian description :)

This is an English forum, you don't need to add a Russian-language description because your country is Russia.

Nowhere says that.

Mephisto 07-26-2009 15:10

Re: [ZP] Extra-item: Silent Hill Radio
 
I think he could add a description in russian,but he canīt delete the english description. If he like to add description in more than 1 language isnīt bad,i think is better than only one.

spraypa1nt 08-01-2009 21:48

Re: [ZP] Extra-item: Silent Hill Radio
 
can someone make it..
all human can hear the sound without buy..
mean when u play u still hear it without buy it

sorry for my bad language

5c0r-|3i0 08-02-2009 01:01

Re: [ZP] Extra-item: Silent Hill Radio
 
PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <hamsandwich>
#include <zombieplague>

#define XPOS -1.0
#define YPOS -1.0
new mindistance[33]
new 
dist[33]
new 
is_radio_on[33] = 0
new player_has_radio[33]

new 
sound_noise[4][] =
{
    
"zombie_plague/shradio/18000.wav",
    
"zombie_plague/shradio/18001.wav",
    
"zombie_plague/shradio/18002.wav",
    
"zombie_plague/shradio/18003.wav"
}

public 
plugin_precache()
{
    for (new 
04i++)
        
precache_sound(sound_noise[i])
}

public 
plugin_init()
{
    
register_plugin("[ZP] Silent hill radio""1.0""HoRRoR")
    
register_clcmd("say /radio","radio_button")
    
RegisterHam(Ham_Killed"player""fw_PlayerKilled")
}

public 
client_connect(id)
{
    
player_has_radio[id] = 1
}

public 
radio_button(id)
{
    new 
text[100]
    if (
is_radio_on[id] != && player_has_radio[id] != 0)
    {
        if (
is_user_alive(id) && !zp_get_user_zombie(id) && !zp_get_user_nemesis(id))
        {
            
format(text,99,"^x04[ZP]^x01 Radio switched ^x03ON"
            
message_begin(MSG_ONE,get_user_msgid("SayText"),{0,0,0},id
            
write_byte(id
            
write_string(text
            
message_end()
            
set_task(5.0,"check_radio",id,_,_,"b")
            
is_radio_on[id] = 1
        
}
    }
    else if (
is_radio_on[id] == && player_has_radio[id] != 0)
        {
            
format(text,99,"^x04[ZP]^x01 Radio switched ^x03OFF"
            
message_begin(MSG_ONE,get_user_msgid("SayText"),{0,0,0},id
            
write_byte(id
            
write_string(text
            
message_end()
            
remove_task(id)
            
remove_task(id+100)
            
is_radio_on[id] = 0
        
}
    return 
PLUGIN_HANDLED;
}

public 
check_radio(id)
{
    
mindistance[id] = 8192
    dist
[id] = 8190

    
for (new 1<= get_maxplayers(); i++)
    {
        if (
zp_get_user_zombie(i) && is_valid_ent(i))
            
dist[id] = get_entity_distance(idi)
    
        if (
dist[id] < mindistance[id])
        {
            
mindistance[id] = dist[id]
        }
    }
    
//    client_print(id,print_chat,"[DEBUG] Distance is: %d", mindistance[id])
    
    
if (mindistance[id] < 300)
        
emit_sound(idCHAN_AUTOsound_noise[3], 1.0ATTN_NORM0PITCH_NORM)
    else if (
mindistance[id] >= 300 && mindistance[id] < 450)
        
emit_sound(idCHAN_AUTOsound_noise[2], 1.0ATTN_NORM0PITCH_NORM)
    else if (
mindistance[id] >= 450 && mindistance[id] < 600)
        
emit_sound(idCHAN_AUTOsound_noise[1], 1.0ATTN_NORM0PITCH_NORM)
    else if (
mindistance[id] >= 600)
        
emit_sound(idCHAN_AUTOsound_noise[0], 1.0ATTN_NORM0PITCH_NORM)
    
    
set_task(0.15,"hud_radio_wave1",id+100)
    
set_task(0.30,"hud_radio_wave2",id+100)
    
set_task(0.45,"hud_radio_wave3",id+100)
}


public 
hud_radio_wave1(taskid)
{
    new 
id
    id 
taskid 100;
    
set_hudmessage(200200200XPOSYPOS00.50.00.00.5, -1)
    
show_hudmessage(id"(            )")
}

public 
hud_radio_wave2(taskid)
{
    new 
id
    id 
taskid 100;
    
set_hudmessage(200200200XPOSYPOS00.50.00.00.5, -1)
    
show_hudmessage(id"(               )")
}

public 
hud_radio_wave3(taskid)
{
    new 
id
    id 
taskid 100;
    
set_hudmessage(200200200XPOSYPOS00.50.00.00.5, -1)
    
show_hudmessage(id"(                  )")
}

public 
zp_user_infected_post(id)
{
    if (
player_has_radio[id] != 0)
    {
        new 
text[100]
        
format(text,99,"^x04[ZP]^x01 Radio switched ^x03OFF"
        
message_begin(MSG_ONE,get_user_msgid("SayText"),{0,0,0},id
        
write_byte(id
        
write_string(text
        
message_end()
        
remove_task(id)
        
remove_task(id+100)
        
is_radio_on[id] = 0
        player_has_radio
[id] = 0
    
}
}

public 
fw_PlayerKilled(id)
{    
    if (
player_has_radio[id] != 0)
    {
        new 
text[100]
        
format(text,99,"^x04[ZP]^x01 Radio switched ^x03OFF"
        
message_begin(MSG_ONE,get_user_msgid("SayText"),{0,0,0},id
        
write_byte(id
        
write_string(text
        
message_end()
        
remove_task(id)
        
remove_task(id+100)
        
is_radio_on[id] = 0
        player_has_radio
[id] = 0
    
}


@spraypa1nt: Try this ..Not tested

Satoko 08-08-2009 12:24

Re: [ZP] Extra-item: Silent Hill Radio
 
5c0r-|3i0 don't work. it only works for one round it seems after that you can't activate it with /radio or deactivate it with it. don't hear sounds then.

HoRRoR [CSM] 08-08-2009 13:22

Re: [ZP] Extra-item: Silent Hill Radio
 
PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <hamsandwich>
#include <zombieplague>

#define XPOS -1.0
#define YPOS -1.0
new mindistance[33]
new 
dist[33]
new 
is_radio_on[33] = 0

new sound_noise[4][] =
{
    
"zombie_plague/shradio/18000.wav",
    
"zombie_plague/shradio/18001.wav",
    
"zombie_plague/shradio/18002.wav",
    
"zombie_plague/shradio/18003.wav"
}

public 
plugin_precache()
{
    for (new 
04i++)
        
precache_sound(sound_noise[i])
}

public 
plugin_init()
{
    
register_plugin("[EXODUS] Silent hill radio (not extra-item)""1.1""HoRRoR")
    
register_clcmd("say /radio","radio_button")
    
RegisterHam(Ham_Killed"player""fw_PlayerKilled")
}

public 
radio_button(id)
{
    if (
is_radio_on[id] != 1)
    {
        if (
is_user_alive(id) && !zp_get_user_zombie(id) && !zp_get_user_nemesis(id))
        {
            
MsgChat(id,MSG_ONE,"^x04[EXODUS]^x01 Radio switched ^x03ON")
            
set_task(5.0,"check_radio",id,_,_,"b")
            
is_radio_on[id] = 1
        
}
    }
    else if (
is_radio_on[id] == 1)
        {
            
MsgChat(id,MSG_ONE,"^x04[EXODUS]^x01 Radio switched ^x03OFF")
            
remove_task(id)
            
remove_task(id+100)
            
is_radio_on[id] = 0
        
}
    return 
PLUGIN_HANDLED;
}

public 
check_radio(id)
{
    
mindistance[id] = 8192
    dist
[id] = 8190

    
for (new 1<= get_maxplayers(); i++)
    {
        if (
zp_get_user_zombie(i) && is_valid_ent(i))
            
dist[id] = get_entity_distance(idi)
    
        if (
dist[id] < mindistance[id])
        {
            
mindistance[id] = dist[id]
        }
    }
    
//    client_print(id,print_chat,"[DEBUG] Distance is: %d", mindistance[id])
    
    
if (mindistance[id] < 300)
        
emit_sound(idCHAN_AUTOsound_noise[3], 1.0ATTN_NORM0PITCH_NORM)
    else if (
mindistance[id] >= 300 && mindistance[id] < 450)
        
emit_sound(idCHAN_AUTOsound_noise[2], 1.0ATTN_NORM0PITCH_NORM)
    else if (
mindistance[id] >= 450 && mindistance[id] < 600)
        
emit_sound(idCHAN_AUTOsound_noise[1], 1.0ATTN_NORM0PITCH_NORM)
    else if (
mindistance[id] >= 600)
        
emit_sound(idCHAN_AUTOsound_noise[0], 1.0ATTN_NORM0PITCH_NORM)
    
    
set_task(0.15,"hud_radio_wave1",id+100)
    
set_task(0.30,"hud_radio_wave2",id+100)
    
set_task(0.45,"hud_radio_wave3",id+100)
}


public 
hud_radio_wave1(taskid)
{
    new 
id
    id 
taskid 100;
    
set_hudmessage(200200200XPOSYPOS00.50.00.00.5, -1)
    
show_hudmessage(id"(            )")
}

public 
hud_radio_wave2(taskid)
{
    new 
id
    id 
taskid 100;
    
set_hudmessage(200200200XPOSYPOS00.50.00.00.5, -1)
    
show_hudmessage(id"(               )")
}

public 
hud_radio_wave3(taskid)
{
    new 
id
    id 
taskid 100;
    
set_hudmessage(200200200XPOSYPOS00.50.00.00.5, -1)
    
show_hudmessage(id"(                  )")
}

public 
zp_user_infected_post(id)
{
    if (
is_radio_on[id] == 1)
    {
        
MsgChat(id,MSG_ONE,"^x04[EXODUS]^x01 Radio switched ^x03OFF")
        
remove_task(id)
        
remove_task(id+100)
        
is_radio_on[id] = 0
    
}
}

public 
fw_PlayerKilled(id)
{    
    if (
is_radio_on[id] == 1)
    {
        
MsgChat(id,MSG_ONE,"^x04[EXODUS]^x01 Radio switched ^x03OFF")
        
remove_task(id)
        
remove_task(id+100)
        
is_radio_on[id] = 0
    
}
}

stock MsgChat(idmsgtypetext[], any:...)
{
    
message_begin(msgtype,get_user_msgid("SayText"),{0,0,0},id
    
write_byte(id
    
write_string(text
    
message_end()


optimized code and it's work


All times are GMT -4. The time now is 15:43.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.