Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CMD:rp(playerid, params[])
- {
- new idstring[255], message[180], string[255];
- if(sscanf(params, "s[255]s[180]", idstring, message))
- return SendClientMessage(playerid, GREY, "SYNTAX: /rp [playerids (use commas to seperate ids/names EG:\"user_1,user_2,23,user_3\")] [message]");
- if(Player[playerid][PrisonID] == 1)
- return SendClientMessage(playerid, WHITE, "You may not use this channel right now.");
- new users[6][255], count;
- for(new i, j = strlen(idstring); i < j && i != j; i++)
- {
- printf("%d:%c", i, idstring[i]);
- if(idstring[i] != ',' && i != strlen(idstring) - 1)
- continue;
- if(count > 6)
- break;
- strcpy(users[count], idstring);
- if(i != strlen(users[count]) - 1)
- strdel(users[count], i, strlen(users[count]));
- strdel(idstring, 0, i + 1);
- i = -1;
- j = strlen(idstring);
- count++;
- }
- if(count == 0 || count > 6)
- return SendClientMessage(playerid, WHITE, "None of the given users are connected or you entered more than the limit (6).");
- new sent_to[6];
- for(new i; i < 6; i++)
- {
- sent_to[i] = -1;
- }
- new notconnected[128];
- for(new i; i < count; i++)
- {
- new id;
- if(sscanf(users[i], "u", id))
- continue;
- new skip;
- for(new x; x < 6 && skip != 1; x++)
- {
- if(id == sent_to[x] && sent_to[x] != -1)
- {
- skip = 1;
- }
- }
- if(skip)
- continue;
- if(!IsPlayerConnectedEx(id))
- {
- if(isnull(notconnected))
- format(notconnected, sizeof(notconnected), "These players are not connected: ");
- format(notconnected, sizeof(notconnected), "%s%s, ", notconnected, users[i]);
- continue;
- }
- if(Player[id][AdminDuty] > 0)
- continue;
- sent_to[i] = id;
- new splitpos = 110 - (20+strlen(GetName(playerid)));
- if(strlen(message) > splitpos)
- {
- new str1[86], str2[86];
- strsplit(message, str1, str2, splitpos);
- format(string, sizeof(string), "[RP to %s (%d)] * %s", GetNameEx(id), id, str1);
- SendClientMessage(playerid, LONGDISTANCERP, string);
- format(string, sizeof(string), "[RP to %s (%d)] * %s", GetNameEx(id), id, str2);
- SendClientMessage(playerid, LONGDISTANCERP, string);
- format(string, sizeof(string), "[RP from %s (%d)] * %s", GetNameEx(playerid), playerid, str1);
- SendClientMessage(id, LONGDISTANCERP, string);
- format(string, sizeof(string), "[RP from %s (%d)] * %s", GetNameEx(playerid), playerid, str2);
- SendClientMessage(id, LONGDISTANCERP, string);
- }
- else
- {
- format(string, sizeof(string), "[RP to %s (%d)] * %s", GetNameEx(id), id, message);
- SendClientMessage(playerid, LONGDISTANCERP, string);
- format(string, sizeof(string), "[RP from %s (%d)] * %s", GetNameEx(playerid), playerid, message);
- SendClientMessage(id, LONGDISTANCERP, string);
- }
- foreach(Player, x)
- {
- if(Spectator[x][SpecSpectatingPlayer] == id)
- {
- format(string, sizeof(string), "[RP %s to %s] %s", GetName(playerid), GetName(id), message);
- SendClientMessage(x, PURPLE, string);
- }
- if(Spectator[x][SpecSpectatingPlayer] == playerid)
- {
- format(string, sizeof(string), "[RP %s to %s] %s", GetName(playerid), GetName(id), message);
- SendClientMessage(x, PURPLE, string);
- }
- }
- format(string, sizeof(string), "[RP] %s (ID: %d) to %s (ID: %d): %s", GetNameEx(playerid), playerid, GetNameEx(id), id, message);
- ICChatLog(string);
- }
- if(!isnull(notconnected))
- SendClientMessage(playerid, WHITE, notconnected);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement