Advertisement
Guest User

Untitled

a guest
Jul 28th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.57 KB | None | 0 0
  1. case DIALOG_FRIENDS+1:
  2. {
  3. if(!response) return 1;
  4. new id;
  5. if(sscanf(inputtext, "u", id))
  6. {
  7. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}Eroare: Jucatorul nu este conectat.");
  8. }
  9. else
  10. {
  11. if(id == playerid) return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}Nu te poti adauga pe tine in lista!");
  12. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}Eroare: Jucatorul nu este conectat.");
  13. new test, friends;
  14. new result[256];
  15. format(string, sizeof(string), "SELECT * FROM `friends` WHERE `friendID`='%d'", PlayerInfo[id][pSQLID]);
  16. new Cache: db = mysql_query (SQL, string);
  17. for ( new i, j = cache_get_row_count (); i != j; ++i )
  18. {
  19. friends++;
  20. cache_get_field_content( i, "AddBy", result ); test = strval( result );
  21. if(test == PlayerInfo[playerid][pSQLID]) return SendClientMessage(playerid, COLOR_WHITE, "Acest player este deja in lista ta de prieteni!");
  22. }
  23. if(friends == 25 && PlayerInfo[playerid][pPremiumAccount] == 0) return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}* Poti avea doar 25 prieteni fara cont premium!");
  24. if(friends == 50) return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}* Ai prea multi prieteni!");
  25. cache_delete( db );
  26. format(string, sizeof(string), "{FFB870}%s (%d) face acum parte din lista ta de prieteni.", GetName(id), id);
  27. SendClientMessage(playerid, COLOR_WHITE, string);
  28. format(string, sizeof(string), "{FFB870}%s (%d) te-a adaugat in lista sa de prieteni.", GetName(playerid), playerid);
  29. SendClientMessage(id, COLOR_WHITE, string);
  30. format(string, sizeof(string), "INSERT INTO `friends` (`friendID`, `friendName`, `AddBy`) VALUES ('%d', '%s', '%d')", PlayerInfo[id][pSQLID], PlayerInfo[id][pUsername], PlayerInfo[playerid][pSQLID]);
  31. mysql_tquery(SQL, string, "", "");
  32. }
  33. }
  34. case DIALOG_FRIENDS+2:
  35. {
  36. if(!response) return ShowPlayerFriends(playerid);
  37. new userid = GetPlayerID(sName[playerid]);
  38. if(!IsPlayerConnected(userid)) return 1;
  39. switch(listitem)
  40. {
  41. case 0:
  42. {
  43. if(PlayerInfo[playerid][pPnumber] == 0) return SendClientMessage(playerid, COLOR_YELLOW2, "Error: You don't have a cellphone!");
  44. foreach(Player, i)
  45. {
  46. if(PlayerInfo[i][pPnumber] == PlayerInfo[userid][pPnumber])
  47. {
  48. new id = i;
  49. if(PlayerInfo[id][pPnumber] == 0) return SendClientMessage(playerid, COLOR_YELLOW2, "Error: This player dont have a cellphone!");
  50. if(PhoneOnline[id] == 1) return SendClientMessage(playerid, COLOR_YELLOW2, "Error: Player's phone is offline!");
  51. Mobile[playerid] = id;
  52. if(Mobile[id] != 255) return SendClientMessage(playerid, COLOR_YELLOW2, "Error: That player is speaking with someone.");
  53. if(Mobile[id] == 255)
  54. {
  55. format(string, sizeof(string), "{FFFF45}Phone: %s ({FFFFFF}%s{FFFF45}) is calling you. Type (/pickup) to answer.", GetName(playerid), DecimalNumber(playerid));
  56. SendClientMessage(id, COLOR_WHITE, string);
  57. format(string, sizeof(string), "%s takes out a cellphone and dials a number.", GetName(playerid));
  58. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  59. format(string, sizeof(string), "%s's phone rings.", GetName(id));
  60. ProxDetector(30.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  61. SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
  62. return 1;
  63. }
  64. }
  65. }
  66. }
  67. case 1:
  68. {
  69. if(PlayerInfo[playerid][pPnumber] == 0) return SendClientMessage(playerid, COLOR_YELLOW2, "Error: You don't have a cellphone!");
  70. ShowPlayerDialog(playerid, DIALOG_FRIENDS+4, DIALOG_STYLE_INPUT, "Send SMS:", "Write the SMS text in the box below.", "Send", "Cancel");
  71. }
  72. case 2:
  73. {
  74. mysql_format(SQL,string,128,"DELETE FROM `friends` WHERE `friendID`='%d'",PlayerInfo[userid][pSQLID]);
  75. mysql_query(SQL, string);
  76. format(string, sizeof(string), "{FFB870}%s nu mai face parte din lista ta de prieteni.", PlayerInfo[userid][pUsername]);
  77. SendClientMessage(playerid, COLOR_WHITE, string);
  78. }
  79. }
  80. }
  81. case DIALOG_FRIENDS+3:
  82. {
  83. if(!response) return ShowPlayerFriends(playerid);
  84. mysql_format(SQL,string,128,"DELETE FROM `friends` WHERE `friendName`='%s'",sName[playerid]);
  85. mysql_query(SQL, string);
  86. format(string, sizeof(string), "{FFB870}%s nu mai face parte din lista ta de prieteni.", sName[playerid]);
  87. SendClientMessage(playerid, COLOR_WHITE, string);
  88. }
  89. case DIALOG_FRIENDS+4:
  90. {
  91. if(!response) return 1;
  92. new userid = GetPlayerID(sName[playerid]);
  93. if(!IsPlayerConnected(userid)) return 1;
  94. foreach(Player, i)
  95. {
  96. if(PlayerInfo[i][pPnumber] == PlayerInfo[userid][pPnumber] && PlayerInfo[userid][pPnumber] != 0)
  97. {
  98. new id = i;
  99. if(PlayerInfo[id][pPnumber] == 0) return SendClientMessage(playerid, COLOR_YELLOW2, "Error: This player dont have a cellphone!");
  100. if(PhoneOnline[id] == 1) return SendClientMessage(playerid, COLOR_YELLOW2, "Error: Player's phone is offline!");
  101. format(string, sizeof(string), "SMS from %s ({FFFFFF}%s{FFFF00}): %s",GetName(playerid),DecimalNumber(playerid), inputtext);
  102. SendClientMessage(id, COLOR_YELLOW, string);
  103. format(string, sizeof(string), "SMS to %s ({FFFFFF}%s{FFFF00}): %s",GetName(id),DecimalNumber(id),inputtext);
  104. SendClientMessage(playerid, COLOR_YELLOW, string);
  105. PlayerPlaySound(id, 1052, 0.0, 0.0, 10.0);
  106. return 1;
  107. }
  108. }
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement