Иконка ресурса

[INC] CS:GO Colors 1.6

Yura7181

Участник
Сообщения
678
Реакции
594
Re: [INC] CS:GO Colors (1.3)

Не совсем понятно для новичков.

Может кто нибудь привести пример для nominations.sp? #include <csgo_colors> Я добавил.

/**
* vim: set ts=4 :
* =============================================================================
* SourceMod Rock The Vote Plugin
* Creates a map vote when the required number of players have requested one.
*
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/

#include <sourcemod>
#include <mapchooser>
#include <csgo_colors>

#pragma semicolon 1

public Plugin:myinfo =
{
name = "Map Nominations",
author = "AlliedModders LLC",
description = "Provides Map Nominations",
version = SOURCEMOD_VERSION,
url = "http://www.sourcemod.net/"
};

new Handle:g_Cvar_ExcludeOld = INVALID_HANDLE;
new Handle:g_Cvar_ExcludeCurrent = INVALID_HANDLE;

new Handle:g_MapList = INVALID_HANDLE;
new Handle:g_MapMenu = INVALID_HANDLE;
new g_mapFileSerial = -1;

#define MAPSTATUS_ENABLED (1<<0)
#define MAPSTATUS_DISABLED (1<<1)
#define MAPSTATUS_EXCLUDE_CURRENT (1<<2)
#define MAPSTATUS_EXCLUDE_PREVIOUS (1<<3)
#define MAPSTATUS_EXCLUDE_NOMINATED (1<<4)

new Handle:g_mapTrie;

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

new arraySize = ByteCountToCells(33);
g_MapList = CreateArray(arraySize);

g_Cvar_ExcludeOld = CreateConVar("sm_nominate_excludeold", "1", "Specifies if the current map should be excluded from the Nominations list", 0, true, 0.00, true, 1.0);
g_Cvar_ExcludeCurrent = CreateConVar("sm_nominate_excludecurrent", "1", "Specifies if the MapChooser excluded maps should also be excluded from Nominations", 0, true, 0.00, true, 1.0);

RegConsoleCmd("sm_nominate", Command_Nominate);

RegAdminCmd("sm_nominate_addmap", Command_Addmap, ADMFLAG_CHANGEMAP, "sm_nominate_addmap <mapname> - Forces a map to be on the next mapvote.");

g_mapTrie = CreateTrie();
}

public OnConfigsExecuted()
{
if (ReadMapList(g_MapList,
g_mapFileSerial,
"nominations",
MAPLIST_FLAG_CLEARARRAY|MAPLIST_FLAG_MAPSFOLDER)
== INVALID_HANDLE)
{
if (g_mapFileSerial == -1)
{
SetFailState("Unable to create a valid map list.");
}
}

BuildMapMenu();
}

public OnNominationRemoved(const String:map[], owner)
{
new status;

/* Is the map in our list? */
if (!GetTrieValue(g_mapTrie, map, status))
{
return;
}

/* Was the map disabled due to being nominated */
if ((status & MAPSTATUS_EXCLUDE_NOMINATED) != MAPSTATUS_EXCLUDE_NOMINATED)
{
return;
}

SetTrieValue(g_mapTrie, map, MAPSTATUS_ENABLED);
}

public Action:Command_Addmap(client, args)
{
if (args < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_nominate_addmap <mapname>");
return Plugin_Handled;
}

decl String:mapname[64];
GetCmdArg(1, mapname, sizeof(mapname));


new status;
if (!GetTrieValue(g_mapTrie, mapname, status))
{
ReplyToCommand(client, "%t", "Map was not found", mapname);
return Plugin_Handled;
}

new NominateResult:result = NominateMap(mapname, true, 0);

if (result > Nominate_Replaced)
{
/* We assume already in vote is the casue because the maplist does a Map Validity check and we forced, so it can't be full */
ReplyToCommand(client, "%t", "Map Already In Vote", mapname);

return Plugin_Handled;
}


SetTrieValue(g_mapTrie, mapname, MAPSTATUS_DISABLED|MAPSTATUS_EXCLUDE_NOMINATED);


ReplyToCommand(client, "%t", "Map Inserted", mapname);
LogAction(client, -1, "\"%L\" inserted map \"%s\".", client, mapname);

return Plugin_Handled;
}

public OnClientSayCommand_Post(client, const String:command[], const String:sArgs[])
{
if (!client)
{
return;
}

if (strcmp(sArgs, "nominate", false) == 0)
{
new ReplySource:old = SetCmdReplySource(SM_REPLY_TO_CHAT);

AttemptNominate(client);

SetCmdReplySource(old);
}
}

