Advertisement
Guest User

Untitled

a guest
Jan 30th, 2015
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.42 KB | None | 0 0
  1. CMD:rp(playerid, params[])
  2. {
  3. new idstring[255], message[180], string[255];
  4. if(sscanf(params, "s[255]s[180]", idstring, message))
  5. return SendClientMessage(playerid, GREY, "SYNTAX: /rp [playerids (use commas to seperate ids/names EG:\"user_1,user_2,23,user_3\")] [message]");
  6.  
  7. if(Player[playerid][PrisonID] == 1)
  8. return SendClientMessage(playerid, WHITE, "You may not use this channel right now.");
  9.  
  10. new users[6][255], count;
  11. for(new i, j = strlen(idstring); i < j && i != j; i++)
  12. {
  13. printf("%d:%c", i, idstring[i]);
  14. if(idstring[i] != ',' && i != strlen(idstring) - 1)
  15. continue;
  16.  
  17. if(count > 6)
  18. break;
  19.  
  20. strcpy(users[count], idstring);
  21.  
  22. if(i != strlen(users[count]) - 1)
  23. strdel(users[count], i, strlen(users[count]));
  24. strdel(idstring, 0, i + 1);
  25.  
  26. i = -1;
  27. j = strlen(idstring);
  28.  
  29. count++;
  30. }
  31.  
  32. if(count == 0 || count > 6)
  33. return SendClientMessage(playerid, WHITE, "None of the given users are connected or you entered more than the limit (6).");
  34.  
  35. new sent_to[6];
  36. for(new i; i < 6; i++)
  37. {
  38. sent_to[i] = -1;
  39. }
  40.  
  41. new notconnected[128];
  42. for(new i; i < count; i++)
  43. {
  44. new id;
  45. if(sscanf(users[i], "u", id))
  46. continue;
  47.  
  48. new skip;
  49. for(new x; x < 6 && skip != 1; x++)
  50. {
  51. if(id == sent_to[x] && sent_to[x] != -1)
  52. {
  53. skip = 1;
  54. }
  55. }
  56.  
  57. if(skip)
  58. continue;
  59.  
  60. if(!IsPlayerConnectedEx(id))
  61. {
  62. if(isnull(notconnected))
  63. format(notconnected, sizeof(notconnected), "These players are not connected: ");
  64. format(notconnected, sizeof(notconnected), "%s%s, ", notconnected, users[i]);
  65. continue;
  66. }
  67.  
  68. if(Player[id][AdminDuty] > 0)
  69. continue;
  70.  
  71. sent_to[i] = id;
  72.  
  73. new splitpos = 110 - (20+strlen(GetName(playerid)));
  74. if(strlen(message) > splitpos)
  75. {
  76. new str1[86], str2[86];
  77. strsplit(message, str1, str2, splitpos);
  78. format(string, sizeof(string), "[RP to %s (%d)] * %s", GetNameEx(id), id, str1);
  79. SendClientMessage(playerid, LONGDISTANCERP, string);
  80. format(string, sizeof(string), "[RP to %s (%d)] * %s", GetNameEx(id), id, str2);
  81. SendClientMessage(playerid, LONGDISTANCERP, string);
  82. format(string, sizeof(string), "[RP from %s (%d)] * %s", GetNameEx(playerid), playerid, str1);
  83. SendClientMessage(id, LONGDISTANCERP, string);
  84. format(string, sizeof(string), "[RP from %s (%d)] * %s", GetNameEx(playerid), playerid, str2);
  85. SendClientMessage(id, LONGDISTANCERP, string);
  86. }
  87.  
  88. else
  89. {
  90. format(string, sizeof(string), "[RP to %s (%d)] * %s", GetNameEx(id), id, message);
  91. SendClientMessage(playerid, LONGDISTANCERP, string);
  92. format(string, sizeof(string), "[RP from %s (%d)] * %s", GetNameEx(playerid), playerid, message);
  93. SendClientMessage(id, LONGDISTANCERP, string);
  94. }
  95.  
  96. foreach(Player, x)
  97. {
  98. if(Spectator[x][SpecSpectatingPlayer] == id)
  99. {
  100. format(string, sizeof(string), "[RP %s to %s] %s", GetName(playerid), GetName(id), message);
  101. SendClientMessage(x, PURPLE, string);
  102. }
  103. if(Spectator[x][SpecSpectatingPlayer] == playerid)
  104. {
  105. format(string, sizeof(string), "[RP %s to %s] %s", GetName(playerid), GetName(id), message);
  106. SendClientMessage(x, PURPLE, string);
  107. }
  108. }
  109.  
  110. format(string, sizeof(string), "[RP] %s (ID: %d) to %s (ID: %d): %s", GetNameEx(playerid), playerid, GetNameEx(id), id, message);
  111. ICChatLog(string);
  112. }
  113.  
  114. if(!isnull(notconnected))
  115. SendClientMessage(playerid, WHITE, notconnected);
  116. return 1;
  117. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement