AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Load VIPS from another file.. (https://forums.alliedmods.net/showthread.php?t=232766)

Dishonored 01-04-2014 14:20

Load VIPS from another file..
 
How can i make that ? How to load VIPS from another file, other than users.ini ?

P.S:
Code:

/*                PLUGIN CREAT DE ZeniX aka lucy
                                        REALIZAT IN TOTALITATE + CVAR 2013
                                                V 0.1
                                               
        // CVAR

        bullets_gold "0"                        // CVAR sa apara linile golden cand tragi ;) 1- ON / 2- OFF
       
        bonus_status "1"                        // CVAR sa fie activat Pluginul BONUS 1- ON /0 - OFF
        bonus_maxhealth "255"                // CVAR MAXIMUM de bonus cat sa aibe un player default 255

        bonus_knife "0"                                // CVAR BONUS kill cutit kill 0 dezactivat / default 10
        bonus_knifeheadshot "20"        // CVAR BONUS kill cutit kill/headshot 0 dezactivat / default 20
        bonus_kill "25"                                // BOnus kill
        bonus_hs", "55")                        // Bonus kill HS       
               
*/
#include <amxmodx>
#include <fun>
#include <amxmisc>
#include <cstrike>
#include <colorchat>
#include <hamsandwich>
#include <fakemeta_util>


#define PLUGIN        "Classic VIP"
#define VERSIUNE "0.1"

#define CLASSIC_VIP ADMIN_LEVEL_H

static const COLORG[] = "^x04"
static const COLORD[] = "^x01"
static const COLORT[] = "^x03"

/*
new v_Ak47_Gold [ ] = "models/v_golden_ak47.mdl"
new p_Ak47_Gold [ ] = "models/p_golden_ak47.mdl"

new v_M4a1_Gold [ ] = "models/v_golden_m4a1_UP.mdl"
new p_M4a1_Gold [ ] = "models/p_golden_m4a1_UP.mdl"

new v_Golden_Deagle [ ] = "models/v_golden_deagle.mdl"
new p_Golden_Deagle [ ] = "models/p_golden_deagle.mdl"
*/

new b_Status, b_MaxHealth, b_Kill, b_Knife, b_Headshot, b_KnifeHeadshot
new bullets[ 33 ], m_spriteTexture
new cvar_goldbullets
new maxplayers, gmsgSayText
//, g_msgSayText

new ViewModels [ ] [ ] = {
       
        "models/v_golden_m4a1.mdl",
        "models/v_golden_ak47.mdl",
        "models/v_golden_deagle.mdl"
}

new PlayersModels [ ] [ ] = {
       
        "models/p_golden_m4a1.mdl",       
        "models/p_golden_ak47.mdl",
        "models/p_golden_deagle.mdl"
}

public plugin_init ( ) {

        register_plugin ( PLUGIN, VERSIUNE, "zenix aka lucylucy" );

        register_clcmd ( "say /arme", "ApperNext", CLASSIC_VIP );
        register_clcmd ( "say_team /arme", "ApperNext", -1 );
        register_clcmd("say /vreauvip", "ShowMotd");

        register_event( "CurWeapon", "bullets_gold", "be", "1=1", "3>0");
        register_event ( "CurWeapon", "CurrentWeapon", "be", "1=1" );
        register_event( "DeathMsg", "EventKillBonus", "a", "1>0" );

        RegisterHam ( Ham_Spawn, "player", "ApperNext", 1 );
        RegisterHam ( Ham_Spawn, "player", "Player_Spawn", 1);
        RegisterHam ( Ham_TakeDamage, "player", "Player_TakeDamage" );
       
        maxplayers = get_maxplayers()
        gmsgSayText = get_user_msgid("SayText")
        register_clcmd("say", "handle_say")
       
        register_logevent("round_start", 2, "1=Round_Start")
       
        // CVAR-uri .. La Greu ;) ZeNiX       
        cvar_goldbullets = register_cvar("bullets_gold", "0");        // CVAR sa apara linile gol cand tragi ;) 1- ON / 2- OFF
       
        b_Status = register_cvar("bonus_status", "1");        // CVAR sa fie activat Pluginul BONUS 1- ON /0 - OFF
        b_MaxHealth = register_cvar("bonus_maxhealth", "255");        // CVAR MAXIMUM de bonus cat sa aibe un player default 255

        b_Knife = register_cvar("bonus_knife", "0");                // CVAR BONUS kill cutit kill 0 dezactivat / default 10
        b_KnifeHeadshot = register_cvar("bonus_knifeheadshot", "20"); // CVAR BONUS kill cutit kill/headshot 0 dezactivat / default 20
        b_Kill = register_cvar("bonus_kill", "25");        // BOnus kill
        b_Headshot = register_cvar("bonus_hs", "55");        // Bonus kill HS
       

}

public plugin_precache ( ) {
/*
        precache_model ( v_Ak47_Gold )
        precache_model ( p_Ak47_Gold )

        precache_model ( v_M4a1_Gold )
        precache_model ( p_M4a1_Gold )

        precache_model ( v_Golden_Deagle )
        precache_model ( p_Golden_Deagle )
*/
        new lucy;
        for ( lucy = 0; lucy < sizeof ( ViewModels ); lucy++ )
                engfunc ( EngFunc_PrecacheModel, ViewModels [ lucy ] );
        new zenix;
        for ( zenix = 0; zenix < sizeof ( PlayersModels ); zenix++ )
                engfunc ( EngFunc_PrecacheModel, PlayersModels [ zenix ] );       
               
        m_spriteTexture = precache_model("sprites/dot.spr")       
}

       
public Player_Spawn(id)
{
          new iPlayers [ 32 ], iNum, i;
        get_players ( iPlayers, iNum );
       
        for ( i = 0; i < iNum; i++ )
        {
                if( !is_user_alive ( iPlayers [ i ] ) )
                        continue;

                if(get_user_flags(id) & CLASSIC_VIP) {
               
                fm_strip_user_weapons ( iPlayers [ i ] );
                set_pdata_int ( iPlayers [ i ], 116, 0 );
                give_item(id, "weapon_deagle")
                give_item(id, "weapon_knife")
                fm_give_item(id, "weapon_hegrenade")
                fm_give_item(id, "weapon_hegrenade")           
                give_item(id, "weapon_flashbang") 
                give_item(id, "weapon_flashbang")
                give_item(id, "weapon_smokegrenade")
        }
        }
}

/*
 if(is_user_alive(id))
    {
        new CsTeams:team = cs_get_user_team(id)
        switch(team)
        {
            case 0:
            {
                strip_user_weapons(id)
                give_item(id, "weapon_knife")
                give_item(id, "weapon_hegrenade")
                give_item(id, "weapon_hegrenade")             
                give_item(id, "weapon_flashbang")
                give_item(id, "weapon_flashbang")
                give_item(id, "weapon_smokegrenade")
            }

        }

    }
*/

public ApperNext ( id ) {
       
        if ( get_user_team ( id ) == 1 && get_user_flags(id) & CLASSIC_VIP ) {
               
                set_task( 0.1, "ArmeVip", id );
        }
       
        if ( get_user_team ( id ) == 2 && get_user_flags(id) & CLASSIC_VIP ) {
               
                set_task( 0.1, "ArmeVip", id );
        }
       
}

public ArmeVip ( id, level, cid ) {

        new menu = menu_create ( "\rARME \yVIP", "ArmeVipGiver" );

        menu_additem ( menu, "\wM4A1 + Deagle \yGOLDEN \r X2 DMG", "1", 0);
        menu_additem ( menu, "\wAK47 + Deagle \yGOLDEN \r X2 DMG", "2", 0);
       
        menu_setprop ( menu, MPROP_EXIT, MEXIT_ALL );
        menu_display ( id, menu, 0 );
       
       
        return 1;
}

public ArmeVipGiver ( id, menu, item ) {

        if( item == MENU_EXIT )
                {
                        return 1;
                }
       
        new data [ 6 ], szName [ 64 ];
        new access, callback;
        menu_item_getinfo ( menu, item, access, data,charsmax ( data ), szName,charsmax ( szName ), callback );
        new key = str_to_num ( data );
       
        switch(key)
        {
                case 1:
                {
                        fm_give_item(id, "weapon_m4a1");
                        fm_give_item(id, "weapon_deagle");               
                        cs_set_user_bpammo(id, CSW_M4A1, 90);
                        cs_set_user_bpammo(id, CSW_DEAGLE, 35)

                        ColorChat ( id, TEAM_COLOR, "Ai Primit M4A1 + Deagle Golden !");
                }
                case 2:
                {
                        fm_give_item(id, "weapon_ak47");
                        fm_give_item(id, "weapon_deagle");               
                        cs_set_user_bpammo(id, CSW_AK47, 90);
                        cs_set_user_bpammo(id, CSW_DEAGLE, 35);       
               
                        ColorChat ( id, TEAM_COLOR, "Ai Primit AK47 + Deagle Golden !");                       
                }
        }
        return 1;
}

public CurrentWeapon ( id ) {
       
        new szWeapon = get_user_weapon ( id ) ;
        if ( szWeapon == CSW_M4A1 && get_user_flags( id ) & CLASSIC_VIP ) {
               
               
                set_pev ( id, pev_viewmodel2, ViewModels [ 0 ] );
                set_pev ( id, pev_weaponmodel2, PlayersModels [ 0 ] );
               
        }
       
        if ( szWeapon == CSW_AK47 && get_user_flags( id ) & CLASSIC_VIP) {
               
                set_pev ( id, pev_viewmodel2, ViewModels [ 1 ] );
                set_pev ( id, pev_weaponmodel2, PlayersModels [ 1 ] );
               
        }

        if ( szWeapon == CSW_DEAGLE && get_user_flags( id ) & CLASSIC_VIP) {
               
                set_pev ( id, pev_viewmodel2, ViewModels [ 2 ] );
                set_pev ( id, pev_weaponmodel2, PlayersModels [ 2 ] );
               
        }
       
        return 1;
}

public Player_TakeDamage ( iVictim, iInflictor, iAttacker, Float:fDamage, iDamageBits ) {

    if ( get_user_weapon ( iAttacker ) == CSW_M4A1 && get_user_flags( iAttacker ) & CLASSIC_VIP  ) {
       
        SetHamParamFloat( 4, fDamage * 2.0);
        return HAM_HANDLED;
       
    }
 
    if (  get_user_weapon ( iAttacker ) == CSW_AK47 && get_user_flags( iAttacker ) & CLASSIC_VIP ) {
       
        SetHamParamFloat( 4, fDamage * 2.0);
        return HAM_HANDLED;
       
    }
       
    if ( get_user_weapon ( iAttacker ) == CSW_DEAGLE && get_user_flags( iAttacker ) & CLASSIC_VIP ) {
       
        SetHamParamFloat( 4, fDamage * 2.0);
        return HAM_HANDLED;
       
    }
   
    return HAM_IGNORED;
   
}


public ShowMotd(id) {
        new iCfgDir[32], iFile[192];
       
        get_configsdir(iCfgDir, charsmax(iCfgDir));
        formatex(iFile, charsmax(iFile), "%s/vip.html", iCfgDir);

        show_motd(id, iFile);
}
/*
public client_authorized ( id ) {

        set_task(30.0, "PrintChat" ,id)

}

public PrintChat ( id ) {

        //client_print(id, print_chat, "\r[VIP] \wScrie in chat \r/vreauvip \wpentru Beneficile VIP.")
        ColorChat ( id, GREEN, "Scrie in chat /vreauvip pentru Beneficiile VIP !");

}
*/

public bullets_gold(id)
{
        if (get_pcvar_num(cvar_goldbullets) && get_user_flags( id ) & CLASSIC_VIP )
        {
                new clip,ammo
                new wpnid = get_user_weapon(id,clip,ammo)
                new pteam[16]
               
                get_user_team(id, pteam, 15)
               
                if ((bullets[id] > clip) && (wpnid == CSW_AK47, CSW_M4A1, CSW_DEAGLE && get_user_flags( id ) & CLASSIC_VIP) )
                {
                        new vec1[3], vec2[3]
                        get_user_origin(id, vec1, 1) // origin; your camera point.
                        get_user_origin(id, vec2, 4) // termina; where your bullet goes (4 is cs-only)
                       
                       
                        //BEAMENTPOINTS
                        message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
                        write_byte (0)    //TE_BEAMENTPOINTS 0
                        write_coord(vec1[0])
                        write_coord(vec1[1])
                        write_coord(vec1[2])
                        write_coord(vec2[0])
                        write_coord(vec2[1])
                        write_coord(vec2[2])
                        write_short( m_spriteTexture )
                        write_byte(1) // framestart
                        write_byte(5) // framerate
                        write_byte(2) // life
                        write_byte(10) // width
                        write_byte(0) // noise
                        write_byte( 255 )    // r, g, b
                        write_byte( 215 )      // r, g, b
                        write_byte( 0 )      // r, g, b
                        write_byte(200) // brightness
                        write_byte(150) // speed
                        message_end()
                }
               
                bullets[id] = clip
        }
       
}

/*
    new killer = read_data(1);
    new victim = read_data(2);
    new headshot = read_data(3);
*/

public EventKillBonus() {
    new killer
    new victim
    new headshot
    new weapon = get_user_weapon(killer);
    new num;
   
    if(killer == victim || !get_pcvar_num(b_Status) || !is_user_connected(victim) || !is_user_alive(killer) && get_user_flags( killer ) && CLASSIC_VIP)
        return PLUGIN_HANDLED;
   
    if(headshot && weapon == CSW_KNIFE ) {
        num = get_pcvar_num(b_KnifeHeadshot)
        GiveHealth(killer, num)
        HudMessage(killer, "Ai primit +%ihp", num)
    } else if(headshot) {
        num = get_pcvar_num(b_Headshot)
        GiveHealth(killer, num)
        HudMessage(killer, "Ai primit +%ihp pentru HS", num)
    } else if(weapon == CSW_KNIFE) {
        num = get_pcvar_num(b_Knife)
        GiveHealth(killer, num)
        HudMessage(killer, "Ai primit +%ihp", num)
    } else {
        num = get_pcvar_num(b_Kill)
        GiveHealth(killer, num)
        HudMessage(killer, "Ai primit +%ihp pentru Kill", num)
    }
    return PLUGIN_CONTINUE;
}

GiveHealth(id, count)
    set_user_health(id, min( (get_user_health(id) + count), get_pcvar_num(b_MaxHealth) ))

stock HudMessage(const id, const input[], any:...) {
    static msg[191];
    vformat(msg, 190, input, 3);
   
    set_hudmessage(255, 255, 0, 0.27, 0.14, 0, 5.0, 5.0, 0.0, 0.0, -1);
    show_hudmessage(id, "%s^n%s", msg)
}
/*
stock client_printcolor(id, const message[], any:...)
{
        static buffer[512], argscount
        argscount = numargs()
       
        if (!id) {
               
                static players[32], num, player, i, i2
                get_players(players, num , "ch")
                       
                for (i = 0; i < num; i++) {
                       
                        player = players[i]
                       
                        static changed[5], changedcount
                        changedcount = 0
                       
                        for (i2 = 2; i2 < argscount; i2++)
                        {
                                if (getarg(i2) == LANG_PLAYER)
                                {
                                        setarg(i2, 0, player)
                                        changed[changedcount] = i2
                                        changedcount++
                                }
                        }
                       
                        vformat(buffer, charsmax(buffer), message, 3)
                       
                        replace_all(buffer, charsmax(buffer), "/g", "^4")
                        replace_all(buffer, charsmax(buffer), "/y", "^1")
               
                        message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, player)
                        write_byte(player)
                        write_string(buffer)
                        message_end()
                       
                        for (i2 = 0; i2 < changedcount; i2++)
                                setarg(changed[i2], 0, LANG_PLAYER)
                }
        }
        else {
               
                vformat(buffer, charsmax(buffer), message, 3)
               
                replace_all(buffer, charsmax(buffer), "/g", "^4")
                replace_all(buffer, charsmax(buffer), "/y", "^1")
               
                message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, id)
                write_byte(id)
                write_string(buffer)
                message_end()
        }
}
*/
public handle_say(id) {
        new said[192]
        read_args(said,192)
        if( ( containi(said, "vips") != -1 && containi(said, "vips") != -1 ) || contain(said, "/vips") != -1 )
                set_task(0.1,"print_viplist",id)
        return PLUGIN_CONTINUE
}

public print_viplist(user)
{
        new adminnames[33][32]
        new message[256]
        new id, count, x, len
       
        for(id = 1 ; id <= maxplayers ; id++)
                if(is_user_connected(id))
                        if(get_user_flags(id) & CLASSIC_VIP)
                                get_user_name(id, adminnames[count++], 31)

        len = format(message, 255, "%s VIPI ONLINE: ",COLORG)
        if(count > 0) {
                for(x = 0 ; x < count ; x++) {
                        len += format(message[len], 255-len, "^x03%s%s ", adminnames[x], x < (count-1) ? ", ":"", COLORT)
                        if(len > 96 ) {
                                print_message(user, message)
                                len = format(message, 255, "%s ",COLORG)
                        }
                }
                print_message(user, message)
        }
        else {
                len += format(message[len], 255-len, "^x01Nu sunt VIPI online.", COLORD)
                print_message(user, message)
        }
       
}

print_message(id, msg[]) {
        message_begin(MSG_ONE, gmsgSayText, {0,0,0}, id)
        write_byte(id)
        write_string(msg)
        message_end()
}

/*';';';';';';';'';';';';';';';'';';';';';';';'';';';';';';';'
;'        Plugin                                                    ;'
;'                                                            ;'
;'                By        23:16 AM                            ;'
;'                                  2.07.2013        FINISH..    ;'
;'        ZeniX aka lucy                                            ;'
';';';';';';';'';';';';';';';'';';';';';';';'';';';';';';';';'
*/

Yea, this is not my PLUGIN. :)

