VIP Nvault Save [ 1.0 ]

In jos

descarca VIP Nvault Save [ 1.0 ]

Mesaj Scris de DarkArms la data de Dum Noi 13, 2016 6:59 pm

Descriere: Acest plugin are scopul de a te ajuta sa dai unui jucator VIP prin intermediul nvault-ului, cine are vip nu primeste nimic special, dar plugin-ul contine o functie speciala prin care poti adauga benefici exterioare jucatorilor VIP ( prin native ).

Descarcare:
Spoiler:
Cod:

#include <amxmodx>
#include <amxmisc>
#include <nvault>


new const PluginName [] = "VIP Api";
new const PluginVers [] = "1.1";
new const PluginAuth [] = "Craxor";


new gVaultId;
new const VaultName [] = "vip_api_save";


new const data1 [] = "1";
new const data0 [] = "0";


new gName[33][33];


public plugin_init( )
{
    register_plugin
    (
        PluginName,
        PluginVers,
        PluginAuth
    );

    gVaultId = nvault_open( VaultName );

    if( gVaultId == INVALID_HANDLE )
        set_fail_state( "Problem opening Vip Api vault file..... " );

    register_concmd( "amx_vip_add", "VIPAdd", ADMIN_RCON, "< Name >" );
    register_concmd( "amx_vip_remove", "VIPRem", ADMIN_RCON, "< Name >" );
}

public VIPAdd( id, level, cid )
{
    if( !cmd_access( id, level, cid , 2 ) )
        return PLUGIN_HANDLED;

    new szArg[35];
    read_argv( 1, szArg, charsmax( szArg ) );

    new TgId = cmd_target( id, szArg, CMDTARGET_ALLOW_SELF );


    if( user_vip(TgId) )
    {
        client_print( id, print_console, "We sorry, but user '%s' is already a vip.", gName[TgId] );
        return PLUGIN_HANDLED;
    }
   
   
    nvault_set( gVaultId, gName[TgId], data1 );

    client_print( 0, print_chat, "Player '%s' become a new of vip of the server!", gName[TgId]);
    client_print( id, print_console, "You've succesfully give to user '%s' VIP acces.", gName[TgId]);

    return PLUGIN_HANDLED;
}

public VIPRem( id, level, cid )
{
    if( !cmd_access( id, level, cid , 2 ) )
        return PLUGIN_HANDLED;

    new szArg[35];
    read_argv( 1, szArg, charsmax( szArg ) );

    new TgId = cmd_target( id, szArg, CMDTARGET_ALLOW_SELF );


    if( !user_vip(TgId) )
        client_print( id, print_console, "We sorry, but user '%s' is not a vip.", gName[TgId] );
   
    nvault_set( gVaultId, gName[TgId], data0 );

    client_print( id, print_console, "Player '%s' is no more a vip!", gName[TgId] );
    client_print( 0, print_chat, "Player '%s' is no more a vip!", gName[TgId]);

    return PLUGIN_HANDLED;
}


public plugin_natives()
{
    register_native( "user_is_vip", "_is_vip" );
}

public _is_vip( Id, Params )
{
    new id = get_param( 1 );

    if( get_param(2) > 0 )
    {
        nvault_set( gVaultId, gName[id], get_param(3) ? data1 : data0 );

        return user_vip( id );
    }

    return user_vip( id )

   
}

public client_putinserver( id )
{
    get_user_name( id, gName[id], charsmax( gName[] ) );

}

public client_infochanged( id )
{
    get_user_info( id, "name" , gName[id] , charsmax( gName[] ) );
}

bool:user_vip(id)
{
    new IsVip[2], iTS;
    nvault_lookup( gVaultId , gName[id] , IsVip, charsmax( IsVip ) , iTS );

    if( str_to_num( IsVip ) > 0 )
        return true;
    return false;   
}

public plugin_end( )
{
    nvault_close( gVaultId );
}

Nume:VIP api
Versiune: 1.0
Link oficial: extreamcs..

Instalare:
1. Fisierul nume_plugin.sma il puneti in addons/amxmodx/scripting
2. Fisierul nume_plugin.amxx il puneti in addons/amxmodx/plugins
3. Intrati in fisierul addons/amxmodx/configs/plugins.ini si adaugati la urma:
Cod:
nume_plugin.amxx


Comenzi administrative (se tasteaza in consola si trebuie sa fiti administrator):

    amx_vip_add <Nume> - dai vip unui jucator.
    amx_vip_remove <Nume> - scoti vip-ul unui jucator(trebuie sa fie conectat)


Native
[code=php]
/*
id - index-ul jucatorului.
Modify - Daca e '1' poti modifica daca sa-i dai vip sa nu din al 3 argument, daca e 0 va fi folosit doar ca sa returnati daca user-ul e sau nu VIP.
Add - daca 1 si modify e '1' ii da vip daca e 0 si modifiy e '1' ii va scoate vip-ul.
*/
user_is_vip( id, Modify, Add )
[/code]

Changelog
1.0 - prima lansare
1.1 - Schimbat, acuma salveaza doar pe NUME, nu are niciun bug daca-ti schimbi numele sau alte prostii din'astea.

DarkArms
Founders
Founders

Mesaje : 226
Data de inscriere : 23/09/2016
Varsta : 16
Localizare : Terra

http://lowgamers.forumgratuit.ro

Sus In jos

descarca Re: VIP Nvault Save [ 1.0 ]

Mesaj Scris de Dracu la data de Dum Noi 13, 2016 9:31 pm

Good Job!
avatar
Dracu
Moderators
Moderators

Mesaje : 193
Data de inscriere : 11/11/2016

Sus In jos

descarca Re: VIP Nvault Save [ 1.0 ]

Mesaj Scris de Tipu la data de Mier Noi 23, 2016 1:28 pm

Good Job!
avatar
Tipu
Administrators
Administrators

Mesaje : 151
Data de inscriere : 22/11/2016

Sus In jos

descarca Re: VIP Nvault Save [ 1.0 ]

Mesaj Scris de CelRau la data de Dum Noi 27, 2016 7:58 pm

Good Job!
avatar
CelRau
Registered user
Registered user

Mesaje : 184
Data de inscriere : 26/11/2016

Sus In jos

descarca Re: VIP Nvault Save [ 1.0 ]

Mesaj Scris de Continut sponsorizat


Continut sponsorizat


Sus In jos

Sus

- Subiecte similare

 
Permisiunile acestui forum:
Nu puteti raspunde la subiectele acestui forum