public Action:Command_Nominate(client, args)
{
if (!client)
{
return Plugin_Handled;
}

if (args == 0)
{
AttemptNominate(client);
return Plugin_Handled;
}

decl String:mapname[64];
GetCmdArg(1, mapname, sizeof(mapname));

new status;
if (!GetTrieValue(g_mapTrie, mapname, status))
{
ReplyToCommand(client, "%t", "Map was not found", mapname);
return Plugin_Handled;
}

if ((status & MAPSTATUS_DISABLED) == MAPSTATUS_DISABLED)
{
if ((status & MAPSTATUS_EXCLUDE_CURRENT) == MAPSTATUS_EXCLUDE_CURRENT)
{
ReplyToCommand(client, "[SM] %t", "Can't Nominate Current Map");
}

if ((status & MAPSTATUS_EXCLUDE_PREVIOUS) == MAPSTATUS_EXCLUDE_PREVIOUS)
{
ReplyToCommand(client, "[SM] %t", "Map in Exclude List");
}

if ((status & MAPSTATUS_EXCLUDE_NOMINATED) == MAPSTATUS_EXCLUDE_NOMINATED)
{
ReplyToCommand(client, "[SM] %t", "Map Already Nominated");
}

return Plugin_Handled;
}

new NominateResult:result = NominateMap(mapname, false, client);

if (result > Nominate_Replaced)
{
if (result == Nominate_AlreadyInVote)
{
ReplyToCommand(client, "%t", "Map Already In Vote", mapname);
}
else
{
ReplyToCommand(client, "[SM] %t", "Map Already Nominated");
}

return Plugin_Handled;
}

/* Map was nominated! - Disable the menu item and update the trie */

SetTrieValue(g_mapTrie, mapname, MAPSTATUS_DISABLED|MAPSTATUS_EXCLUDE_NOMINATED);

decl String:name[64];
GetClientName(client, name, sizeof(name));
PrintToChatAll("[SM] %t", "Map Nominated", name, mapname);

return Plugin_Continue;
}

AttemptNominate(client)
{
SetMenuTitle(g_MapMenu, "%T", "Nominate Title", client);
DisplayMenu(g_MapMenu, client, MENU_TIME_FOREVER);

return;
}

BuildMapMenu()
{
if (g_MapMenu != INVALID_HANDLE)
{
CloseHandle(g_MapMenu);
g_MapMenu = INVALID_HANDLE;
}

ClearTrie(g_mapTrie);

g_MapMenu = CreateMenu(Handler_MapSelectMenu, MENU_ACTIONS_DEFAULT|MenuAction_DrawItem|MenuAction_DisplayItem);

decl String:map[64];

new Handle:excludeMaps = INVALID_HANDLE;
decl String:currentMap[32];

if (GetConVarBool(g_Cvar_ExcludeOld))
{
excludeMaps = CreateArray(ByteCountToCells(33));
GetExcludeMapList(excludeMaps);
}

if (GetConVarBool(g_Cvar_ExcludeCurrent))
{
GetCurrentMap(currentMap, sizeof(currentMap));
}


for (new i = 0; i < GetArraySize(g_MapList); i++)
{
new status = MAPSTATUS_ENABLED;

GetArrayString(g_MapList, i, map, sizeof(map));

if (GetConVarBool(g_Cvar_ExcludeCurrent))
{
if (StrEqual(map, currentMap))
{
status = MAPSTATUS_DISABLED|MAPSTATUS_EXCLUDE_CURRENT;
}
}

/* Dont bother with this check if the current map check passed */
if (GetConVarBool(g_Cvar_ExcludeOld) && status == MAPSTATUS_ENABLED)
{
if (FindStringInArray(excludeMaps, map) != -1)
{
status = MAPSTATUS_DISABLED|MAPSTATUS_EXCLUDE_PREVIOUS;
}
}

AddMenuItem(g_MapMenu, map, map);
SetTrieValue(g_mapTrie, map, status);
}

SetMenuExitButton(g_MapMenu, true);

if (excludeMaps != INVALID_HANDLE)
{
CloseHandle(excludeMaps);
}
}

