Hello guys. How can i make this command [Below] work like this: /newb [ID] [Answer] for helpers, and for players only /newb [Question]
Код:
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;
}
Then, I think you should make two different command one /newb For Player And /helpnewb For Helpers..
pawn Код:
CMD:newb(playerid,params[])
{
new str[80];
if(sscanf(params,"s[80]",str)) SendClientMessage(playerid,-1,"Usage : /newb [question]");
new name[MAX_PLAYER_NAME],msg[110];
GetPlayerName(playerid,name,20);
format(msg,sizeof(msg),"[HELP NEEDED]%s(%d) : %s",name,playerid,str);
for(new i=0;i<MAX_PLAYERS;++i)
{
if(IsPlayerConnected(i) && PlayerInfo[i][Admin] >= 1) || IsPlayerAdmin(i))
SendClientMessage(i,-1,msg);
}
SendClientMessage(playerid,-1, "Question sent, admins will respond as soon as possible");
return 1;
}