User
Pass
2FA
 
 

cfg_rangchat

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Freakz Forum Index -> Trash Bin -> CS 2006-2019 (Archived) -> Resources
Author Message2509
punk3n3my666

[Mentally Stable]



Status: Offline
(since 30-12-2010 11:17)
Joined: 16 Jul 2009
Posts: 27, Topics: 7
Location: Romania

Reputation: 150.6
Votes: 4

Post Posted: 09-08-2009, 14:59:23 | Translate post to: ... (Click for more languages)

Ma poate ajuta cineva sa modific sma'ul?Vreau sa pun 3 grupuri "Owner,Administrator si Moderator" iar culorile rang'urilor rosu,alb si verde in ordinea in care le'am zis si punctele de acces.Am incercat eu sa'l modific dar la compilare imi dadea cateva erori.

Asa arata sma'ul nemodificat:

/* CFG RangChat made by aNNakin
CFG Community
Visit http://www.cfg.ro
*/

#include < amxmodx >
#include < amxmisc >

#define PLUGIN "CFG RangChat"
#define VERSION "1.0"
#define AUTHOR "aNNakin"

#define GROUPS 5

enum Color
{
NORMAL = 1,
GREEN,
TEAM_COLOR,
GREY,
RED,
BLUE,
}

new TeamName[ ][ ] =
{
"",
"TERRORIST",
"CT",
"SPECTATOR"
}

// - - - - - - - - - - -

#define GROUPS 5

new const g_Flags[ GROUPS ][ ] =
{
"abcdefghijklmnopqrstu",
"abcdefgijlmnopqru",
"abcdefgijlmnop",
"bcdefgijmno",
"bcefgijm"
};

new const g_Groups[ GROUPS ][ ] =
{
"God",
"Moderator +",
"Moderator",
"Administrator",
"Helper"
};

// - - - - - - - - - - -

new g_FlagsValue[ GROUPS ];

new bool:g_IsConnected[ 33 ];
new SayText, TeamInfo, g_maxplayers;

public plugin_init ( )
{
register_plugin ( PLUGIN, VERSION, AUTHOR );

register_clcmd ( "say", "hook_say" );

for ( new i; i < GROUPS; i++ )
g_FlagsValue[ i ] = read_flags ( g_Flags[ i ] );

SayText = get_user_msgid ( "SayText" );
TeamInfo = get_user_msgid ( "TeamInfo" );
g_maxplayers = get_maxplayers ( );
}

public client_putinserver ( e_Index ) g_IsConnected[ e_Index ] = true;
public client_disconnect ( e_Index ) g_IsConnected[ e_Index ] = false;

public hook_say ( e_Index )
{
static s_Said[ 192 ];
read_args ( s_Said, charsmax ( s_Said ) );

if ( equal ( s_Said, "" ) )
return PLUGIN_CONTINUE;
remove_quotes ( s_Said );

static s_Name[ 32 ], i;
get_user_name ( e_Index, s_Name, 31 );

for ( i = 0; i < GROUPS; i++ )
if ( get_user_flags ( e_Index ) == g_FlagsValue[ i ] )
{
ColorChat ( 0, TEAM_COLOR, "^x03%s^x01 (^x04%s^x01): %s", s_Name, g_Groups[ i ], s_Said );
break;
}

return ( i < GROUPS ) ? PLUGIN_HANDLED : PLUGIN_CONTINUE;
}

public ColorChat ( id, Color:type, const msg[], { Float, Sql, Result, _ }:... )
{
static message[ 256 ];

switch ( type )
{
case NORMAL:
message[ 0 ] = 0x01;
case GREEN:
message[ 0 ] = 0x04;
default:
message[ 0 ] = 0x03;
}

vformat ( message[ 1 ], 251, msg, 4 );
message[ 192 ] = '^0';

new team, ColorChange, index, MSG_Type;

if ( id )
{
MSG_Type = MSG_ONE;
index = id;
}
else
{
index = FindPlayer ( );
MSG_Type = MSG_ALL;
}

team = get_user_team ( index );
ColorChange = ColorSelection ( index, MSG_Type, type );

ShowColorMessage ( index, MSG_Type, message );

if ( ColorChange )
Team_Info ( index, MSG_Type, TeamName[ team ] );
}

ShowColorMessage ( id, type, message[] )
{
message_begin ( type, SayText, _, id );
write_byte ( id )
write_string ( message );
message_end ( );
}

Team_Info ( id, type, team[] )
{
message_begin ( type, TeamInfo, _, id );
write_byte ( id );
write_string ( team );
message_end ( );

return 1;
}

ColorSelection ( index, type, Color:Type )
{
switch ( Type )
{
case RED:
return Team_Info ( index, type, TeamName[ 1 ] );
case BLUE:
return Team_Info ( index, type, TeamName[ 2 ] );
case GREY:
return Team_Info ( index, type, TeamName[ 0 ] );
}
return 0;
}

public FindPlayer ( )
{
for ( new i = 1; i <= g_maxplayers; i++ )
if ( g_IsConnected[ i ] )
return i;

return -1;
}

0 0
  
Back to top
View user's profile Send private message
Tyger

[Born Wild]



Status: Offline
(since 17-05-2014 22:04)
Joined: 15 Jun 2009
Posts: 440, Topics: 30
Location: Romania

Reputation: 300.4
Votes: 10

Post Posted: 09-08-2009, 16:00:21 | Translate post to: ... (Click for more languages)

/***************************************************************************************

Colored Admin Chat - (c) 2007 by mu_mee_boss
Made by Exolent http://starmedia.myforum.ro

Where the idea came from: http://www.starmedia.myforum.ro

Description:
This plugin allows admin with the specified admin level to have colored text
as all the text in their messagemode and messagemode2 chat messages. Also.
"/command" messages and "@", "@@", and "@@@" messages will not be shown but
they still will work.

Cvars:
amx_adminlisten_voice <0|1> (default: 1)
amx_adminlisten_voice <0|1> (default: 1)

*NOTE* This was ONLY tested in CS 1.6. Use in other mods at own risk.



***************************************************************************************


Changelog:

Version 1.0
- Initial release


Version 1.1
- Added admin level for green chat
- Merged 4 format() functions into one


Version 2.0
- Simple code cleanup
- Merged AdminListen with fakemeta and not engine
--- AdminListen Link: http://starmedia.myforum.ro


Version 3.0
- Multiplied color possibilites
- Rearranged messages
- Fixed a few bugs
- Renamed plugin


**************************************************************************************/


// COLOR CHAT LEVELS
// --------------------------------------------------------------------------------------
#define ADMIN_RED ADMIN_IMMUNITY // level for red chat
#define ADMIN_GREEN ADMIN_LEVEL_D // level for green chat
#define ADMIN_BLUE ADMIN_LEVEL_E // level for blue chat
#define ADMIN_SILVER ADMIN_LEVEL_F // level for silver chat
#define ADMIN_YELLOW ADMIN_USER // level for normal chat with green name only
// --------------------------------------------------------------------------------------

// ADMIN LISTEN LEVELS
// --------------------------------------------------------------------------------------
#define LISTEN_CHAT ADMIN_KICK // level to see all chat (adminlisten style)
#define LISTEN_VOICE ADMIN_IMMUNITY // level to hear all voices (adminlisten style)
// --------------------------------------------------------------------------------------


// DO NOT EDIT BEYOND THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING
// --------------------------------------------------------------------------------------

#include <amxmodx>
#include <fakemeta>

#define SPEAK_NORMAL 0
#define SPEAK_MUTED 1
#define SPEAK_ALL 2
#define SPEAK_LISTENALL 4

new pCvar_voice;
new pCvar_chat;
new pCvar_alltalk;
new gMaxPlayers;
new gMsgSayText;
new gMsgTeamInfo;
new gSpeakFlags[33];
new const gTeams[][] =
{
"Spectator",
"Terrorist",
"Counter-Terrorist",
"Spectator"
};
new const gColorLevels[] =
{
ADMIN_ALL,
ADMIN_GREEN,
ADMIN_RED,
ADMIN_BLUE,
ADMIN_SILVER,
ADMIN_YELLOW
};
new const gColorCode[][] =
{
"",
"^x04",
"^x03",
"^x03",
"^x03",
"^x01"
};
new const gColorTeam[][] =
{
"",
"",
"TERRORIST",
"CT",
"SPECTATOR",
""
};

public plugin_init()
{
register_plugin("Colored Admin Chat", "3.0", "Exolent");
register_clcmd("say", "handle_say");
register_clcmd("say_team", "handle_teamsay");
register_forward(FM_Voice_SetClientListening, "fm_SetVoice");
pCvar_voice = register_cvar("amx_adminlisten_voice", "1");
pCvar_chat = register_cvar("amx_adminlisten_chat", "1");
pCvar_alltalk = get_cvar_pointer("sv_alltalk");
gMaxPlayers = get_maxplayers();
gMsgSayText = get_user_msgid("SayText");
gMsgTeamInfo = get_user_msgid("TeamInfo");
}

public client_connect(id)
{
reset_speak(id);
}

public client_infochanged(id)
{
reset_speak(id);
}

public handle_say(id)
{
static message[192];
read_args(message, 191);
remove_quotes(message);
if(!valid_message(message))
{
return PLUGIN_CONTINUE;
}
static name[32], team[32], team2[32], alive, bool:admin, chatColor;
get_user_name(id, name, 31);
get_user_team(id, team, 31);
alive = is_user_alive(id);
admin = has_color_chat(id);
chatColor = get_color_chat(id);
format(message, 191, "%s%s%s ^x01: %s %s", alive ? "" : "^x01*DEAD*", admin ? "^x04" : "^x03", name, admin ? gColorCode[chatColor] : "", message);
for(new i = 1; i <= gMaxPlayers; i++)
{
if(!is_user_connected(i))
continue;

if(alive && is_user_alive(i)
|| !alive && !is_user_alive(i)
|| (get_user_flags(i) & LISTEN_CHAT) && (get_pcvar_num(pCvar_chat) == 1))
{
get_user_team(i, team2, 31);
handle_message(i, team, team2, chatColor, message);
}
}
return PLUGIN_HANDLED;
}

public handle_teamsay(id)
{
new message[192];
read_args(message, 191);
remove_quotes(message);
if(!valid_message(message))
{
return PLUGIN_CONTINUE;
}
static name[32], team[32], team2[32], alive, bool:admin, chatColor, teamnum, listen;
get_user_name(id, name, 31);
get_user_team(id, team, 31);
alive = is_user_alive(id);
admin = has_color_chat(id);
chatColor = get_color_chat(id);
teamnum = get_user_team(id);
format(message, 191, "^x01%s(%s)%s %s^x01 : %s %s", alive ? "" : "*DEAD*", gTeams[teamnum], admin ? "^x04" : "^x03", name, admin ? gColorCode[chatColor] : "", message);
for(new i = 1; i <= gMaxPlayers; i++)
{
if(!is_user_connected(i))
continue;

listen = (get_user_flags(i) & LISTEN_CHAT);
get_user_team(i, team2, 31);
if(!equali(team, team2) && !listen)
continue;

if(alive && is_user_alive(i)
|| !alive && !is_user_alive(i)
|| listen && (get_pcvar_num(pCvar_chat) == 1))
{
handle_message(i, team, team2, chatColor, message);
}
}
return PLUGIN_HANDLED;
}

public fm_SetVoice(receiver, sender, bool:listen)
{
if((gSpeakFlags[sender] & SPEAK_MUTED) != 0)
{
set_speak(receiver, sender, false);
return FMRES_SUPERCEDE;
}
if((gSpeakFlags[sender] & SPEAK_ALL) != 0)
{
set_speak(receiver, sender, true);
return FMRES_SUPERCEDE;
}
if((gSpeakFlags[receiver] & SPEAK_LISTENALL) != 0)
{
set_speak(receiver, sender, true);
return FMRES_SUPERCEDE;
}
forward_return(FMV_CELL, listen);
return FMRES_IGNORED;
}

bool:valid_message(const message[])
{
if(message[0] == '/'
|| message[0] == '@'
|| message[0] == '@' && message[1] == '@'
|| message[0] == '@' && message[1] == '@' && message[2] == '@'
|| !strlen(message))
{
return false;
}
return true;
}

bool:has_color_chat(id)
{
for(new i = 1; i < sizeof gColorLevels; i++)
{
if(get_user_flags(id) & gColorLevels[i])
return true;
}
return false;
}

get_color_chat(id)
{
for(new i = 1; i < sizeof gColorLevels; i++)
{
if(get_user_flags(id) & gColorLevels[i])
return i;
}
return 0;
}