public Handler_MapSelectMenu(Handle:menu, MenuAction:action, param1, param2)
{
switch (action)
{
case MenuAction_Select:
{
decl String:map[64], String:name[64];
GetMenuItem(menu, param2, map, sizeof(map));

GetClientName(param1, name, 64);

new NominateResult:result = NominateMap(map, false, param1);

/* Don't need to check for InvalidMap because the menu did that already */
if (result == Nominate_AlreadyInVote)
{
PrintToChat(param1, "[SM] %t", "Map Already Nominated");
return 0;
}
else if (result == Nominate_VoteFull)
{
PrintToChat(param1, "[SM] %t", "Max Nominations");
return 0;
}

SetTrieValue(g_mapTrie, map, MAPSTATUS_DISABLED|MAPSTATUS_EXCLUDE_NOMINATED);

if (result == Nominate_Replaced)
{
PrintToChatAll("[SM] %t", "Map Nomination Changed", name, map);
return 0;
}

PrintToChatAll("[SM] %t", "Map Nominated", name, map);
}

case MenuAction_DrawItem:
{
decl String:map[64];
GetMenuItem(menu, param2, map, sizeof(map));

new status;

if (!GetTrieValue(g_mapTrie, map, status))
{
LogError("Menu selection of item not in trie. Major logic problem somewhere.");
return ITEMDRAW_DEFAULT;
}

if ((status & MAPSTATUS_DISABLED) == MAPSTATUS_DISABLED)
{
return ITEMDRAW_DISABLED;
}

return ITEMDRAW_DEFAULT;

}

case MenuAction_DisplayItem:
{
decl String:map[64];
GetMenuItem(menu, param2, map, sizeof(map));

new status;

if (!GetTrieValue(g_mapTrie, map, status))
{
LogError("Menu selection of item not in trie. Major logic problem somewhere.");
return 0;
}

decl String:display[100];

if ((status & MAPSTATUS_DISABLED) == MAPSTATUS_DISABLED)
{
if ((status & MAPSTATUS_EXCLUDE_CURRENT) == MAPSTATUS_EXCLUDE_CURRENT)
{
Format(display, sizeof(display), "%s (%T)", map, "Current Map", param1);
return RedrawMenuItem(display);
}

if ((status & MAPSTATUS_EXCLUDE_PREVIOUS) == MAPSTATUS_EXCLUDE_PREVIOUS)
{
Format(display, sizeof(display), "%s (%T)", map, "Recently Played", param1);
return RedrawMenuItem(display);
}

if ((status & MAPSTATUS_EXCLUDE_NOMINATED) == MAPSTATUS_EXCLUDE_NOMINATED)
{
Format(display, sizeof(display), "%s (%T)", map, "Nominated", param1);
return RedrawMenuItem(display);
}
}

return 0;
}
}

return 0;
}
 

Konstantin

Участник
Сообщения
1,775
Реакции
759
Re: [INC] CS:GO Colors (1.3)

Yura7181,
C-подобный:
#include <sourcemod>
#include <mapchooser>
[COLOR="Red"]#include <csgo_colors>[/COLOR]

#pragma semicolon 1

public Plugin:myinfo =
{
name = "Map Nominations",
author = "AlliedModders LLC",
description = "Provides Map Nominations",
version = SOURCEMOD_VERSION,
url = "http://www.sourcemod.net/"
};

new Handle:g_Cvar_ExcludeOld = INVALID_HANDLE;
new Handle:g_Cvar_ExcludeCurrent = INVALID_HANDLE;

new Handle:g_MapList = INVALID_HANDLE;
new Handle:g_MapMenu = INVALID_HANDLE;
new g_mapFileSerial = -1;

#define MAPSTATUS_ENABLED (1<<0)
#define MAPSTATUS_DISABLED (1<<1)
#define MAPSTATUS_EXCLUDE_CURRENT (1<<2)
#define MAPSTATUS_EXCLUDE_PREVIOUS (1<<3)
#define MAPSTATUS_EXCLUDE_NOMINATED (1<<4)

new Handle:g_mapTrie;

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

new arraySize = ByteCountToCells(33);	
g_MapList = CreateArray(arraySize);

g_Cvar_ExcludeOld = CreateConVar("sm_nominate_excludeold", "1", "Specifies if the current map should be excluded from the Nominations list", 0, true, 0.00, true, 1.0);
g_Cvar_ExcludeCurrent = CreateConVar("sm_nominate_excludecurrent", "1", "Specifies if the MapChooser excluded maps should also be excluded from Nominations", 0, true, 0.00, true, 1.0);

RegConsoleCmd("sm_nominate", Command_Nominate);

RegAdminCmd("sm_nominate_addmap", Command_Addmap, ADMFLAG_CHANGEMAP, "sm_nominate_addmap <mapname> - Forces a map to be on the next mapvote.");

g_mapTrie = CreateTrie();
}

public OnConfigsExecuted()
{
if (ReadMapList(g_MapList,
g_mapFileSerial,
"nominations",
MAPLIST_FLAG_CLEARARRAY|MAPLIST_FLAG_MAPSFOLDER)
== INVALID_HANDLE)
{
if (g_mapFileSerial == -1)
{
SetFailState("Unable to create a valid map list.");
}
}

BuildMapMenu();
}

public OnNominationRemoved(const String:map[], owner)
{
new status;

/* Is the map in our list? */
if (!GetTrieValue(g_mapTrie, map, status))
{
return;	
}

/* Was the map disabled due to being nominated */
if ((status & MAPSTATUS_EXCLUDE_NOMINATED) != MAPSTATUS_EXCLUDE_NOMINATED)
{
return;
}

SetTrieValue(g_mapTrie, map, MAPSTATUS_ENABLED);	
}

public Action:Command_Addmap(client, args)
{
if (args < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_nominate_addmap <mapname>");
return Plugin_Handled;
}

decl String:mapname[64];
GetCmdArg(1, mapname, sizeof(mapname));


new status;
if (!GetTrieValue(g_mapTrie, mapname, status))
{
ReplyToCommand(client, "%t", "Map was not found", mapname);
return Plugin_Handled;	
}

new NominateResult:result = NominateMap(mapname, true, 0);

if (result > Nominate_Replaced)
{
/* We assume already in vote is the casue because the maplist does a Map Validity check and we forced, so it can't be full */
ReplyToCommand(client, "%t", "Map Already In Vote", mapname);

return Plugin_Handled;	
}


SetTrieValue(g_mapTrie, mapname, MAPSTATUS_DISABLED|MAPSTATUS_EXCLUDE_NOMINATED);


ReplyToCommand(client, "%t", "Map Inserted", mapname);
LogAction(client, -1, "\"%L\" inserted map \"%s\".", client, mapname);

return Plugin_Handled;	
}

public OnClientSayCommand_Post(client, const String:command[], const String:sArgs[])
{
if (!client)
{
return;
}

if (strcmp(sArgs, "nominate", false) == 0)
{
new ReplySource:old = SetCmdReplySource(SM_REPLY_TO_CHAT);

AttemptNominate(client);

SetCmdReplySource(old);
}
}

public Action:Command_Nominate(client, args)
{
if (!client)
{
return Plugin_Handled;
}

if (args == 0)
{
AttemptNominate(client);
return Plugin_Handled;
}

decl String:mapname[64];
GetCmdArg(1, mapname, sizeof(mapname));

new status;
if (!GetTrieValue(g_mapTrie, mapname, status))
{
ReplyToCommand(client, "%t", "Map was not found", mapname);
return Plugin_Handled;	
}

if ((status & MAPSTATUS_DISABLED) == MAPSTATUS_DISABLED)
{
if ((status & MAPSTATUS_EXCLUDE_CURRENT) == MAPSTATUS_EXCLUDE_CURRENT)
{
ReplyToCommand(client, "[SM] %t", "Can't Nominate Current Map");
}

if ((status & MAPSTATUS_EXCLUDE_PREVIOUS) == MAPSTATUS_EXCLUDE_PREVIOUS)
{
ReplyToCommand(client, "[SM] %t", "Map in Exclude List");
}

if ((status & MAPSTATUS_EXCLUDE_NOMINATED) == MAPSTATUS_EXCLUDE_NOMINATED)
{
ReplyToCommand(client, "[SM] %t", "Map Already Nominated");
}

return Plugin_Handled;
}

new NominateResult:result = NominateMap(mapname, false, client);

if (result > Nominate_Replaced)
{
if (result == Nominate_AlreadyInVote)
{
ReplyToCommand(client, "%t", "Map Already In Vote", mapname);
}
else
{
ReplyToCommand(client, "[SM] %t", "Map Already Nominated");
}

return Plugin_Handled;	
}

/* Map was nominated! - Disable the menu item and update the trie */

SetTrieValue(g_mapTrie, mapname, MAPSTATUS_DISABLED|MAPSTATUS_EXCLUDE_NOMINATED);

decl String:name[64];
GetClientName(client, name, sizeof(name));
[COLOR="Red"]CGOPrintToChatAll[/COLOR]("[SM] %t", "Map Nominated", name, mapname);

return Plugin_Continue;
}

AttemptNominate(client)
{
SetMenuTitle(g_MapMenu, "%T", "Nominate Title", client);
DisplayMenu(g_MapMenu, client, MENU_TIME_FOREVER);

return;
}

