L0ndl3m
03.01.2014, 17:50
Для создания команды потребуются:
DC_CMD (http://pro-pawn.ru/showthread.php?1028)
sscanf (http://forum.sa-mp.com/showthread.php?t=120356)
CMD:color(playerid, params[])
{
if(strlen(params) != 6)
return SendClientMessage(playerid, -1, "Используйте: /color [hex-color из 6 символов]");
new
hex = cellmin;
sscanf(params, "x", hex);
SetPlayerColor(playerid, hex = hex << 8 | 0xFF);
static const
fmt_str[] = "Вы сменили ваш цвет никнейма на: %s";
new
str[sizeof(fmt_str) - 2 + 6];
format(str, sizeof(str), fmt_str, params);
return SendClientMessage(playerid, -1, str);
}
Вторая версия команды на стандартном командном процессоре.
Для создания команды понадобится:
ConvertHexToInt (http://pro-pawn.ru/showthread.php?6348)
if(strcmp(cmdtext, "/color", true, 6) == 0)
{
if(strlen(cmdtext) != 13)
return SendClientMessage(playerid, -1, "Используйте: /color [hex-color из 6 символов]");
static const
fmt_str[] = "Вы сменили ваш цвет никнейма на: %s";
new
str[sizeof(fmt_str) - 2 + 6];
format(str, sizeof(str), fmt_str, cmdtext[7]);
SendClientMessage(playerid, -1, str);
return SetPlayerColor(playerid, ConvertHexToInt(cmdtext[7]) << 8 | 0xFF);
}
Автор: L0ndl3m (http://pro-pawn.ru/member.php?2057-L0ndl3m)
Специально для: Pro-Pawn.Ru (http://pro-pawn.ru)
Копирование данной статьи без разрешения автора запрещено!
DC_CMD (http://pro-pawn.ru/showthread.php?1028)
sscanf (http://forum.sa-mp.com/showthread.php?t=120356)
CMD:color(playerid, params[])
{
if(strlen(params) != 6)
return SendClientMessage(playerid, -1, "Используйте: /color [hex-color из 6 символов]");
new
hex = cellmin;
sscanf(params, "x", hex);
SetPlayerColor(playerid, hex = hex << 8 | 0xFF);
static const
fmt_str[] = "Вы сменили ваш цвет никнейма на: %s";
new
str[sizeof(fmt_str) - 2 + 6];
format(str, sizeof(str), fmt_str, params);
return SendClientMessage(playerid, -1, str);
}
Вторая версия команды на стандартном командном процессоре.
Для создания команды понадобится:
ConvertHexToInt (http://pro-pawn.ru/showthread.php?6348)
if(strcmp(cmdtext, "/color", true, 6) == 0)
{
if(strlen(cmdtext) != 13)
return SendClientMessage(playerid, -1, "Используйте: /color [hex-color из 6 символов]");
static const
fmt_str[] = "Вы сменили ваш цвет никнейма на: %s";
new
str[sizeof(fmt_str) - 2 + 6];
format(str, sizeof(str), fmt_str, cmdtext[7]);
SendClientMessage(playerid, -1, str);
return SetPlayerColor(playerid, ConvertHexToInt(cmdtext[7]) << 8 | 0xFF);
}
Автор: L0ndl3m (http://pro-pawn.ru/member.php?2057-L0ndl3m)
Специально для: Pro-Pawn.Ru (http://pro-pawn.ru)
Копирование данной статьи без разрешения автора запрещено!