15.09.2013, 15:21
(
Последний раз редактировалось horsemeat; 15.09.2013 в 16:55.
Причина: adding cases
)
Hello I am trying to make a command the shows rainbow text but the text is not showing here is my code
pawn Код:
CMD:announce(playerid,params[])
{
if(IsPlayerAdminLevel(playerid, 1))
{
new input[256];
new string[256];
if (sscanf(params, "s["#256"]",input))
{
return SendClientMessage(playerid, RED, "SYNTAX /announce [text]");
}
new name[MAX_PLAYER_NAME+1];
GetPlayerName(playerid,name,sizeof(name));
new inputformat[256];
new colorcount;
new color[7];
for(new c;c < sizeof(input);c++)
{
format(color,sizeof(color),"%s",GetColor(colorcount));
if(input[c] == ' ')
{
new addstr[256];
format(addstr,sizeof(addstr),"%s%c",inputformat,input[c]);
}
else
{
new addstr[256];
format(addstr,sizeof(addstr),"%s{%s}%c",inputformat,color,input[c]);
format(inputformat,sizeof(inputformat),"%s",addstr);
colorcount ++;
if((colorcount) > 9)
{
colorcount = 0;
}
}
}
format(string,256,"[ADMIN:%s] %s",name,inputformat);
SendClientMessageToAll(PINK, string);
SendClientMessage(playerid, LIGHTBLUE, "MessageSent");
}
else
{
SendClientMessage(playerid, RED, "You Have To Be Admin To Use This Command");
}
return 1;
}
pawn Код:
stock GetColor(colorcount)
{
new color[7];
switch(colorcount)
{
case 0:
{
format(color,sizeof(color),"0071BD");
}
case 1:
{
format(color,sizeof(color),"FF00FE");
}
case 2:
{
format(color,sizeof(color),"78227D");
}
case 3:
{
format(color,sizeof(color),"009309");
}
case 4:
{
format(color,sizeof(color),"00FF01");
}
case 5:
{
format(color,sizeof(color),"FFFF04");
}
case 6:
{
format(color,sizeof(color),"FACB01");
}
case 7:
{
format(color,sizeof(color),"FF7C00");
}
case 8:
{
format(color,sizeof(color),"FE0000");
}
case 9:
{
format(color,sizeof(color),"D50304");
}
}
return color;
}