Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define MAX_SAME_IP_PLAYERS 10
- new
- ip_address_idx,
- ip_same_idx,
- id_same_idx[MAX_SAME_IP_PLAYERS];
- static
- bool:is_found,
- ip_temp[16],
- ip_address[MAX_PLAYERS][16],
- ip_same[MAX_SAME_IP_PLAYERS][16]
- id_same[MAX_SAME_IP_PLAYERS][MAX_PLAYERS];
- foreach (new playerid : Player) {
- GetPlayerIp(playerid, ip_temp, sizeof(ip_temp));
- is_found = false;
- for (new i = 0; i < sizeof(ip_address); i++) {
- if (strcmp(ip_temp, ip_address[i]) == 0) {
- is_found = true;
- ip_same[ip_same_idx][0] = '\0';
- strcat(ip_same[ip_same_idx], ip_temp, sizeof(ip_same[]));
- id_same[id_same_idx[ip_same_idx]] = playerid;
- id_same_idx[ip_same_idx]++
- ip_same_idx++;
- break;
- }
- }
- if (!is_found) {
- ip_address[ip_address_idx][0] = '\0';
- strcat(ip_address[ip_address_idx], ip_temp, sizeof(ip_address[]));
- ip_address_idx++;
- }
- }
- for (new i = 0; i < ip_same_idx; i++) {
- printf("ip: %s", ip_same[i]);
- for (new playerid = 0; playerid < id_same_idx[i]; playerid++) {
- printf(" id: %d", id_same[i][playerid]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment