Raised This Month: $ Target: $400
 0% 

[REQUEST] Edit a plugin


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
stelistcristi
Member
Join Date: May 2009
Old 03-27-2012 , 16:12   [REQUEST] Edit a plugin
Reply With Quote #1

Hi! Can anyone help me to edit cvars?
I want amx_glow to set a glow for a round and amx_glow2 for a map.

Anyone can help me?

Code:
//Ultra Glow
//======================================================================

//Includes
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <csx>
#include <fakemeta>
#include <hamsandwich>

//Glow Information
new g_iColors[30][3] = {
    {255, 0, 0},
    {255, 190, 190},
    {165, 0, 0},
    {255, 100, 100},
    {0, 0, 255},
    {0, 0, 136},
    {95, 200, 255},
    {0, 150, 255},
    {0, 255, 0},
    {180, 255, 175},
    {0, 155, 0},
    {150, 63, 0},
    {205, 123, 64},
    {255, 255, 255},
    {255, 255, 0},
    {189, 182, 0},
    {255, 255, 109},
    {255, 150, 0},
    {255, 190, 90},
    {222, 110, 0},
    {243, 138, 255},
    {255, 0, 255},
    {150, 0, 150},
    {100, 0, 100},
    {200, 0, 0},
    {220, 220, 0},
    {192, 192, 192},
    {190, 100, 10},
    {114, 114, 114},
    {0, 0, 0}
}

new g_sColors[30][] = {
    "red",
    "pink",
    "darkred",
    "lightred",
    "blue",
    "darkblue",
    "lightblue",
    "aqua",
    "green",
    "lightgreen",
    "darkgreen",
    "brown",
    "lightbrown",
    "white",
    "yellow",
    "darkyellow",
    "lightyellow",
    "orange",
    "lightorange",
    "darkorange",
    "lightpurple",
    "purple",
    "darkpurple",
    "violet",
    "maroon",
    "gold",
    "silver",
    "bronze",
    "grey",
    "off"
}

// Bools
new bool:HasPermGlow[33]

// PCvars
new amx_show_activity

// Variables
new g_glow[33][4]

public plugin_init()
{
    register_concmd("amx_glow", "cmd_glow", ADMIN_LEVEL_D, "<nick, #userid, authid, or @team/@all> <color> (or) <rrr> <ggg> <bbb> <aaa> -- lasts 1 round")
    register_concmd("amx_glow2", "cmd_glow", ADMIN_LEVEL_D, "<nick, #userid, authid, or @team/@all> <color> (or)  <rrr> <ggg> <bbb> <aaa> -- lasts forever")
    register_concmd("amx_glowcolors", "cmd_glowcolors", ADMIN_LEVEL_D, "shows a list of colors for amx_glow and amx_glow2")
    register_dictionary("ultra_glow.txt")
}

public plugin_cfg()
{
    amx_show_activity = get_cvar_pointer("amx_show_activity")
}