BuildMapMenu()
{
if (g_MapMenu != INVALID_HANDLE)
{
CloseHandle(g_MapMenu);
g_MapMenu = INVALID_HANDLE;
}

ClearTrie(g_mapTrie);

g_MapMenu = CreateMenu(Handler_MapSelectMenu, MENU_ACTIONS_DEFAULT|MenuAction_DrawItem|MenuActio n_DisplayItem);

decl String:map[64];

new Handle:excludeMaps = INVALID_HANDLE;
decl String:currentMap[32];

if (GetConVarBool(g_Cvar_ExcludeOld))
{	
excludeMaps = CreateArray(ByteCountToCells(33));
GetExcludeMapList(excludeMaps);
}

if (GetConVarBool(g_Cvar_ExcludeCurrent))
{
GetCurrentMap(currentMap, sizeof(currentMap));
}


for (new i = 0; i < GetArraySize(g_MapList); i++)
{
new status = MAPSTATUS_ENABLED;

GetArrayString(g_MapList, i, map, sizeof(map));

if (GetConVarBool(g_Cvar_ExcludeCurrent))
{
if (StrEqual(map, currentMap))
{
status = MAPSTATUS_DISABLED|MAPSTATUS_EXCLUDE_CURRENT;
}
}

/* Dont bother with this check if the current map check passed */
if (GetConVarBool(g_Cvar_ExcludeOld) && status == MAPSTATUS_ENABLED)
{
if (FindStringInArray(excludeMaps, map) != -1)
{
status = MAPSTATUS_DISABLED|MAPSTATUS_EXCLUDE_PREVIOUS;
}
}

AddMenuItem(g_MapMenu, map, map);
SetTrieValue(g_mapTrie, map, status);
}

SetMenuExitButton(g_MapMenu, true);

if (excludeMaps != INVALID_HANDLE)
{
CloseHandle(excludeMaps);
}
}

public Handler_MapSelectMenu(Handle:menu, MenuAction:action, param1, param2)
{
switch (action)
{
case MenuAction_Select:
{
decl String:map[64], String:name[64];
GetMenuItem(menu, param2, map, sizeof(map));	

GetClientName(param1, name, 64);

new NominateResult:result = NominateMap(map, false, param1);

/* Don't need to check for InvalidMap because the menu did that already */
if (result == Nominate_AlreadyInVote)
{
[COLOR="Red"]CGOPrintToChat[/COLOR](param1, "[SM] %t", "Map Already Nominated");
return 0;
}
else if (result == Nominate_VoteFull)
{
[COLOR="Red"]CGOPrintToChat[/COLOR](param1, "[SM] %t", "Max Nominations");
return 0;
}

SetTrieValue(g_mapTrie, map, MAPSTATUS_DISABLED|MAPSTATUS_EXCLUDE_NOMINATED);

if (result == Nominate_Replaced)
{
[COLOR="Red"]CGOPrintToChatAll[/COLOR]("[SM] %t", "Map Nomination Changed", name, map);
return 0;	
}

[COLOR="Red"]CGOPrintToChatAll[/COLOR]("[SM] %t", "Map Nominated", name, map);
}

case MenuAction_DrawItem:
{
decl String:map[64];
GetMenuItem(menu, param2, map, sizeof(map));

new status;

if (!GetTrieValue(g_mapTrie, map, status))
{
LogError("Menu selection of item not in trie. Major logic problem somewhere.");
return ITEMDRAW_DEFAULT;
}

if ((status & MAPSTATUS_DISABLED) == MAPSTATUS_DISABLED)
{
return ITEMDRAW_DISABLED;	
}

return ITEMDRAW_DEFAULT;

}

case MenuAction_DisplayItem:
{
decl String:map[64];
GetMenuItem(menu, param2, map, sizeof(map));

new status;

if (!GetTrieValue(g_mapTrie, map, status))
{
LogError("Menu selection of item not in trie. Major logic problem somewhere.");
return 0;
}

decl String:display[100];

if ((status & MAPSTATUS_DISABLED) == MAPSTATUS_DISABLED)
{
if ((status & MAPSTATUS_EXCLUDE_CURRENT) == MAPSTATUS_EXCLUDE_CURRENT)
{
Format(display, sizeof(display), "%s (%T)", map, "Current Map", param1);
return RedrawMenuItem(display);
}

if ((status & MAPSTATUS_EXCLUDE_PREVIOUS) == MAPSTATUS_EXCLUDE_PREVIOUS)
{
Format(display, sizeof(display), "%s (%T)", map, "Recently Played", param1);
return RedrawMenuItem(display);
}

if ((status & MAPSTATUS_EXCLUDE_NOMINATED) == MAPSTATUS_EXCLUDE_NOMINATED)
{
Format(display, sizeof(display), "%s (%T)", map, "Nominated", param1);
return RedrawMenuItem(display);
}
}

return 0;
}
}

return 0;
}
 

BGKoKoOo

Участник
Сообщения
26
Реакции
8
Re: [INC] CS:GO Colors (1.3)

Can you explain me how to add here color
Format(text, sizeof(text), "[ВИП] Вашият ранг е ");
I want VIP tag to have green color

