dialogul
case DIALOG_FRIENDS:
{
if(response)
{
if(listitem == 0)
{
ShowPlayerDialog(playerid, DIALOG_FRIENDS2, DIALOG_STYLE_INPUT, "Server: Add a Friend", "Put the playername in the box - type only the name, without the clan tag!", "Add", "Cancel");
}
else
{
format(sName[playerid], MAX_PLAYER_NAME, playerVariables[playerid][sfnume]);
//format(sName[playerid], MAX_PLAYER_NAME, Selectedf[listitem][sfnume]);
new dialstr[40];
SCM(playerid, -1, dialstr);
new id = GetPlayerID(sName[playerid]);
if(id != INVALID_PLAYER_ID)
{
ShowPlayerDialog(playerid, DIALOG_FRIENDS3, DIALOG_STYLE_LIST, dialstr, "Remove from friends\nCall\nSMS", "Select", "Cancel");
}
else
{
ShowPlayerDialog(playerid, DIALOG_FRIENDS3, DIALOG_STYLE_LIST, dialstr, "Remove from friends", "Select", "Cancel");
}
}
}
}
case DIALOG_FRIENDS3:
{
if(response)
{
new id = GetPlayerID(sName[playerid]);
switch(listitem)
{
case 0:
{
new queryy[256], id2;
mysql_format(handle, queryy, 256, "SELECT * FROM playeraccounts WHERE playerName = '%s'", sName[playerid]);
new Cache: re = mysql_query(handle, queryy);
if(cache_get_row_count() >= 1)
{
cache_get_field_content(0, "playerID", result); id2 = strval(result);
new queryy2[256], frid;
mysql_format(handle, queryy2, 256, "SELECT * FROM friends WHERE friendInternalID = '%d' AND friendAddID = '%d'", id2, playerVariables[playerid][pInternalID]);
new Cache: re2 = mysql_query(handle, queryy2);
if(cache_get_row_count() == 0)
{
SCM(playerid, -1, "This player is not in your contact list!");
cache_get_field_content(0, "friendID", result); frid = strval(result);
}
else
{
mysql_format(handle, queryy2, 256, "DELETE * FROM friends WHERE friendID = '%d'", frid);
mysql_tquery(handle, queryy2);
SCM(playerid, -1, "Player removed from contacts.");
}
cache_delete(re2);
}
else
{
SCM(playerid, -1, "There's no such a player!");
}
cache_delete(re);
}
case 1:
{
if(id != INVALID_PLAYER_ID)
{
ShowPlayerDialog(playerid, DIALOG_FRIENDS4, DIALOG_STYLE_INPUT, "Server: SMS", "What text do you wish to send?", "Go", "Cancel");
}
}
case 2:
{
new number;
new queryy[256];
mysql_format(handle, queryy, 256, "SELECT * FROM playeraccounts WHERE playerName = '%s'", sName[playerid]);
new Cache: re = mysql_query(handle, queryy);
if(cache_get_row_count() >= 1)
{
cache_get_field_content(0, "playerPhoneNumber", result); number = strval(result);
}
cache_delete(re);
if(number != -1)
{
new string[256];
if(playerVariables[playerid][pPhone] == 1)
{
format(string, sizeof(string), "* %s takes out their cellphone, and dials in a number.", szPlayerName, number);
}
else if(playerVariables[playerid][pPhone] == 2)
{
format(string, sizeof(string), "* %s takes out their iPhone, and dials in a number.", szPlayerName, number);
}
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
nearByMessage(playerid, COLOR_PURPLE, string);
if(playerVariables[playerid][pPhone] == 1)
{
SetPlayerAttachedObject(playerid,4,330,6, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000 );
}
else if(playerVariables[playerid][pPhone] == 2)
{
SetPlayerAttachedObject( playerid, 4, 18865, 6, 0.086043, 0.027719, 0.003817, 95.232246, 178.651031, 1.691840, 1.002077, 1.000000, 1.000000 ); // MobilePhone1 - phone1
}
foreach(Player, i)
{
if(playerVariables[pPhoneNumber] == number) { if(playerVariables[pStatus] == 1 && playerVariables[pSpectating] == INVALID_PLAYER_ID && playerVariables[pPhoneStatus] == 1 && playerVariables[pPhoneCall] == -1 && playerVariables[pPrisonID] != 3) {
if(playerVariables[pPhone] == 1) { GetPlayerName(i, szPlayerName, MAX_PLAYER_NAME); format(string, sizeof(string), "* %s's cellphone starts to ring...", szPlayerName); } else if(playerVariables[pPhone] == 2) { GetPlayerName(i, szPlayerName, MAX_PLAYER_NAME); format(string, sizeof(string), "* %s's iPhone starts to ring...", szPlayerName); } nearByMessage(i, COLOR_PURPLE, string); format(szMessage, sizeof(szMessage), "You are called by %s. Type /p(ickup) to answer your phone.", playerVariables[playerid][pNormalName]); SCM(i, COLOR_YELLOW, szMessage);
playerVariables[playerid][pCall] = i; return 1; } else { SendClientMessage(playerid, COLOR_GREY, "(cellphone) *busy tone*"); return 1; } } } if(playerVariables[playerid][pPhoneCall] == -1) SendClientMessage(playerid, COLOR_GREY, "(cellphone) *busy tone*"); } } } } } case DIALOG_FRIENDS4: { new number, count; if(response) { new queryy[256]; mysql_format(handle, queryy, 256, "SELECT * FROM playeraccounts WHERE playerName = '%s'", sName[playerid]); new Cache: re = mysql_query(handle, queryy); if(cache_get_row_count() >= 1) { cache_get_field_content(0, "playerPhoneNumber", result); number = strval(result); } cache_delete(re); foreach(Player, x) { if(playerVariables[x][pPhoneNumber] == number) { if(playerVariables[x][pPhoneStatus] == 1) { GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);
format(szMessage, sizeof(szMessage), "SMS from %s (%d): %s", szPlayerName, playerVariables[playerid][pPhoneNumber], inputtext); SendClientMessage(x, COLOR_YELLOW, szMessage); LastPlayer[x] = playerid;
GetPlayerName(x, szPlayerName, MAX_PLAYER_NAME);
format(szMessage, sizeof(szMessage), "SMS sent to %s (%d): %s", szPlayerName, playerVariables[x][pPhoneNumber], inputtext); SendClientMessage(playerid, COLOR_SMS, szMessage); playerVariables[playerid][pPhoneCredit] -= 3;
new szQuery[256]; mysql_format(handle, szQuery, sizeof(szQuery), "INSERT INTO `phonelogs` (`phoneNumber`, `phoneAction`) VALUES('%d', 'SMS to %s: %s')", playerVariables[playerid][pPhoneNumber], szPlayerName, inputtext); mysql_tquery(handle, szQuery); return 1; } else { return SendClientMessage(playerid, COLOR_GREY, "The cellphone that you're trying to SMS is currently unavailable."); } } } count++; } if(count < 1) return SendClientMessage(playerid, COLOR_GREY, "Invalid number."); } case DIALOG_FRIENDS2: { if(response) { new quer69[256], id, number; mysql_format(handle, quer69, 256, "SELECT * FROM friends WHERE friendAddID = '%d'", playerVariables[playerid][pInternalID]); new Cache: q = mysql_query(handle, quer69); if(cache_get_row_count() >= 10) { SCM(playerid, -1, "You already have so many friends!"); return 1; } cache_get_field_content(0, "friendInternalID", result); id = strval(result); cache_delete(q); mysql_format(handle, quer69, 256, "SELECT * FROM playeraccounts WHERE playerID = '%d'", id); new Cache: q2 = mysql_query(handle, quer69); if(cache_get_row_count() != 0) { cache_get_field_content(0, "playerPhoneNumber", result); number = strval(result); } cache_delete(q2); if(number != -1) { mysql_format(handle, quer69, 256, "INSERT INTO `friends` (`friendNumber`, `friendInternalID`, `friendAddID`) VALUES ('%d', '%d', '%d')", number, id, playerVariables[playerid][pInternalID]); mysql_query(handle, quer69); SCM(playerid, -1, quer69);
SCM(playerid, -1, "Friend added!"); } } }
Poza baza de date: