Профиль
Информация Управление
Здравствуйте, уважаемый посетитель. К сожалению, Вы не были распознаны форумом, как зарегистрированный пользователь. Для полноценного использования возможностей нашего форума вам необходимо зарегистрироваться. Если вы уже зарегистрированы на форуме, то вам необходимо пройти авторизацию, используя Ваш логин и пароль. Зарегистрированные пользователи получают возможность возможность общения на нашем форуме.


[Новые сообщения · Правила форума · RSS ]
  • Страница 1 из 1
  • 1
[Tutorial] Случайные цвета в чате
OKStyle Дата: Суббота, 05.03.2011, 16:07 | Сообщение # 1
Архивариус
Группа: Администраторы
Зарегистрирован: 19.02.2011
Сообщений: 125
Репутация: 8
Статус: Offline

Code
#define red "{FF002B}"
#define pink "{FF00D9}"
#define purple "{DFA7F2}"
#define blue "{A1C2FF}"
#define green "{3DE3B1}"
#define yellow "{FAF623}"
#define black "{69670C}"
#define orange "{F2C80C}"
#define ice "{03F2FF}"
#define lime "{00FF40}"

Code
// Remember that 10 is the amount of colors that is on the array. You need to change according you add new colors!
static title[][10] =
{
""#red"",
""#pink"",
""#purple"",
""#blue"",
""#green"",
""#yellow"",
""#black"",
""#orange"",
""#ice"",
""#lime""
};
static message[][10] =
{
""#red"",
""#pink"",
""#purple"",
""#blue"",
""#green"",
""#yellow"",
""#black"",
""#orange"",
""#ice"",
""#lime""
};
static id[][10] =
{
""#red"",
""#pink"",
""#purple"",
""#blue"",
""#green"",
""#yellow"",
""#black"",
""#orange"",
""#ice"",
""#lime""
};

Code
public OnPlayerText(playerid, text[])
{
     // Make the changes according you like. I did this on my script as I like
     new rand = random(sizeof(title)); // Random from array 'title'
     new rand2 = random(sizeof(id)); // Random from array 'id'
     new rand3 = random(sizeof(message)); // Random from array 'message'
     static name[MAX_PLAYER_NAME],string[128]; // Defining the 'string' and the 'name'
     GetPlayerName(playerid,name,sizeof(name)); // Here, we get the player name
     format(string,sizeof(string),"%s%s %s(%d): %s%s",title[rand][0],name,id[rand2][0],playerid,message[rand3][0],text); // formating the string which will be sent
     SendClientMessageToAll(color, string); // Here we send the string for all :P
         return 0; // Dont forget that
}

title[rand][0] = Gets a random color from the array 'title'
name = Player name, gotten from the array 'name'
id[rand2][0] = Gets a random color from the array 'id'
playerid = the player ID (Number in this case)
message[rand3][0] = Gets a random color from the array 'message'
text = The text which the player has typed

Автор: blackwave

Прикрепления: 7365453.png (66.0 Kb)


 
SEVI4 Дата: Суббота, 05.03.2011, 23:58 | Сообщение # 2
Рядовой
Группа: Проверенные
Зарегистрирован: 24.02.2011
Сообщений: 11
Репутация: 0
Статус: Offline
если я это увижу на сервере я сойду с ума от этой гирлянды =______=

Come back ? yeah
 
  • Страница 1 из 1
  • 1
Поиск:

Сайт управляется системой uCoz