C-подобный:
public EloHandler(Handle:menu, MenuAction:action, client, itemNum)
{
    switch(action)
    {
    case MenuAction_Select:
        {
            new String:info[4];
            GetMenuItem(menu, itemNum, info, sizeof(info));
            iRank[client] = StringToInt(info);
            SetClientCookie(client, g_cookieRank, info);
            new String:text[50];
            [COLOR=Red]Format(text, sizeof(text), "[ВИП] Вашият ранг е ");[/COLOR]
            switch(iRank[client])
            {
            case 0:PrintToChat(client, "%sNo Rank", text);
            case 1:PrintToChat(client, "%sSilver I", text);
            case 2:PrintToChat(client, "%sSilver II", text);
            case 3:PrintToChat(client, "%sSilver III", text);
            case 4:PrintToChat(client, "%sSilver IV", text);
            case 5:PrintToChat(client, "%sSilver Elite", text);
            case 6:PrintToChat(client, "%sSilver Elite Master", text);
            case 7:PrintToChat(client, "%sGold Nova I", text);
            case 8:PrintToChat(client, "%sGold Nova II", text);
            case 9:PrintToChat(client, "%sGold Nova III", text);
            case 10:PrintToChat(client, "%sGold Nova Master", text);
            case 11:PrintToChat(client, "%sMaster Guardian I", text);
            case 12:PrintToChat(client, "%sMaster Guardian II", text);
            case 13:PrintToChat(client, "%sMaster Guardian Elite", text);
            case 14:PrintToChat(client, "%sDistinguished Master Guardian", text);
            case 15:PrintToChat(client, "%sLegendary Eagle", text);
            case 16:PrintToChat(client, "%sLegandary Eagle Master", text);
            case 17:PrintToChat(client, "%sSupreme Master First Class", text);
            case 18:PrintToChat(client, "%sThe Global Elite", text);
            default: PrintToChat(client, "Dunno lol");
            }
        }
    case MenuAction_End:
        {
            CloseHandle(menu);
        }
    }
}
 

mzeke

Участник
Сообщения
51
Реакции
4
Re: [INC] CS:GO Colors (1.3)

4. Как его установить?
Потожить csgo_colors.inc в папку sourcemod/scripting/include
Добавить в код:
Код:
#include <csgo_colors>
Куда добавить этот код?

Добавлено через 1 минуту
заменить PrintToChat на CGOPrintToChat, PrintToChatAll на CGOPrintToChatAll, PrintHintText на CGOPrintHintText, PrintHintTextToAll на CGOPrintHintTextToAll и добавить в текст теги цветов
и где нужно заменять эти строки?
 
Последнее редактирование:

ololoex

Участник
Сообщения
123
Реакции
51
Re: [INC] CS:GO Colors (1.3)

Куда добавить этот код?

Добавлено через 1 минуту

и где нужно заменять эти строки?

PHP:
#include <csgo_colors>
Нужно вставлять в начало кода

Эти строчки надо изменять в коде например
PHP:
PrintToChat
Надо заменить на
PHP:
CGOPrintToChat
 

ololoex

Участник
Сообщения
123
Реакции
51
Re: [INC] CS:GO Colors (1.3)

в каком именно sp? В sp тех плагинов, в которых мне нужны цвета? Например advertisements 0.6.?
Да именно в тех плагинах которые тебе нужны, а если ты хочешь использовать в advertisements то для этого есть хороший плагин специально сделаный под cs go
http://hlmod.ru/forum/plaginy-dlya-...rtisements-v1-1-plagin-tekstovoi-reklamy.html
 

Yura7181

Участник
Сообщения
678
Реакции
594
Re: [INC] CS:GO Colors (1.3)

Теперь возник вопрос:

Как разукрасить сообщения по типу sm_hsay, sm_csay?

Например для плагина showdamage (показывает урон по центру экрана). #include <csgo_colors> я вставил, а вот дальше если добавлять CGO то при компиляции ошибки выходят. С плагинами которые выводят сообщения в чат таких ошибок нет.

#include <sourcemod>
#include <clientprefs>
#include <colors>
#include <csgo_colors>

#define PLUGIN_VERSION "1.0.7"

public Plugin:myinfo =
{
name = "Show Damage",
author = "exvel",
description = "Shows damage in the center of the screen.",
version = PLUGIN_VERSION,
url = "www.sourcemod.net"
}

new player_old_health[MAXPLAYERS + 1];
new player_damage[MAXPLAYERS + 1];
new bool:block_timer[MAXPLAYERS + 1] = {false,...};
new bool:FrameMod = true;
new String:DamageEventName[16];
new MaxDamage = 10000000;
new bool:option_show_damage[MAXPLAYERS + 1] = {true,...};
new Handle:cookie_show_damage = INVALID_HANDLE;