handle_message(id, const team[], const team2[], chatColor, const message[])
{
if(equali(gColorCode[chatColor], "^x03") && !equali(gColorTeam[chatColor], team2))
{
show_TeamInfo_msg(id, gColorTeam[chatColor]);
show_SayText_msg(id, message);
show_TeamInfo_msg(id, team2);
}
else if(!equali(team, team2) && chatColor == 0)
{
show_TeamInfo_msg(id, team);
show_SayText_msg(id, message);
show_TeamInfo_msg(id, team2);
}
else
{
show_SayText_msg(id, message);
}
}

show_TeamInfo_msg(id, const teamname[])
{
message_begin(MSG_ONE, gMsgTeamInfo, _, id);
write_byte(id);
write_string(teamname);
message_end();
}

show_SayText_msg(id, const message[])
{
message_begin(MSG_ONE, gMsgSayText, _, id);
write_byte(id);
write_string(message);
message_end();
}

reset_speak(id)
{
if((get_user_flags(id) & LISTEN_VOICE) && get_pcvar_num(pCvar_voice) == 1)
{
gSpeakFlags[id] = SPEAK_LISTENALL;
}
else if(get_pcvar_num(pCvar_alltalk) == 1)
{
gSpeakFlags[id] = SPEAK_ALL;
}
else
{
gSpeakFlags[id] = SPEAK_NORMAL;
}
}

set_speak(receiver, sender, bool:speak)
{
engfunc(EngFunc_SetClientListening, receiver, sender, speak);
forward_return(FMV_CELL, speak);
}


Scriptul e luat direct de la serv meu iar io am 4 clase de admini si fiecare clasa scrie in chat cu o anumita culoare, de ex: ownerii cu rosu, moderatorii cu verde, administratorii cu albastru si sloterii cu argintiu. O sa-ti pun si accesele ca sa iti dai seama cum functioneaza:

owner: "abcdefghijklmnostu"
moderator: "bcdefghijmnopstu"
administrator: "bcdefgijmq"
sloter: "bir"

Privind scriptul si accesele si facand niste calcule iti dai seama cum trebuie sa-l modifici pe gustul tau.


Edited: Fara reclama in semnatura
0 0
  
Back to top
View user's profile Send private message
punk3n3my666

[Mentally Stable]



Status: Offline
(since 30-12-2010 11:17)
Joined: 16 Jul 2009
Posts: 27, Topics: 7
Location: Romania

Reputation: 150.6
Votes: 4

Post Posted: 09-08-2009, 18:12:44 | Translate post to: ... (Click for more languages)

m'am uitat peste el dar nu stiu unde trebuie sa modific,nu ma pricep la asta...nu ai putea sa'mi zici cum pot sa modific sma'ul pus de mn?eu am schimbat punctele de acces si numele rangurilor dar imi da cateva erori la compilare - iar cu culorile la fel...
0 0
  
Back to top
View user's profile Send private message
TiZo^

[Mentally Stable]



Status: Offline
(since 19-09-2009 19:10)
Joined: 10 Sep 2009
Posts: 19, Topics: 1
Location: Romania

Reputation: 53
Votes: 7

Post Posted: 12-09-2009, 12:36:28 | Translate post to: ... (Click for more languages)

cam lung greu!!!

//ion.mzk: alt post inutil, +1 warn


Nobody Is Perfect.....I'M Nobody!!!
0 0
  
Back to top
View user's profile Send private message
anakin_cstrike

[Mentally Stable]



Status: Offline
(since 08-02-2012 07:25)
Joined: 08 Apr 2008
Posts: 17, Topics: None
Location: Romania

Reputation: 166.1
Votes: 4

Post Posted: 12-09-2009, 23:53:18 | Translate post to: ... (Click for more languages)

Ce anume vrei sa fie colorat? numele, rangul sau mesajul?
0 0
  
Back to top
View user's profile Send private message
Tyger

[Born Wild]



Status: Offline
(since 17-05-2014 22:04)
Joined: 15 Jun 2009
Posts: 440, Topics: 30
Location: Romania

Reputation: 300.4
Votes: 10

Post Posted: 13-09-2009, 00:11:55 | Translate post to: ... (Click for more languages)

s-a rezolvat aia anakin e vb de culoarea care scrie in chat

Edited: Fara reclama in semnatura
0 0
  
Back to top
View user's profile Send private message
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Freakz Forum Index -> Trash Bin -> CS 2006-2019 (Archived) -> Resources  


The time now is 02-05-2024, 08:08:36
Copyright info

Based on phpBB ro/com
B

 
 
 







I forgot my password


This message appears only once, so
like us now until it's too late ! :D
x