AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [INC] Colors (1.0.5) (https://forums.alliedmods.net/showthread.php?t=96831)

Seta00 08-16-2010 17:01

Re: [INC] Colors (1.0.4)
 
Quote:

Originally Posted by exvel (Post 1272808)
This doesn't work for me in CS:S. :oops:

Strange, works perfectly for me... (In CS:S)

exvel 08-17-2010 04:38

Re: [INC] Colors (1.0.4)
 
Could you post a screenshot please? Just want to see how it looks like.

Seta00 08-17-2010 07:28

Re: [INC] Colors (1.0.4)
 
Code:
#include <sourcemod> #include <colors> public Plugin:myinfo = {     name = "Test Plugin",     author = "Seta00",     description = "",     version = "1.0",     url = "" } public OnPluginStart() {     RegAdminCmd("sm_test", TestCmd, ADMFLAG_KICK); } public Action:TestCmd(client, args) {     CReplyToCommand(client, "{green}Pretty {lightgreen}reply!");     return Plugin_Handled; }

:arrow:

[IMG]http://img248.**************/img248/9193/dedust20003ze.jpg[/IMG]

exvel 08-17-2010 09:35

Re: [INC] Colors (1.0.4)
 
oops, I thought you've created it for console colors :mrgreen: misunderstanding

xRaven 09-05-2010 21:34

Re: [INC] Colors (1.0.4)
 
Hey,

So i am working with Antithasys' Simple Chat Colors and for some reason the olive isn't working right. His download uses 1.0.2 of colors.inc so i went ahead and downloaded the new version that is apparently fixes it, however It hasn't changed anything for some reason.

I know my way around sourcemod code but can't find any reason why. I've read this thread over many times today and can't find any solution found.

Any thoughts/suggestions is appreciated.

Thanks.

exvel 09-06-2010 01:56

Re: [INC] Colors (1.0.4)
 
You need to recompile the plugin.

Xp3r7 09-06-2010 03:29

Re: [INC] Colors (1.0.4)
 
Quote:

Originally Posted by xRaven (Post 1292604)
Hey,

So i am working with Antithasys' Simple Chat Colors and for some reason the olive isn't working right. His download uses 1.0.2 of colors.inc so i went ahead and downloaded the new version that is apparently fixes it, however It hasn't changed anything for some reason.

I know my way around sourcemod code but can't find any reason why. I've read this thread over many times today and can't find any solution found.

Any thoughts/suggestions is appreciated.

Thanks.

http://forums.alliedmods.net/showpos...&postcount=276

I already recompiled it and had it posted in the thread. :)

xRaven 09-06-2010 15:30

Re: [INC] Colors (1.0.4)
 
Thanks, guess next time I should read over that thread as well instead of just this one.

u is a snika 09-14-2010 19:47

Re: [INC] Colors (1.0.4)
 
I'm having some trouble setting this up in my server, right now I have admin smite set up so whenever I smite someone some text pops up in chat, I want it colored green but I cant figure out exactly how to set it up, could use some help.

Heres the text from the translation file

Code:

"Phrases"
{
    "Smite player"
    {
        "en"            "Smite player"
    }
   
    "Smote target"
    {
        "#format"        "{1:t}"
        "en"            "Dear {1}, so now that I have your attention, you should know that I am the boss and you will do as I say. Love, Snika."
    }
}

And heres the script

Code:

#pragma semicolon 1

#include <sourcemod>
#include <sdktools>
#include <colors>
#undef REQUIRE_PLUGIN
#include <adminmenu>


#define PLUGIN_VERSION "2.1"
#define SOUND_THUNDER "ambient/explosions/explode_9.wav"

public Plugin:myinfo =
{
    name = "Admin Smite",
    author = "Hipster",
    description = "Slay players with a lightning bolt effect",
    version = PLUGIN_VERSION,
    url = "http://forums.alliedmods.net/showthread.php?t=118534"
};

new Handle:hTopMenu = INVALID_HANDLE;

new g_SmokeSprite;
new g_LightningSprite;