//CVars' handles
new Handle:cvar_show_damage = INVALID_HANDLE;
new Handle:cvar_show_damage_ff = INVALID_HANDLE;
new Handle:cvar_show_damage_own_dmg = INVALID_HANDLE;
new Handle:cvar_show_damage_text_area = INVALID_HANDLE;

//CVars' varibles
new bool:show_damage = true;
new bool:show_damage_ff = false;
new bool:show_damage_own_dmg = false;
new show_damage_text_area = 1;


public OnPluginStart()
{
decl String:gameName[80];
GetGameFolderName(gameName, 80);

if (StrEqual(gameName, "cstrike") || StrEqual(gameName, "insurgency"))
{
HookEvent("player_hurt", Event_PlayerHurt, EventHookMode_Post);
DamageEventName = "dmg_health";
FrameMod = false;
}
else if (StrEqual(gameName, "left4dead") || StrEqual(gameName, "left4dead2"))
{
HookEvent("player_hurt", Event_PlayerHurt, EventHookMode_Post);
HookEvent("infected_hurt", Event_InfectedHurt, EventHookMode_Post);
MaxDamage = 2000;
DamageEventName = "dmg_health";
FrameMod = false;
}
else if (StrEqual(gameName, "dod") || StrEqual(gameName, "hidden"))
{
HookEvent("player_hurt", Event_PlayerHurt, EventHookMode_Post);
DamageEventName = "damage";
FrameMod = false;
}
else
{
HookEvent("player_hurt", Event_PlayerHurt_FrameMod, EventHookMode_Pre);
FrameMod = true;
}

CreateConVar("sm_show_damage_version", PLUGIN_VERSION, "Show Damage Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD);
cvar_show_damage = CreateConVar("sm_show_damage", "1", "Enabled/Disabled show damage functionality, 0 = off/1 = on", FCVAR_PLUGIN, true, 0.0, true, 1.0);
cvar_show_damage_ff = CreateConVar("sm_show_damage_ff", "0", "Show friendly fire damage, 0 = off/1 = on", FCVAR_PLUGIN, true, 0.0, true, 1.0);
cvar_show_damage_own_dmg = CreateConVar("sm_show_damage_own_dmg", "0", "Show your own damage, 0 = off/1 = on", FCVAR_PLUGIN, true, 0.0, true, 1.0);
cvar_show_damage_text_area = CreateConVar("sm_show_damage_text_area", "1", "Defines the area for damage text:\n 1 = in the center of the screen\n 2 = in the hint text area \n 3 = in chat area of screen", FCVAR_PLUGIN, true, 1.0, true, 3.0);

HookEvent("player_spawn", Event_PlayerSpawn, EventHookMode_Post);

HookConVarChange(cvar_show_damage, OnCVarChange);
HookConVarChange(cvar_show_damage_ff, OnCVarChange);
HookConVarChange(cvar_show_damage_own_dmg, OnCVarChange);
HookConVarChange(cvar_show_damage_text_area, OnCVarChange);

AutoExecConfig(true, "plugin.showdamage");
LoadTranslations("common.phrases");
LoadTranslations("showdamage.phrases");

cookie_show_damage = RegClientCookie("Show Damage On/Off", "", CookieAccess_Private);
new info;
SetCookieMenuItem(CookieMenuHandler_ShowDamage, any:info, "Show Damage");
}

public CookieMenuHandler_ShowDamage(client, CookieMenuAction:action, any:info, String:buffer[], maxlen)
{
if (action == CookieMenuAction_DisplayOption)
{
decl String:status[10];
if (option_show_damage[client])
{
Format(status, sizeof(status), "%T", "On", client);
}
else
{
Format(status, sizeof(status), "%T", "Off", client);
}

Format(buffer, maxlen, "%T: %s", "Cookie Show Damage", client, status);
}
// CookieMenuAction_SelectOption
else
{
option_show_damage[client] = !option_show_damage[client];

if (option_show_damage[client])
{
SetClientCookie(client, cookie_show_damage, "On");
}
else
{
SetClientCookie(client, cookie_show_damage, "Off");
}

ShowCookieMenu(client);
}
}

public OnClientCookiesCached(client)
{
option_show_damage[client] = GetCookieShowDamage(client);
}

bool:GetCookieShowDamage(client)
{
decl String:buffer[10];
GetClientCookie(client, cookie_show_damage, buffer, sizeof(buffer));

return !StrEqual(buffer, "Off");
}

public OnConfigsExecuted()
{
GetCVars();
}

public OnClientConnected(client)
{
block_timer[client] = false;
}

public Action:Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
block_timer[client] = false;

return Plugin_Continue;
}