public cmd_glow(id, level, cid)
{
    if(!cmd_access(id, level, cid, 3))
    {
        return PLUGIN_HANDLED
    }
    
    new command[16], arg1[32], arg2[32], arg3[32], arg4[32], arg5[32]
    read_argv(0, command, 15)
    read_argv(1, arg1, 31)
    read_argv(2, arg2, 31)
    read_argv(3, arg3, 31)
    read_argv(4, arg4, 31)
    read_argv(5, arg5, 31)
    
    new bool:isPermGlow = false
    if(command[8] == '2')
        isPermGlow = true
    
    new name[32], authid[32]
    get_user_name(id, name, 31)
    get_user_authid(id, authid, 31)
    
    if(!color_check(arg2)&&!strlen(arg3))
    {
        console_print(id, "%L", LANG_PLAYER, "AMX_GLOW_INVALID_COLOR")
        return PLUGIN_HANDLED
    }
    
    new num, bool:valid = false
    for(num = 0; num < 30; num++)
    {
        if(equali(g_sColors[num],arg2))
        {
            valid = true
            break;
        }
    }
    new rnum, gnum, bnum, anum, bool:isOff = false;
    if(valid)
    {
        if(equali(arg2, "off")) isOff = true;
        rnum = g_iColors[num][0]
        gnum = g_iColors[num][1]
        bnum = g_iColors[num][2]
        anum = 255
    }
    else if(!valid && strlen(arg5))
    {
        rnum = str_to_num(arg2)
        gnum = str_to_num(arg3)
        bnum = str_to_num(arg4)
        anum = str_to_num(arg5)
        if(rnum == 0 && gnum == 0 && bnum == 0 && anum == 255) isOff = true;
    }
    else
    {
        console_print(id, "[AMXX] Please include the correct parameters.")
        console_print(id, "Usage: amx_glow(2) <nick, #userid, or authid> <color>")
        console_print(id, "Usage: amx_glow(2) <nick, #userid, or authid> <rrr> <ggg> <bbb> <aaa>")
        return PLUGIN_HANDLED;
    }    
    if(rnum > 255) rnum = 255
    else if(rnum < 0) rnum = 0
    if(gnum > 255) gnum = 255
    else if(gnum < 0) gnum = 0
    if(bnum > 255) bnum = 255
    else if(bnum < 0) bnum = 0
    if(anum > 255) anum = 255
    else if(anum < 0) anum = 0
    
    new pid, activity = get_pcvar_num(amx_show_activity)
    if(arg1[0] == '@')
    {
        new players[32], pnum
        if(equali("T",arg1[1])) copy( arg1[1], 31, "TERRORIST" )
        if(equali("ALL",arg1[1])) get_players( players, pnum, "a" )
        else get_players( players, pnum, "ae", arg1[1] )
        
        if(!pnum) return PLUGIN_HANDLED
        for( new i = 0; i < pnum; i++ )
        {
            pid = players[i]
            HasPermGlow[pid] = isPermGlow
            if(isPermGlow)
            {
                g_glow[pid][0] = rnum
                g_glow[pid][1] = gnum
                g_glow[pid][2] = bnum
                g_glow[pid][3] = anum
            }
            else
            {
                for(new j = 0; j < 4; j++ )
                    g_glow[pid][j] = 0
            }
            fm_set_rendering(pid, kRenderFxGlowShell, rnum, gnum, bnum, kRenderTransAlpha, anum)
        }
        switch(activity)
        {
            case 2: client_print(0, print_chat, "%L", LANG_PLAYER, isOff? "AMX_GLOW_TEAM_OFF_CASE2" : "AMX_GLOW_TEAM_CASE2", name, arg1[1])
            case 1: client_print(0, print_chat, "%L", LANG_PLAYER, isOff? "AMX_GLOW_TEAM_OFF_CASE1" : "AMX_GLOW_TEAM_CASE1", arg1[1])
        }
        console_print(id, "%L", id, "AMX_GLOW_TEAM_MSG", arg1[1])
        log_amx("%L", LANG_SERVER, "AMX_GLOW_TEAM_LOG", name, authid, arg1[1])
        return PLUGIN_HANDLED
    }
    pid = cmd_target(id, arg1, 2)
    if(!pid) return PLUGIN_HANDLED

    new pname[32], pauthid[32]

    get_user_name(pid, pname, 31)
    get_user_authid(pid, pauthid, 31)

    HasPermGlow[pid] = isPermGlow
    if(isPermGlow)
    {
        g_glow[pid][0] = rnum
        g_glow[pid][1] = gnum
        g_glow[pid][2] = bnum
        g_glow[pid][3] = anum
    }
    else
    {
        for( new j = 0; j < 4; j++ )
            g_glow[pid][j] = 0
    }
    fm_set_rendering(pid, kRenderFxGlowShell, rnum, gnum, bnum, kRenderTransAlpha, anum)
    switch(activity)
    {
        case 2: client_print(0, print_chat, "%L", LANG_PLAYER, isOff? "AMX_GLOW_PLAYER_OFF_CASE2" : "AMX_GLOW_PLAYER_CASE2", name, pname)
        case 1: client_print(0, print_chat, "%L", LANG_PLAYER, isOff? "AMX_GLOW_PLAYER_OFF_CASE1" : "AMX_GLOW_PLAYER_CASE1", pname)
    }
    console_print(id, "%L", id, "AMX_GLOW_PLAYER_MSG", pname)
    log_amx("%L", LANG_SERVER, "AMX_GLOW_PLAYER_LOG", name, authid, pname, pauthid)
    return PLUGIN_HANDLED
}

public cmd_glowcolors(id, level, cid)
{
    if(!cmd_access(id, level, cid, 0))
    {
        return PLUGIN_HANDLED
    }
    
    new sColors[192], i
    for(i = 0; i < 30; i += 5)
    {
        if(i == 0) formatex(sColors, 191, "Colors: %s,",g_sColors[0])
        else    formatex(sColors, 191, "%s,", g_sColors[i])
        color_print(id, i + 1, sColors)
    }
    console_print(id, "Example: amx_glow ^"jimmy^" ^"red^"")
    return PLUGIN_HANDLED
}

public color_print(id, num, string[])
{
    for(new max = num + 4; num < max; num++)
        formatex(string, 191, "%s %s,", string, g_sColors[num])
    console_print(id, "%s", string)
}

stock color_check(color[])
{
    new bool:valid = false
    for(new i = 0; i < 30; i++)
    {
        if(equali(g_sColors[i],color))
        {
            valid = true
            break;
        }
    }
    return valid;
}

stock fm_set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16) 
{
    new Float:RenderColor[3]
    RenderColor[0] = float(r)
    RenderColor[1] = float(g)
    RenderColor[2] = float(b)

    set_pev(entity, pev_renderfx, fx)
    set_pev(entity, pev_rendercolor, RenderColor)
    set_pev(entity, pev_rendermode, render)
    set_pev(entity, pev_renderamt, float(amount))

    return 1
}
stelistcristi is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:40.


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