Alte informatii: SMA mai jos
Code: Select all
#include <amxmodx>
static const forumurl[] = "http://ilegalzone.com/forum/"
#if defined _colorchat_included
#endinput
#endif
#define _colorchat_included
enum Color
{
NORMAL = 1, // clients scr_concolor cvar color
GREEN, // Green Color
TEAM_COLOR, // Red, grey, blue
GREY, // grey
RED, // Red
BLUE, // Blue
}
new const TeamName[][] =
{
"",
"TERRORIST",
"CT",
"SPECTATOR"
}
public plugin_init()
{
register_plugin("New Welcome Message ", "0.1", "RnL/edit xdNTz");
register_cvar("new_welcome","1")
register_cvar("amx_forum",forumurl);
}
public client_putinserver(id)
{
set_task(5.0, "new_welcome", id)
}
public new_welcome(id)
{
if (get_cvar_num("new_welcome"))
{
new name[32]
get_user_name(id,name,31)
set_hudmessage(0, 255, 0, -1.0, -1.0)
show_hudmessage(id, " Salut %s^n Bun venit in carciuma noastra^n Distreaza-te!",name);
ColorChat(id, GREEN,"Bun Venit %s^x03! Iti vom servii ceva de baut ^x03!",name);
if(is_user_connecting(id))
set_hudmessage(0, 255, 0, -1.0, -1.0)
show_hudmessage(id, "Atentie! Betivul %s a intrat in carciuma!!!")
}
}
ColorChat(id, Color:type, const msg[], any:...)
{
new message[256];
switch(type)
{
case NORMAL: // clients scr_concolor cvar color
{
message[0] = 0x01;
}
case GREEN: // Green
{
message[0] = 0x04;
}
default: // White, Red, Blue
{
message[0] = 0x03;
}
}
vformat(message[1], 251, msg, 4);
// Make sure message is not longer than 192 character. Will crash the server.
message[192] = '^0';
new team, ColorChange, index, MSG_Type;
if(id)
{
MSG_Type = MSG_ONE_UNRELIABLE;
index = id;
} else {
index = FindPlayer();
MSG_Type = MSG_BROADCAST;
}
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[])
{
static msgSayText;
if(!msgSayText)
{
msgSayText = get_user_msgid("SayText");
}
message_begin(type, msgSayText, _, id);
write_byte(id)
write_string(message);
message_end();
}
Team_Info(id, type, team[])
{
static msgTeamInfo;
if(!msgTeamInfo)
{
msgTeamInfo = get_user_msgid("TeamInfo");
}
message_begin(type, msgTeamInfo, _, 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;
}
FindPlayer()
{
new i = -1;
while(i <= get_maxplayers())
{
if(is_user_connected(++i))
return i;
}
return -1;
}