Try this
Код:
new AdminChat[MAX_PLAYERS];
new AdminChatOffer[MAX_PLAYERS];
CMD:requestchat(playerid, params[])
{
new string[128];
if(PlayerInfo[playerid][pAdmin] >= 1)
{
if(AdminChat[playerid] != -1)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Admin conversation ended.");
SendClientMessage(AdminChat[playerid], COLOR_LIGHTBLUE, "* Admin conversation ended.");
AdminChat[AdminChat[playerid]] = -1;
AdminChat[playerid] = -1;
return 1;
}
new giveplayerid;
if(!sscanf(params, "u", giveplayerid))
{
if (IsPlayerConnected(giveplayerid))
{
if(giveplayerid == playerid)
{
SendClientMessage(playerid, COLOR_LIGHTRED, " You can't request a chat of yourself!");
return 1;
}
if(PlayerInfo[playerid][pAdmin] == 1)
{
format(string, sizeof(string), "{FFFFFF}* %s offered you to have an Admin Conversation.\nDo you want to acccept?", PlayerNameEx(playerid));
}
else
{
format(string, sizeof(string), "{FFFFFF}* %s offered you to have an Admin Conversation.\nDo you want to acccept?", PlayerNameEx(playerid));
}
AdminChatOffer[giveplayerid] = playerid;
ShowPlayerDialog(giveplayerid, 114, DIALOG_STYLE_MSGBOX, "{00BFFF}Fatality Roleplay Administration", string, "Accept", "Decline");
format(string, sizeof(string), "* You offered %s to have a conversation.", PlayerNameEx(giveplayerid));
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, " Invalid player!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /Requestchat [playerid/PartOfName]");
return 1;
}
}
else
{
format(string, sizeof(string), "%s wants to chat with the Staff. (/Requestchat)", PlayerName(playerid));
ABroadCast(COLOR_YELLOW2, string, 1);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Your chat request has been sent to our team.");
}
return 1;
}
CMD:endchat(playerid)
{
if(AdminChat[playerid] != -1)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Admin conversation ended.");
SendClientMessage(AdminChat[playerid], COLOR_LIGHTBLUE, "* Admin conversation ended.");
AdminChat[AdminChat[playerid]] = -1;
AdminChat[playerid] = -1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not in an admin chat!");
}
return 1;
}