//This is for games that have no damage information in player_hurt event
public OnGameFrame()
{
if (FrameMod && show_damage)
{
for (new client = 1; client <= MaxClients; client++)
{
if (IsClientInGame(client))
{
player_old_health[client] = GetClientHealth(client);
}
}
}
}

public Action:ShowDamage(Handle:timer, any:client)
{
block_timer[client] = false;

if (player_damage[client] <= 0 || !client)
{
return;
}

if (!IsClientInGame(client))
{
return;
}

switch (show_damage_text_area)
{
case 1:
{
PrintCenterText(client, "%t", "CenterText Damage Text", player_damage[client]);
}

case 2:
{
PrintHintText(client, "%t", "HintText Damage Text", player_damage[client]);
}

case 3:
{
CPrintToChat(client, "%t", "Chat Damage Text", player_damage[client]);
}
}

player_damage[client] = 0;
}

public Action:Event_PlayerHurt_FrameMod(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
new client_attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
new damage = player_old_health[client] - GetClientHealth(client);

CalcDamage(client, client_attacker, damage);

return Plugin_Continue;
}

public Action:Event_PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast)
{
new client_attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
new client = GetClientOfUserId(GetEventInt(event, "userid"));
new damage = GetEventInt(event, DamageEventName);

CalcDamage(client, client_attacker, damage);

return Plugin_Continue;
}

public Action:Event_InfectedHurt(Handle:event, const String:name[], bool:dontBroadcast)
{
new client_attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
new damage = GetEventInt(event, "amount");

CalcDamage(0, client_attacker, damage);

return Plugin_Continue;
}



CalcDamage(client, client_attacker, damage)
{
if (!show_damage || !option_show_damage[client_attacker])
{
return;
}

if (client_attacker == 0)
{
return;
}

if (IsFakeClient(client_attacker) || !IsClientInGame(client_attacker))
{
return;
}

//If client == 0 than skip this verifying. It can be an infected or something else without client index.
if (client != 0)
{
if (client == client_attacker)
{
if (!show_damage_own_dmg)
{
return;
}
}
else if (GetClientTeam(client) == GetClientTeam(client_attacker))
{
if (!show_damage_ff)
{
return;
}
}
}

//This is a fix for Left 4 Dead. When tank dies the game fires hurt event with 5000 dmg that is a bug.
if (damage > MaxDamage)
{
return;
}

player_damage[client_attacker] += damage;

if (block_timer[client_attacker])
{
return;
}

CreateTimer(0.01, ShowDamage, client_attacker);
block_timer[client_attacker] = true;
}

public OnCVarChange(Handle:convar_hndl, const String:oldValue[], const String:newValue[])
{
GetCVars();
}

GetCVars()
{
show_damage = GetConVarBool(cvar_show_damage);
show_damage_ff = GetConVarBool(cvar_show_damage_ff);
show_damage_own_dmg = GetConVarBool(cvar_show_damage_own_dmg);
show_damage_text_area = GetConVarInt(cvar_show_damage_text_area);
}
 

Primo

типа серьёзный тип
Сообщения
1,532
Реакции
759
Re: [INC] CS:GO Colors (1.3)

Можно ли пример использования CGOReplaceColorSay?
 

Napas

Участник
Сообщения
832
Реакции
667
Re: [INC] CS:GO Colors (1.3)

PrintCenterText - можно переделать в CGOPrintCenterText ?
 

Павел 01

Участник
Сообщения
81
Реакции
4
Re: [INC] CS:GO Colors (1.3)

Привет народ, а не добавить бы CGOPrintToChatAllEx, CGOReplyToCommandEx, CGOPrintToChatEx, CGOShowActivityEx функцию как в morecolors ?
 
  • Мне нравится
Реакции: All

Hejter

xor ebx, ebx
Сообщения
1,759
Реакции
393
Re: [INC] CS:GO Colors (1.3)

Желтый добавь.
 

Hejter

xor ebx, ebx
Сообщения
1,759
Реакции
393
Re: [INC] CS:GO Colors (1.3)

Добавь CReplaceColorCodes
 

Banana

Участник
Сообщения
892
Реакции
113
Re: [INC] CS:GO Colors (1.1)

image.png


Сегодня удивился как далеко уже пошло развитие плагинов.

Этот плагин умеет писать вот так..?? и как это сделать .. дайте пример!
 

Banana

Участник
Сообщения
892
Реакции
113
Re: [INC] CS:GO Colors (1.3)

А можно как-то научить сам PrintToChat читать {RED} к примеру... чтоб не приходилость юзайть CGOPrintToChat ???
 

R1KO

fuck society
Сообщения
9,457
Реакции
7,786
  • Команда форума
  • #40
Re: [INC] CS:GO Colors (1.3)

Regedit, юзай код цвета
 
Сверху Снизу