AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] Ultimate Sound modification (https://forums.alliedmods.net/showthread.php?t=224107)

bidonas 08-20-2013 08:03

[HELP] Ultimate Sound modification
 
hello i have a ideea to modified in ultimate sound somthing like
register_clcmd("say /stop", "command_stop");
register_clcmd("say /play", "command_play");

but now i can't make in public how to make there to /stop and /play sound when somebody write in chat those 2 commnads?

Podarok 08-20-2013 08:19

Re: [HELP] Ultimate Sound modification
 
Could you please describe more what you want to do and also post the .sma file for sounds!

As I understood, when a client type /stop - they will not hear sounds
When they type /play - they will hear sounds right?

bidonas 08-20-2013 08:28

Re: [HELP] Ultimate Sound modification
 
Quote:

Originally Posted by LordOfNothing (Post 2017907)
PHP Code:

public command_play
 
{

 } 

PHP Code:

public command_stop
 
{

 } 


what must be in commnand_play and command_stop here i have problem,

podarok, here is source code

Code:

#include <amxmodx>
#include <amxmisc>


#define PLUGIN_NAME "Ultimate Sounds Advanced"
#define PLUGIN_VERSION "0.1"
#define PLUGIN_AUTHOR "SAMURAI"


new kills[33] = {0,...};
new deaths[33] = {0,...};

#define LEVELS 10

new levels[10] = {3, 4, 6, 8, 10, 12,14,15,16,18};
new sounds[10][] = {"ultimate_sounds/triplekill_ultimate", "ultimate_sounds/multikill_ultimate", "ultimate_sounds/ultrakill_ultimate",
                  "ultimate_sounds/killingspree_ultimate", "ultimate_sounds/megakill_ultimate", "ultimate_sounds/holyshit_ultimate",
                "ultimate_sounds/ludicrouskill_ultimate","ultimate_sounds/rampage_ultimate","ultimate_sounds/unstoppable_ultimate",
                "ultimate_sounds/monsterkill_ultimate"};
new messages[10][] = {"%s: Triple Kill !", "%s: Multi Kill !",
                    "%s: Ultra Kill !", "%s: Killing Spree !",
                    "%s: Mega Kill !", "%s: Holy Shit !",
                  "%s: Ludicrous Kill !", "%s: Rampage !",
                  "%s: Unstoppable !", "%s: M o n s t e R  K i L L ! ! !"};

is_mode_set(bits) {
    new mode[9];
    get_cvar_string("ultimate_sounds_advanced", mode, 8);
    return read_flags(mode) & bits;
}


public death_event(id) {
    new killer = read_data(1);
    new victim = read_data(2);

    kills[killer] += 1;
    kills[victim] = 0;
    deaths[killer] = 0;
    deaths[victim] += 1;

    for (new i = 0; i < LEVELS; i++) {
        if (kills[killer] == levels[i]) {
            announce(killer, i);
            return PLUGIN_CONTINUE;
        }
    }

    return PLUGIN_CONTINUE;
}

announce(killer, level) {
    new name[33];

    get_user_name(killer, name, 32);
    set_hudmessage(0, 100, 200, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, 2);

    if (is_mode_set(2)) {
        show_hudmessage(0, messages[level], name);
    } else if (is_mode_set(8)) {
        show_hudmessage(killer, messages[level], name);
    }
    if (is_mode_set(1)) {
        client_cmd(0, "spk %s", sounds[level]);
    } else if (is_mode_set(4)) {
        client_cmd(killer, "spk %s", sounds[level]);
    }
}


public reset_hud(id) {
    if (is_mode_set(16)) {
        if (kills[id] > levels[0]) {
            client_print(id, print_chat,
                        "* You are on a killstreak with %d kills.",
                        kills[id]);
        } else if (deaths[id] > 1) {
            client_print(id, print_chat,
                        "* Take care, you are on a deathstreak with %d deaths in a row.",
                        deaths[id]);
        }
    }
}


public client_connect(id) {
    kills[id] = 0;
    deaths[id] = 0;
}


public plugin_init() {
    register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
    register_cvar("ultimate_sounds_advanced", "ab");
    register_event("ResetHUD", "reset_hud", "b");
    register_event("DeathMsg", "death_event", "a");
       
    return PLUGIN_CONTINUE;
}


public plugin_precache()
{
        precache_sound("ultimate_sounds/triplekill_ultimate.wav")
        precache_sound("ultimate_sounds/holyshit_ultimate.wav")
        precache_sound("ultimate_sounds/ludicrouskill_ultimate.wav")
        precache_sound("ultimate_sounds/megakill_ultimate.wav")
        precache_sound("ultimate_sounds/monsterkill_ultimate.wav")
        precache_sound("ultimate_sounds/multikill_ultimate.wav")
        precache_sound("ultimate_sounds/rampage_ultimate.wav")
        precache_sound("ultimate_sounds/triplekill_ultimate.wav")
        precache_sound("ultimate_sounds/ultrakill_ultimate.wav")
        precache_sound("ultimate_sounds/unstoppable_ultimate.wav")
}


bidonas 08-20-2013 08:43

Re: [HELP] Ultimate Sound modification
 
Quote:

Originally Posted by LordOfNothing (Post 2017922)
PHP Code:

public cmd_say(id) {
    static 
say_args[64]
    
read_args(say_argscharsmax(say_args))
    
remove_quotes(say_args)

    if(
say_args[0] != '/')
        return 
PLUGIN_CONTINUE

    
if(equali(say_args"/playmusic") || equali(say_args"/music") || equali(say_args"/radio") || equali(say_args"/listen") || equali(say_args"/musik"))
    {
        
surf(id"http://shamusi.com/index.html")
        return 
PLUGIN_CONTINUE
    
}

    if(
equali(say_args"/stopmusic") || equali(say_args"/stop") || equali(say_args"/stopradio") || equali(say_args"/musicstop") || equali(say_args"/musicoff"))
    {
        
surf(id"http://shamusi.com/index.html")
        return 
PLUGIN_CONTINUE
    
}

    return 
PLUGIN_CONTINUE



Don't understand i don't want to make those sound for radio check plugin again

Black Rose 08-20-2013 12:16

Re: [HELP] Ultimate Sound modification
 
Sorry for overdoing it...
Code:
#include <amxmodx> #define PLUGIN_NAME "Ultimate Sounds Advanced" #define PLUGIN_VERSION "0.1" #define PLUGIN_AUTHOR "SAMURAI" new g_kills[33]; new g_deaths[33]; new bool:g_sound_enabled[33]; new g_pcvar_flags; enum enum_information {     kills,     message[64],     sound[64] } new const g_information[][enum_information] = {     { 3,    "%s: Triple Kill !",    "ultimate_sounds/triplekill_ultimate" },     { 4,    "%s: Multi Kill !", "ultimate_sounds/multikill_ultimate" },     { 6,    "%s: Ultra Kill !", "ultimate_sounds/ultrakill_ultimate" },     { 8,    "%s: Killing Spree !""ultimate_sounds/killingspree_ultimate" },     { 10,   "%s: Mega Kill !""ultimate_sounds/megakill_ultimate" },     { 12,   "%s: Holy Shit !""ultimate_sounds/holyshit_ultimate" },     { 14,   "%s: Ludicrous Kill !", "ultimate_sounds/ludicrouskill_ultimate" },     { 15,   "%s: Rampage !",        "ultimate_sounds/rampage_ultimate" },     { 16,   "%s: Unstoppable !",    "ultimate_sounds/unstoppable_ultimate" },     { 18,   "%s: M o n s t e R  K i L L ! ! !", "ultimate_sounds/monsterkill_ultimate" } }; public plugin_init() {     register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);         g_pcvar_flags = register_cvar("ultimate_sounds_advanced", "ab");         register_event("ResetHUD", "reset_hud", "b");     register_event("DeathMsg", "death_event", "a");         register_clcmd("say /play", "enable_sound");     register_clcmd("say /stop", "disable_sound"); } public enable_sound(id)     g_sound_enabled[id] = true;     public disable_sound(id)     g_sound_enabled[id] = false; public client_connect(id) {     g_kills[id] = 0;     g_deaths[id] = 0;     g_sound_enabled[id] = true; } public plugin_precache() {     for ( new i = 0 ; i < sizeof g_information ; i++ )         precache_sound(g_information[i][sound]); } plugin_mode() {     new mode[9];     get_pcvar_string(g_pcvar_flags, mode, charsmax(mode));     return read_flags(mode); } public death_event() {         new killer = read_data(1);     new victim = read_data(2);         if ( is_user_connected(victim) ) {         g_kills[victim] = 0;         g_deaths[victim]++;     }         if ( ! is_user_connected(killer) )         return;         g_kills[killer]++;     g_deaths[killer] = 0;     for ( new i = 0 ; i < sizeof g_information ; i++ ) {         if ( g_kills[killer] == g_information[i][kills]) {             announce(killer, i);             break;         }     }     return; } announce(killer, level) {         new name[33];     get_user_name(killer, name, 32);     set_hudmessage(0, 100, 200, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, 2);         new mode = plugin_mode();         if ( mode & 2 )         show_hudmessage(0, g_information[level][message], name);         else if ( mode & 8 )         show_hudmessage(killer, g_information[level][message], name);         if ( mode & 1 ) {         new players[32], iplayers;         get_players(players, iplayers, "ch");                 for ( new i = 0 ; i < iplayers ; i++ ) {             if ( g_sound_enabled[players[i]] )                 client_cmd(players[i], "spk %s", g_information[level][sound]);         }     }         else if ( mode & 4 )         client_cmd(killer, "spk %s", g_information[level][sound]); } public reset_hud(id) {     if ( ! ( plugin_mode() & 16 ) )         return;         if ( g_kills[id] > g_information[0][kills] )         client_print(id, print_chat, "* You are on a killstreak with %d kills.", g_kills[id]);             else if ( g_deaths[id] > 1 )         client_print(id, print_chat, "* Take care, you are on a deathstreak with %d deaths in a row.", g_deaths[id]); }

bidonas 08-20-2013 14:55

Re: [HELP] Ultimate Sound modification
 
Quote:

Originally Posted by Black Rose (Post 2018087)
Sorry for overdoing it...
Code:
#include <amxmodx> #define PLUGIN_NAME "Ultimate Sounds Advanced" #define PLUGIN_VERSION "0.1" #define PLUGIN_AUTHOR "SAMURAI" new g_kills[33]; new g_deaths[33]; new bool:g_sound_enabled[33]; new g_pcvar_flags; enum enum_information {     kills,     message[64],     sound[64] } new const g_information[][enum_information] = {     { 3,    "%s: Triple Kill !",    "ultimate_sounds/triplekill_ultimate" },     { 4,    "%s: Multi Kill !", "ultimate_sounds/multikill_ultimate" },     { 6,    "%s: Ultra Kill !", "ultimate_sounds/ultrakill_ultimate" },     { 8,    "%s: Killing Spree !""ultimate_sounds/killingspree_ultimate" },     { 10,   "%s: Mega Kill !""ultimate_sounds/megakill_ultimate" },     { 12,   "%s: Holy Shit !""ultimate_sounds/holyshit_ultimate" },     { 14,   "%s: Ludicrous Kill !", "ultimate_sounds/ludicrouskill_ultimate" },     { 15,   "%s: Rampage !",        "ultimate_sounds/rampage_ultimate" },     { 16,   "%s: Unstoppable !",    "ultimate_sounds/unstoppable_ultimate" },     { 18,   "%s: M o n s t e R  K i L L ! ! !", "ultimate_sounds/monsterkill_ultimate" } }; public plugin_init() {     register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);         g_pcvar_flags = register_cvar("ultimate_sounds_advanced", "ab");         register_event("ResetHUD", "reset_hud", "b");     register_event("DeathMsg", "death_event", "a");         register_clcmd("say /play", "enable_sound");     register_clcmd("say /stop", "disable_sound"); } public enable_sound(id)     g_sound_enabled[id] = true;     public disable_sound(id)     g_sound_enabled[id] = false; public client_connect(id) {     g_kills[id] = 0;     g_deaths[id] = 0;     g_sound_enabled[id] = true; } public plugin_precache() {     for ( new i = 0 ; i < sizeof g_information ; i++ )         precache_sound(g_information[i][sound]); } plugin_mode() {     new mode[9];     get_pcvar_string(g_pcvar_flags, mode, charsmax(mode));     return read_flags(mode); } public death_event() {         new killer = read_data(1);     new victim = read_data(2);         if ( is_user_connected(victim) ) {         g_kills[victim] = 0;         g_deaths[victim]++;     }         if ( ! is_user_connected(killer) )         return;         g_kills[killer]++;     g_deaths[killer] = 0;     for ( new i = 0 ; i < sizeof g_information ; i++ ) {         if ( g_kills[killer] == g_information[i][kills]) {             announce(killer, i);             break;         }     }     return; } announce(killer, level) {         new name[33];     get_user_name(killer, name, 32);     set_hudmessage(0, 100, 200, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, 2);         new mode = plugin_mode();         if ( mode & 2 )         show_hudmessage(0, g_information[level][message], name);         else if ( mode & 8 )         show_hudmessage(killer, g_information[level][message], name);         if ( mode & 1 ) {         new players[32], iplayers;         get_players(players, iplayers, "ch");                 for ( new i = 0 ; i < iplayers ; i++ ) {             if ( g_sound_enabled[players[i]] )                 client_cmd(players[i], "spk %s", g_information[level][sound]);         }     }         else if ( mode & 4 )         client_cmd(killer, "spk %s", g_information[level][sound]); } public reset_hud(id) {     if ( ! ( plugin_mode() & 16 ) )         return;         if ( g_kills[id] > g_information[0][kills] )         client_print(id, print_chat, "* You are on a killstreak with %d kills.", g_kills[id]);             else if ( g_deaths[id] > 1 )         client_print(id, print_chat, "* Take care, you are on a deathstreak with %d deaths in a row.", g_deaths[id]); }

Thank you is working but i was trying to do something like this :

Code:

public enable_sound(id)
    g_sound_enabled[id] = true;
        client_print(1, print_chat, "Your Sound Was Enabled")
public disable_sound(id)
    g_sound_enabled[id] = false;       
client_print(0, print_chat, "Your Sound Was Disable")

And i get symbol already defined client_print can say why?

Black Rose 08-20-2013 16:53

[HELP] Ultimate Sound modification
 
You just need some curly brackets.
Code:
public enable_sound(id) {     g_sound_enabled[id] = true;     client_print(id, print_chat, "Your Sound Was Enabled") } public disable_sound(id) {     g_sound_enabled[id] = false;     client_print(id, print_chat, "Your Sound Was Disable") }


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

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