03.01.2015, 19:03
hello this, im having a problem with command (/whisper) this command crash my server by spaming more than 2 times.
it exceed m client limit.
please tell me what is the problem and tell me its fixes!
it exceed m client limit.
please tell me what is the problem and tell me its fixes!
Код:
COMMAND:w(playerid, params[]) { return cmd_whisper(playerid, params); } COMMAND:whisper(playerid, params[]) { if (PlayerInfo[playerid][pSpawned] == 1) { new COLOR = GetPlayerColor(playerid); new idx,string[512],length = strlen(params); while ((idx < length) && (params[idx] <= ' ')) { idx++; } new offset = idx; new result[512]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = params[idx]; idx++; } result[idx - offset] = EOS; if (PlayerInfo[playerid][pMuted] == 1) { SendClientMessage(playerid,COLOR_ERROR,"#Error: You Muted."); return 1; } if(stringContainsIP(result)) { SendClientMessage(playerid,COLOR_ERROR,"Invalid Message."); return 1; } if (!strlen(result)) { SendClientMessage(playerid, COLOR_ERROR, "USAGE: /whisper (message)."); return 1; } format(string, sizeof(string), "(WHISPER) %s (%d): {FFFFFF}%s",PlayerInfo[playerid][pName],playerid,result); SendClientMessage(playerid,COLOR, string); for (new i = 0; i < GetMaxPlayers(); i++) { i = GetClosestPlayer(playerid); if (IsPlayerConnected(i)) { if (i != playerid) { if (GetDistanceBetweenPlayers(playerid, i) < 10) { SendClientMessage(i,COLOR, string); } } } } }else{ SendClientMessage(playerid, COLOR_ERROR, "You Cannot Use This Command When You're Dead."); } return 1; }