Jump to content

Welcome to RpgWars România
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. If you already have an account, login here - otherwise create an account for free today!



Foto

[Tutorial] Schimbarea sunetelor originale cu altele




    No replies to this topic

    #1
    OfflinePrime

    Premium
    Member Title : WwW.RpgWars.Ml
    Posts : 230
    warning points : 0 puncte de avertizare
    Puncte : 528
    Pasul I
    Intai includem fisierele .inc corespunzatoare in sursa:
    #include < amxmodx >
    #include < fakemeta >
    Pasul II
    Creem o variabila globala falsa:
    new bool:bUserHasAk47[ 33 ];
    Pasul III
    Acum enumeram sunetele originale ale armei intr-o constanta:
    new const OriginalAK47Sounds[ ][ ] = {

    "weapons/ak47-1.wav",
    "weapons/ak47-2.wav",
    "weapons/ak47_boltpull.wav",
    "weapons/ak47_clipin.wav",
    "weapons/ak47_clipout.wav"
    };
    Pasul IV
    Acum enumeram sunetele pe care vrem sa le inlocuim:
    new const GoldAK47_SoundList[ ][ ] = {

    "newAK/GoldAk47-1.wav",
    "newAK/GoldAk47-2.wav",
    "newAK/GoldAk47_boltpull.wav",
    "newAK/GoldAk47_clipin.wav",
    "newAK/GoldAk47_clipout.wav"
    };
    Pasul V
    La plugin_init adaugam un forward:
    register_forward( FM_EmitSound, "fw_EmitSounds" );
    Pasul VI
    Pentru ca vom folosi sunete, le vom adauga la plugin_prechace pentru a rula corespunzator:
    public plugin_precache( ) {

    static i;
    for( i = 0; i <= charsmax( GoldAK47_SoundList ); i++ )
    precache_sound( GoldAK47_SoundList[ i ] );
    }
    Pasul VII
    Acum creem publicul cu constantele:
    public fw_EmitSounds( const id, const channel, const sample[ ] ) {
    Pasul VIII
    Apoi:
    if( is_user_alive( id ) ) { // Verificam daca user-ul este in viata:

    if( bUserHasAk47[ id ] ) { // "Aducem" variabila globala, in acest moment, adevarata

    for( new i = 0; i < sizeof GoldAK47_SoundList; i++ ) { // Stocarea sunetelor

    if( equal( sample, OriginalAK47Sounds[ i ] ) ) { // Sunetele originale "sunt chemate"...

    emit_sound( id, channel, GoldAK47_SoundList[ i ], 1.0, ATTN_NORM, 0, PITCH_NORM ); // Aici le inlocuim cu cele pe care le vrem noi
    return FMRES_SUPERCEDE;
    }
    }
    }
    }

    return FMRES_IGNORED;
    }
    Pasul IX
    In final iese:
    #include < amxmodx >
    #include < fakemeta >

    #pragma semicolon 1

    #define PLUGIN "[TuT] Change Sounds"
    #define VERSION "0.1"

    new const GoldAK47_SoundList[ ][ ] = {

    "newAK/GoldAk47-1.wav",
    "newAK/GoldAk47-2.wav",
    "newAK/GoldAk47_boltpull.wav",
    "newAK/GoldAk47_clipin.wav",
    "newAK/GoldAk47_clipout.wav"
    };

    new const OriginalAK47Sounds[ ][ ] = {

    "weapons/ak47-1.wav",
    "weapons/ak47-2.wav",
    "weapons/ak47_boltpull.wav",
    "weapons/ak47_clipin.wav",
    "weapons/ak47_clipout.wav"
    };

    new bool:bUserHasAk47[ 33 ];

    public plugin_init( ) {

    register_plugin( PLUGIN, VERSION, "YONTU" );

    register_forward( FM_EmitSound, "fw_EmitSounds" );

    }

    public plugin_precache( ) {

    static i;
    for( i = 0; i <= charsmax( GoldAK47_SoundList ); i++ )
    precache_sound( GoldAK47_SoundList[ i ] );
    }

    public client_putinserver( id ) {

    bUserHasAk47[ id ] = false;
    }

    public client_disconnect( id ) {

    bUserHasAk47[ id ] = false;
    }

    public fw_EmitSounds( const id, const channel, const sample[ ] ) {

    if( is_user_alive( id ) ) {

    if( bUserHasAk47[ id ] ) {

    for( new i = 0; i < sizeof GoldAK47_SoundList; i++ ) {

    if( equal( sample, OriginalAK47Sounds[ i ] ) ) {

    emit_sound( id, channel, GoldAK47_SoundList[ i ], 1.0, ATTN_NORM, 0, PITCH_NORM );
    return FMRES_SUPERCEDE;
    }
    }
    }
    }

    return FMRES_IGNORED;
    }

    Vezi profilul utilizatorului


    In total sunt 0 utilizatori conectati: 0 Inregistrati, 0 Invizibil si 0 Vizitatori

    Utilizatori ce navigheaza in acest forum: Nici unul



     
    • creeaza un forum | © PunBB | Forum gratuit de suport | Contact | Semnaleaza un abuz | Poti avea un blog