fysiks 01-04-2014 16:17

Re: Load VIPS from another file..
 
You request has nothing to do with this plugin since it relies on the loading of user.ini. Using users.ini is the best method. You can simply separate the VIPs within the file so that they are grouped separately from the other admins.

Dishonored 01-04-2014 16:34

Re: Load VIPS from another file..
 
Hello,
How to separe them ? I want another file for VIPS because i want some similar flags and admins don't need to have VIP. :)

fysiks 01-04-2014 20:56

Re: Load VIPS from another file..
 
Quote:

Originally Posted by Dishonored (Post 2081151)
How to separe them ?

Just group the VIPs in below the admins. E.g.:

Code:

; Admins
"STEAM_0:0:111111" "" "abcdefghijklmnopqrstu" "ce"
"STEAM_0:0:222222" "" "abcdefghijklmnopqrstu" "ce"
"STEAM_0:0:333333" "" "abcdefghijklmnopqrstu" "ce"

; VIPs
"STEAM_0:0:444444" "" "t" "ce"
"STEAM_0:0:555555" "" "t" "ce"

Quote:

Originally Posted by Dishonored (Post 2081151)
I want another file for VIPS because i want some similar flags and admins don't need to have VIP. :)

That doesn't make any sense. If admins don't need VIP then don't give them the VIP flag.

