Ir al contenido
  • Crear una cuenta

Sistema de Recompensas por Kills + Guardado


AguuS.-

Posts recomendados

Sistema de Recompensas


KILLS + GUARDADO FVAULT


 


 


Bueno, sin más que decir.


 


Es un simple sistema de recompensas, que al matar


cierta cantidad de jugadores ( Nemesis, Survivors, Zombieo Humano)


te da una recompensa cada vez que llegués a la cantidad requerida.


 


El plugin contiéne guardado por Fvault.


 


No doy soporte al tema, ya que esta bien codeado y testeado.


 


Es 100% modificable, y lo dejo como plugin independiente ya que


la mayoria de los que lo van a usar no va a dar ni el 0,1 % de los creditos.


 


*- ChangeLogs -*


 


Version 1.0


 


Comienzo del Plugin.



#include < amxmodx >

#include < hamsandwich >

#include < zombieplague >

#include < fvault >



new g_killeds[ 33 ][ 4 ]

new g_playername[ 33 ][32 ]

new const sound_reward[ ] = { "zombie_plague/reward.wav" }

new const Save[ ] = "RewardSave"



new cvar_reqnemesis, cvar_reqsurvivors, cvar_reqzombies, cvar_reqhumans, cvar_nemreward, cvar_survreward, cvar_zmreward, cvar_hmreward



public plugin_init( ) {

        register_plugin( "Rewards", "1.0", "AguuS.-" )

        register_event( "DeathMsg", "event_DeathMsg", "a", "1>0" )



        cvar_reqnemesis = register_cvar( "zp_nemesis_requiered", "50" )

        cvar_reqsurvivors = register_cvar( "zp_survivors_requiered", "50" )

        cvar_reqzombies = register_cvar( "zp_zombies_requiered", "100" )

        cvar_reqhumans = register_cvar( "zp_humans_requiered", "100" )



        cvar_nemreward = register_cvar( "zp_nemesis_reward", "500" )

        cvar_survreward = register_cvar( "zp_survivor_reward", "500" )

        cvar_zmreward = register_cvar( "zp_zombie_reward", "250" )

        cvar_hmreward = register_cvar( "zp_human_reward", "250" )

}



public event_DeathMsg( ) {

    static attacker; attacker = read_data( 1 )

    static victim; victim = read_data( 2 )



        if (zp_get_user_nemesis( victim ) ) {

                g_killeds[ attacker ][ 0 ]++

                check_frags( attacker, 0 )

        }

        else if ( zp_get_user_survivor( victim ) ) {

                g_killeds[ attacker ][ 1 ]++

                check_frags( attacker, 1 )

        }

        else if ( zp_get_user_zombie( victim ) ) {

                g_killeds[ attacker ][ 2 ]++

                check_frags( attacker, 2 )

        }

        else if ( !zp_get_user_zombie( victim ) ) {

                g_killeds[ attacker ][ 3 ]++

                check_frags( attacker, 3 )

        }

}



public client_putinserver( id ) {

        get_user_name( id, g_playername[ id ], charsmax( g_playername[ ] ) )



        g_killeds[ id ][ 0 ] = 0

        g_killeds[ id ][ 1 ] = 0

        g_killeds[ id ][ 2 ] = 0

        g_killeds[ id ][ 3 ] = 0



        CargarDatos( id )

}



public client_disconnect( id ) {

        if ( !is_user_bot( id ) )

                GuardarDatos( id )

}



public plugin_precache() precache_sound(sound_reward)



