Hello, how can i make this /newb command [below] like this: Player uses /newb [Question] and moderators and admins use /newb [PLAYERID] [Anwser] ?
Код:
CMD:newb(playerid, params[])
{
new log[128];
if(gPlayerLogged{playerid} == 0)
{
SendClientMessageEx(playerid, COLOR_GREY, "You're not logged in.");
return 1;
}
if(PlayerInfo[playerid][pTut] == 0)
{
SendClientMessageEx(playerid, COLOR_GREY, "You can't do that at this time.");
return 1;
}
if ((nonewbie) && PlayerInfo[playerid][pAdmin] < 2)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "The newbie chat channel has been disabled by an administrator!");
return 1;
}
if(PlayerInfo[playerid][pNMute] == 1)
{
SendClientMessageEx(playerid, COLOR_GREY, "You are muted from the newbie chat channel.");
return 1;
}
new string[128];
if(NewbieTimer[playerid] > 0)
{
format(string, sizeof(string), "You must wait %d seconds before speaking again in this channel.", NewbieTimer[playerid]);
SendClientMessageEx(playerid, COLOR_GREY, string);
return 1;
}
if(gNewbie[playerid]==1)
{
SendClientMessageEx(playerid, COLOR_GREY, "You have the channel toggled, /tognewbie to re-enable!");
return 1;
}
if(isnull(params)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: (/newb)ie [text]");
if(PlayerInfo[playerid][pHelper]<1&&PlayerInfo[playerid][pAdmin] < 1)
{
NewbieTimer[playerid] = 50;
}
if(PlayerInfo[playerid][pHelper]<1&&PlayerInfo[playerid][pAdmin]<1)
{
format(string, sizeof(string), "** Newbie %s [%d]: %s", GetPlayerNameEx(playerid), playerid, params);
}
if(PlayerInfo[playerid][pHelper] == 1&& PlayerInfo[playerid][pAdmin]<2)
{
format(string, sizeof(string), "** Junior Moderator %s [%d]: %s", GetPlayerNameEx(playerid), playerid, params);
}
if(PlayerInfo[playerid][pAdmin] == 1)
{
format(string, sizeof(string), "** Server Moderator %s [%d]: %s", GetPlayerNameEx(playerid), playerid, params);
}
if(PlayerInfo[playerid][pHelper] == 2&&PlayerInfo[playerid][pAdmin]<2)
{
format(string, sizeof(string), "** Moderator %s [%d]: %s", GetPlayerNameEx(playerid), playerid, params);
}
if(PlayerInfo[playerid][pHelper] == 3&&PlayerInfo[playerid][pAdmin]<2)
{
format(string, sizeof(string), "** Senior Moderator %s: %s", GetPlayerNameEx(playerid), params);
}
if(PlayerInfo[playerid][pHelper] == 4&&PlayerInfo[playerid][pAdmin]<2)
{
format(string, sizeof(string), "** Chief Moderator %s: %s", GetPlayerNameEx(playerid), params);
}
if(PlayerInfo[playerid][pHelper] == 5&&PlayerInfo[playerid][pAdmin]<2)
{
format(string, sizeof(string), "** Head Chief Moderator %s: %s", GetPlayerNameEx(playerid), params);
}
if(PlayerInfo[playerid][pAdmin] >= 2)
{
format(string, sizeof(string), "** Admin %s: %s", GetPlayerNameEx(playerid), params);
}
if(PlayerInfo[playerid][pAdmin] < 2 && CheckServerAd(params))
{
format(string,sizeof(string),"Warning: %s [ID: %d] may be server advertising: '%s'.", GetPlayerNameEx(playerid), playerid, params);
ABroadCast(COLOR_RED, string, 2);
format(log, sizeof(log), "Warning: %s [ID: %d] may be server advertising: '%s'.", GetPlayerNameEx(playerid), playerid, params);
Log("logs/hack.log", string);
return 0;
}
foreach(Player, n)
{
if (gNewbie[n]==0)
{
SendClientMessageEx(n, COLOR_NEWBIE, string);
}
}
return 1;
}
Код:
CMD:anewb(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 1)
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
return 1;
}
new pID, text[256], string[256];
if(sscanf(params, "us[256]", pID, text)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /anewb (Playerid) (answer) - Enter a valid Nick / ID");
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "Player is not connected.");
if(pID == playerid) return SendClientMessage(playerid, COLOR_RED, "You cannot PM yourself.");
format(string, sizeof(string), "%s (%d) is not accepting private messages at the moment.", PlayerName(pID), pID);
if(pInfo[pID][NoPM] == 1) return SendClientMessage(playerid, COLOR_RED, string);
format(string, sizeof(string), "PM to %s: %s", PlayerName(pID), text);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string, sizeof(string), "PM from %s: %s", PlayerName(playerid), text);
SendClientMessage(pID, COLOR_YELLOW, string);
pInfo[pID][Last] = playerid;
for (new i = 0; i < MAX_PLAYERS; i++)
if (IsPlayerAdmin(i))
{
format(string, sizeof(string), "PM: %s(%d) to %s(%d): %s", PlayerName(playerid), playerid, PlayerName(pID), pID, text);
{
if (IsPlayerAdmin(i))
SendClientMessage(i, COLOR_GREY, string);
}
}
return 1;
}