public OnPluginStart()
{
    LoadTranslations("common.phrases");
    LoadTranslations("adminsmite.phrases");   

    CreateConVar("sm_adminsmite_version", PLUGIN_VERSION, "Admin Smite Version",

FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
    RegAdminCmd("sm_smite", Command_Smite, ADMFLAG_SLAY, "sm_smite <#userid|name> - Slay with a lightning bolt effect.");

    /* Account for late loading */
    new Handle:topmenu;
    if (LibraryExists("adminmenu") && ((topmenu = GetAdminTopMenu()) != INVALID_HANDLE))
    {
        OnAdminMenuReady(topmenu);
    }
}

public OnMapStart()
{
    PrecacheSound(SOUND_THUNDER, true);
    g_SmokeSprite = PrecacheModel("sprites/steam1.vmt");
    g_LightningSprite = PrecacheModel("sprites/lgtning.vmt");
}

PerformSmite(client, target)
{
    LogAction(client, target, "\"%L\" smote \"%L\"", client, target);
   
    // define where the lightning strike ends
    new Float:clientpos[3];
    GetClientAbsOrigin(target, clientpos);
    clientpos[2] -= 26; // increase y-axis by 26 to strike at player's chest instead of the ground
   
    // get random numbers for the x and y starting positions
    new randomx = GetRandomInt(-500, 500);
    new randomy = GetRandomInt(-500, 500);
   
    // define where the lightning strike starts
    new Float:startpos[3];
    startpos[0] = clientpos[0] + randomx;
    startpos[1] = clientpos[1] + randomy;
    startpos[2] = clientpos[2] + 800;
   
    // define the color of the strike
    new color[4] = {255, 255, 255, 255};
   
    // define the direction of the sparks
    new Float:dir[3] = {0.0, 0.0, 0.0};
   
    TE_SetupBeamPoints(startpos, clientpos, g_LightningSprite, 0, 0, 0, 0.2, 20.0, 10.0, 0, 1.0, color, 3);
    TE_SendToAll();
   
    TE_SetupSparks(clientpos, dir, 5000, 1000);
    TE_SendToAll();
   
    TE_SetupEnergySplash(clientpos, dir, false);
    TE_SendToAll();
   
    TE_SetupSmoke(clientpos, g_SmokeSprite, 5.0, 10);
    TE_SendToAll();
   
    EmitAmbientSound(SOUND_THUNDER, startpos, client, SNDLEVEL_RAIDSIREN);
   
    ForcePlayerSuicide(target);
}

public Action:Command_Smite(client, args)
{
    if (args < 1)
    {
        ReplyToCommand(client, "{green}[SM] Usage: sm_smite <#userid|name>");
        return Plugin_Handled;
    }

    decl String:arg[65];
    GetCmdArg(1, arg, sizeof(arg));

    decl String:target_name[MAX_TARGET_LENGTH];
    decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
   
    if ((target_count = ProcessTargetString(
            arg,
            client,
            target_list,
            MAXPLAYERS,
            COMMAND_FILTER_ALIVE,
            target_name,
            sizeof(target_name),
            tn_is_ml)) <= 0)
    {
        ReplyToTargetError(client, target_count);
        return Plugin_Handled;
    }

    for (new i = 0; i < target_count; i++)
    {
        new target = target_list[i];
        PerformSmite(client, target);
    }
   
    if (tn_is_ml)
    {
        ShowActivity2(client, "[SM] ", "%t", "Smote target", target_name);
    }
    else
    {
        ShowActivity2(client, "[SM] ", "%t", "Smote target", "_s", target_name);
    }

    return Plugin_Handled;
}

DisplaySmiteMenu(client)
{
    new Handle:menu = CreateMenu(MenuHandler_Smite);
   
    decl String:title[100];
    Format(title, sizeof(title), "%T:", "Smite player", client);
    SetMenuTitle(menu, title);
    SetMenuExitBackButton(menu, true);
   
    AddTargetsToMenu(menu, client, true, true);
   
    DisplayMenu(menu, client, MENU_TIME_FOREVER);
}

public AdminMenu_Smite(Handle:topmenu,
                      TopMenuAction:action,
                      TopMenuObject:object_id,
                      param,
                      String:buffer[],
                      maxlength)
{
    if (action == TopMenuAction_DisplayOption)
    {
        Format(buffer, maxlength, "%T", "Smite player", param);
    }
    else if (action == TopMenuAction_SelectOption)
    {
        DisplaySmiteMenu(param);
    }
}

public MenuHandler_Smite(Handle:menu, MenuAction:action, param1, param2)
{
    if (action == MenuAction_End)
    {
        CloseHandle(menu);
    }
    else if (action == MenuAction_Cancel)
    {
        if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
        {
            DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
        }
    }
    else if (action == MenuAction_Select)
    {
        decl String:info[32];
        new userid, target;
       
        GetMenuItem(menu, param2, info, sizeof(info));
        userid = StringToInt(info);

        if ((target = GetClientOfUserId(userid)) == 0)
        {
            PrintToChat(param1, "[SM] %t", "Player no longer available");
        }
        else if (!CanUserTarget(param1, target))
        {
            PrintToChat(param1, "[SM] %t", "Unable to target");
        }
        else if (!IsPlayerAlive(target))
        {
            ReplyToCommand(param1, "[SM] %t", "Player has since died");
        }
        else
        {
            decl String:name[32];
            GetClientName(target, name, sizeof(name));
            PerformSmite(param1, target);
            ShowActivity2(param1, "[SM] ", "%t", "Smote target", "_s", name);
        }
       
        DisplaySmiteMenu(param1);
    }
}

public OnAdminMenuReady(Handle:topmenu)
{
    /* Block us from being called twice */
    if (topmenu == hTopMenu)
    {
        return;
    }
   
    /* Save the Handle */
    hTopMenu = topmenu;
   
    /* Find the "Player Commands" category */
    new TopMenuObject:player_commands = FindTopMenuCategory(hTopMenu, ADMINMENU_PLAYERCOMMANDS);

    if (player_commands != INVALID_TOPMENUOBJECT)
    {
        AddToTopMenu(hTopMenu,
            "sm_smite",
            TopMenuObject_Item,
            AdminMenu_Smite,
            player_commands,
            "sm_smite",
            ADMFLAG_SLAY);
    }
}

I've screwed around with it and read a number of posts on here as well, just not getting it for this situation.

Thanks.

thetwistedpanda 09-14-2010 22:53

Re: [INC] Colors (1.0.4)
 
You need to use "CPrintToChat" and then you can use colors like {green}, {olive}, {default}, etc.


All times are GMT -4. The time now is 22:58.

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