02.02.2015, 16:18
hello,
i've one problem with my /whisper command so i want help please.
when i use this command near a player it keep spams near players instead of sending only one message. and crash the server
reason for crashing.... asckslimit exceeded.
i've one problem with my /whisper command so i want help please.
when i use this command near a player it keep spams near players instead of sending only one message. and crash the server
reason for crashing.... asckslimit exceeded.
pawn Код:
COMMAND:whisper(playerid, params[])
{
if (PlayerInfo[playerid][pSpawn] == 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][pMute] == 1)
{
SCM(playerid,COLOR_ERROR,"#Error: You Muted.");
return 1;
}
if (!strlen(result))
{
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /whisper (message).");
return 1;
}
format(string, sizeof(string), "(WHISPER) %s (%d): %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;
}