not getting the message - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: not getting the message (
/showthread.php?tid=621838)
not getting the message -
StR_MaRy - 15.11.2016
hey guys i have this dialog that wont give me the message "you can't add you in your friend list" but it give's me the message "that id isn't connected , please ad someone online"
the line who should give me the message if i try to ad me
Код HTML:
if(i == playerid) return SendClientMessage(playerid, COLOR_WHITE, "Nu te poti adauga pe tine insuti.");
why?
Код HTML:
if(dialogid == DIALOG_ADDFRIENDS)
{
if(response)
{
new text[50];
mysql_real_escape_string(inputtext, text);
if(IsNumeric(text))
{
new find = 0;
foreach(Player, i)
{
if(IsPlayerConnected(i))
{
if(find == 0)
{
new name[30],str1[256];
GetPlayerName(i, name, sizeof(name));
if(strfind(name, text) != -1)
{
find = 1;
if(i == playerid) return SendClientMessage(playerid, COLOR_WHITE, "Nu te poti adauga pe tine insuti.");
format(str1, sizeof(str1), "SELECT * FROM `friends` WHERE `FriendID`='%d' AND `PlayerID`='%d'",PlayerInfo[i][pSQLID],PlayerInfo[playerid][pSQLID]);
new Cache: membresult = mysql_query(SQL,str1);
if(cache_get_row_count () > 0)
{
SendClientMessage(playerid, COLOR_WHITE, "Acel jucator este deja in lista ta de prieteni.");
return 1;
}
cache_delete(membresult);
mysql_format(SQL, str1, sizeof(str1), "INSERT INTO `friends` (`PlayerID`,`FriendID`,`FriendName`) VALUES('%d','%d','%s')",PlayerInfo[playerid][pSQLID],PlayerInfo[i][pSQLID],PlayerInfo[i][pNormalName]);
mysql_tquery(SQL,str1,"","");
SendClientMessage(playerid, COLOR_YELLOW, "Prieten adaugat!");
}
}
}
else return SendClientMessage(playerid, COLOR_WHITE, "ID invalid. Poti adauga doar playerii care-s online in lista de prieteni.");
}
if(find == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "ID invalid. Poti adauga doar playerii care-s online in lista de prieteni.");
}
}
}
}
Re: not getting the message -
Bolex_ - 15.11.2016
I dont understand what was going on here, explain a little better
Re: not getting the message -
Vince - 15.11.2016
Try not to nest so much if-statements inside one another. Makes code needlessly hard to read. What I assume you want is something like this:
http://pastebin.com/167BUH99. This works on the principle of "INSERT IGNORE", assuming that the combination (FriendID, PlayerID) is the primary key. Much shorter and cleaner and IMO also more straightforward.
Re: not getting the message -
StR_MaRy - 15.11.2016
so can you help me out with an aranjament?