How I can put a restriction that a player who is already in the list of friends and wants to add him and to give him a message like this: You already have that player on your list . I wrote something but do not know how to put restriction can someone help me ?
Код:
public AddFriend(playerid, friend[])
{
if(IsPlayerConnected(playerid))
{
new playername[25];
GetPlayerName(playerid,playername,sizeof(playername));
if(strval(friend) == strval(playername)) return SendClientMessage(playerid,-1,"{FFB870}Erorr: You can't add you in friend list.");
{
new cont;
cont = MySQLCheckAccount(friend);
if(cont == 0) return SendClientMessage(playerid,-1,"{FFB870}Erorr: This name does not exist.");
//SendClientMessage(playerid,-1,"{FFB870}Erorr: You already friend with that player.");
new playername3[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername3, sizeof(playername3));
new Str[200];
format(Str,sizeof(Str),"INSERT INTO `friends` (`user`,`friend`) VALUES ('%s','%s')",playername3,friend);
mysql_query(SQL,Str);
strmid(FriendsInfo[playerid][pFriendName], friend, 0, strlen(friend), 255);
new string[128];
format(string,sizeof(string),"{FFB870}You succesfully added %s on your friends list.",friend);
SendClientMessage(playerid,-1,string);
}
return 1;
}
return 1;
}