public check_frags( id, killtype ) {

        switch ( killtype ) {

                case 0: {

                        if ( g_killeds[ id ][ 0 ] >= get_pcvar_num( cvar_reqnemesis ) ) {

                                ColoredPrint( id, "!g[Rewards]!y Ganaste!g %d!y ammopacks por matar!g %d nemesis!y.", get_pcvar_num( cvar_nemreward ), get_pcvar_num( cvar_reqnemesis ) )

                                zp_set_user_ammo_packs( id, zp_get_user_ammo_packs( id ) + get_pcvar_num( cvar_nemreward ) )

                                g_killeds[ id ][ 0 ] = 0

                                client_cmd( id, "spk %s", sound_reward )

                        }

                }

                case 1: {

                        if ( g_killeds[ id ][ 1 ] >= get_pcvar_num( cvar_reqsurvivors ) ) {

                                ColoredPrint( id, "!g[Rewards]!y Ganaste!g %d!y ammopacks por matar!g %d survivors!y.", get_pcvar_num( cvar_survreward ), get_pcvar_num( cvar_reqsurvivors ) )

                                zp_set_user_ammo_packs( id, zp_get_user_ammo_packs( id ) + get_pcvar_num( cvar_survreward ) )

                                g_killeds[ id ][ 1 ] = 0

                                client_cmd( id, "spk %s", sound_reward )

                        }

                }

                case 2: {

                        if ( g_killeds[ id ][ 2 ] >= get_pcvar_num( cvar_reqzombies ) )

                        {

                                ColoredPrint( id, "!g[Rewards]!y Ganaste!g %d!y ammopacks por matar!g %d zombies!y.", get_pcvar_num( cvar_zmreward ), get_pcvar_num( cvar_reqzombies ) )

                                zp_set_user_ammo_packs( id, zp_get_user_ammo_packs( id ) + get_pcvar_num( cvar_zmreward ) )

                                g_killeds[ id ][ 2 ] = 0

                                client_cmd( id, "spk %s", sound_reward )

                        }

                }

                case 3: {

                        if ( g_killeds[ id ][ 3 ] == get_pcvar_num( cvar_reqhumans ) )

                        {

                                ColoredPrint( id, "!g[Rewards]!y Ganaste!g %d!y ammopacks por matar!g %d humanos!y.", get_pcvar_num( cvar_hmreward ), get_pcvar_num( cvar_reqhumans ) )

                                zp_set_user_ammo_packs( id, zp_get_user_ammo_packs( id ) + get_pcvar_num( cvar_hmreward ) )

                                g_killeds[ id ][ 3 ] = 0

                                client_cmd( id, "spk %s", sound_reward )

                        }

                }

        }



        return PLUGIN_HANDLED;

}



CargarDatos( id ) {

    static Data[ 512 ], LoadNemesis[ 10 ], LoadSurvivors[ 10 ], LoadZombies[ 10 ], LoadHumans[ 10 ]

    

    if( !fvault_get_data( Save, g_playername[ id ], Data, charsmax( Data ) ) )

        return;

    

    parse( Data, g_playername[ id ], charsmax(g_playername[ ]), LoadNemesis, charsmax( LoadNemesis ), LoadSurvivors, charsmax( LoadSurvivors ),

        LoadZombies, charsmax( LoadZombies ), LoadHumans, charsmax( LoadHumans ) )

    

    g_killeds[ id ][ 0 ] = str_to_num( LoadNemesis )

    g_killeds[ id ][ 1 ] = str_to_num( LoadSurvivors )

    g_killeds[ id ][ 2 ] = str_to_num( LoadZombies )

    g_killeds[ id ][ 3 ] = str_to_num( LoadHumans )

}



GuardarDatos( id ) {

    static Data[ 512 ]

    formatex( Data, charsmax( Data ), "%s %d %d %d %d", g_playername[ id ], g_killeds[ id ][ 0 ], g_killeds[ id ][ 1 ], g_killeds[ id ][ 2 ], g_killeds[ id ][ 3 ] )

    fvault_set_data( Save, g_playername[ id ], Data )

}

                        

stock ColoredPrint( const id, const input[ ], any:... ) {

    new count = 1, players[ 32 ]

    static msg[ 191 ]

    vformat( msg, 190, input, 3 )

    

    replace_all( msg, 190, "!g", "^4" )

    replace_all( msg, 190, "!y", "^1" )

    replace_all( msg, 190, "!team", "^3" )

    replace_all( msg, 190, "!team2", "^0" )

    

    if ( id ) players[ 0 ] = id; else get_players( players, count, "ch" )

    {

        for ( new i = 0; i < count; i++ ) {

            if ( is_user_connected( players[ i ] ) ) {

                message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, players[ i ] )

                write_byte( players[ i ] )

                write_string( msg )

                message_end( )

            }

        }

    }

}

Enlace al comentario
Compartir en otros sitios

Invitado
Este tema se encuentra cerrado a nuevas respuestas.
  • Navegando Recientemente   0 miembros

    • No hay usuarios registrados viendo esta página
×
×
  • Crear nuevo...