Dishonored 01-05-2014 05:23

Re: Load VIPS from another file..
 
Well, i'm still waiting. If an admin wants VIP i have to edit all files, amx_who, users.ini and admin prefixes. With vips from another file could be easier.

BlueGaming 01-05-2014 05:29

Re: Load VIPS from another file..
 
fyskis already gave you the answer ,

man until you use flags to give users vips "ADMIN_LEVEL_H" you no more need to add vip from other file ...

only if u create an other method to give vip !

you can create a boolean
PHP Code:

new bool:is_user_vip[33]; 

read from file when player is authorized set boolean true ! if her steam_id is equal with one from vips.ini ( if u wana use this method tell me and i will help !

Dishonored 01-05-2014 05:54

Re: Load VIPS from another file..
 
And i can't give by nickname ? :D By the way, show me this method.

YamiKaitou 01-05-2014 06:30

Re: Re: Load VIPS from another file..
 
Quote:

Originally Posted by Dishonored (Post 2081353)
If an admin wants VIP i have to edit all files, amx_who, users.ini and admin prefixes.

You would still have to
if you had it in a separate file




Quote:

Originally Posted by Dishonored (Post 2081367)
And i can't give by nickname ? :D By the way, show me this method.

SteamID is much better, why would you want it by name?

Dishonored 01-05-2014 06:50

Re: Load VIPS from another file..
 
Well, because i want this for non-steam and for steam too (maybe i'm wrong..)
Well, i can see you have a lot of experience here, would you like to see this topic ? => https://forums.alliedmods.net/showthread.php?t=232805
It's more urgent than vips.. :D Thank you very, very much!
P.S.: How do i give karma ? o.o


All times are GMT -4. The time now is 20:33.

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