[MYSQL]Help Please(CAN SOMEBODY do this in dini please)
#1

Can somebody help me please guys :/ ?
Quote:

new pname[24], friend[128], savingstring[128], query[250];
PlayerLoop(p)
{
if(PLAYERLIST_authed[p])
{
GetPlayerName(p, pname, sizeof(pname));
format(query, sizeof(query), "SELECT `friend` FROM `FriendInfo` WHERE `you` = '%s'", pname);
mysql_query(query);
mysql_store_result();
while(mysql_fetch_row_format(query, "|"))
{
mysql_fetch_field_row(savingstring, "friend");
myStrcpy(friend, savingstring);
new playerID = GetPlayerId(friend);
if(IsPlayerConnected(playerID))
{
if(playerID == playerid)
{
SendClientMSG(p, COLOR_ADMIN_PM, "[FRIEND] Your friend %s has Connected to the server.", RPName(playerid));
}
}
}
mysql_free_result();
}
}

Quote:

COMMAND:friend(playerid, params[])
{
new tmp[ 24 ], tmp2[ 24 ], tmp3[ 24 ], tmp4[ 24 ], query[240];
if(sscanf(params, "szz", tmp, tmp2, tmp3, tmp4)) return SCP(playerid, "[ add / remove / list]");
if(!strcmp(tmp, "add", true, 3))
{
if(!strlen(tmp2) || IsNumeric(tmp2) || strlen(tmp2) > MAX_PLAYER_NAME) return SCP(playerid, "add [name]");
new jname[25];
jname = tmp2;
new pname[25];
GetPlayerName(playerid, pname, sizeof(pname));
format(query, sizeof(query), "SELECT IP FROM `PlayerInfo` WHERE `user` = '%s'", jname);
mysql_query(query);
mysql_store_result();
new rows = mysql_num_rows();
if(rows)
{
format(query,sizeof(query), "INSERT INTO `FriendInfo` (you, friend) VALUES ('%s', ('%s'));", pname, jname);
mysql_query(query);
format(iStr, sizeof(iStr),"You have added: %s to your friend list.", jname);
SendClientInfo(playerid, iStr);
new playerID = GetPlayerId(jname);
if(IsPlayerConnected(playerID))
{
SendClientMSG(playerID, COLOR_ADMIN_PM, "[FRIEND] %s has added you from thier friend list.", RPName(playerid));
}
}
else return SendClientError(playerid, "Player hasn't been found in the database");
mysql_free_result();
}
else if(!strcmp(tmp, "remove", true, 6))
{
if(!strlen(tmp2) || IsNumeric(tmp2) || strlen(tmp2) > MAX_PLAYER_NAME) return SCP(playerid, "remove [name]");
new jname[25];
jname = tmp2;
new pname[25];
GetPlayerName(playerid, pname, sizeof(pname));
format(query, sizeof(query), "SELECT IP FROM `PlayerInfo` WHERE `user` = '%s'", jname);
mysql_query(query);
mysql_store_result();
new rows = mysql_num_rows();
if(rows)
{
format(query,sizeof(query), "DELETE FROM `FriendInfo` WHERE `you` = '%s' AND `friend` = '%s'", pname, jname);
mysql_query(query);
format(iStr, sizeof(iStr),"You have removed: %s from your friend list.", jname);
SendClientInfo(playerid, iStr);
new playerID = GetPlayerId(jname);
if(IsPlayerConnected(playerID))
{
SendClientMSG(playerID, COLOR_ADMIN_PM, "[FRIEND] %s has removed you from thier friend list.", RPName(playerid));
}
}
else return SendClientError(playerid, "Player hasn't been found in the database");
mysql_free_result();
}
else if(!strcmp(tmp, "list", true, 4))
{
new pname[24], friend[128], string[258], savingstring[128];
GetPlayerName(playerid, pname, sizeof(pname));
format(query, sizeof(query), "SELECT `friend` FROM `FriendInfo` WHERE `you` = '%s'", pname);
mysql_query(query);
mysql_store_result();
SendClientMessage(playerid, COLOR_ADMIN_PM, "[FRIENDS] - Your friend list:");
while(mysql_fetch_row_format(query, "|"))
{
mysql_fetch_field_row(savingstring, "friend");
myStrcpy(friend, savingstring);
//================================================== ============================
new playerID = GetPlayerId(friend);
if(IsPlayerConnected(playerID))
{
if(iAFKp[playerID] > 3) format(string, sizeof(string), " - {f47c1b}[AFK]");
else format(string, sizeof(string),"");
SendClientMSG(playerid, COLOR_LIGHTGREY, " - %s - {6BDE54}[ONLINE]%s", RPName(playerID), string);
}
else
{
SendClientMSG(playerid, COLOR_LIGHTGREY, " - %s - {FF0000}[OFFLINE]", friend);
}
}
mysql_free_result();
}
else return SCP(playerid, "[ add / remove / list]");
return 1;
}

Reply
#2

You should use the MySQL itself. Dini is outdated.
Reply
#3

Quote:
Originally Posted by Karan007
Посмотреть сообщение
You should use the MySQL itself. Dini is outdated.
no please i want dini no sql cuz all my script its dini :/
Reply
#4

bump?
Reply
#5

bump 2?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)