20.07.2013, 14:06
Sup, my newbie command doesnt work, where's the wrong ?
pawn Код:
if(strcmp(cmd, "/newb", true) == 0)
{
if(PlayerInfo[playerid][pMuted] == 1)
{
SendClientMessage(playerid, COLOR_GREY, "Вие сте заглушен от чата за нови.");
return 1;
}
if(NewbieTimer[playerid] > 0)
{
format(string, sizeof(string), "Вие трябва да изчакате %d секунди преди да пуснете нов отговор.", NewbieTimer[playerid]);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
new result[64];
new length = strlen(cmdtext);
new offset = idx;
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_YELLOW, "{33CCFF}USAGE:{FFFFFF} /newb [text]");
return 1;
}
if(PlayerInfo[playerid][pAdmin] < 1)
{
NewbieTimer[playerid] = 30;
}
if(PlayerInfo[playerid][pAdmin]<1)
{
format(string, sizeof(string), "** Newbie %s: %s", GetPlayerName(playerid), result);
}
if(PlayerInfo[playerid][pAdmin] == 1)
{
format(string, sizeof(string), "** Moderator %s: %s", GetPlayerName(playerid), result);
}
if(PlayerInfo[playerid][pAdmin] >= 2)
{
format(string, sizeof(string), "** Admin %s: %s", GetPlayerName(playerid), result);
}
foreach(Player, n)
{
SetTimer("NewbTimer", 25000, 0);
SendClientMessage(n, COLOR_YELLOW, string);
}
return 1;
}