20.12.2013, 18:47
You used SendClientMessageToAll inside a loop, that's why.
I recommend you to use foreach for players-looping since it loops ONLY through connected players and it's MUCH faster!
I recommend you to use foreach for players-looping since it loops ONLY through connected players and it's MUCH faster!
pawn Код:
CMD:givescoreall(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_RED, "[ADMIN] - You're not a high enough level to use this command!");
new
score;
if (sscanf(params, "d", score)) return SendClientMessage(playerid, COLOR_RED, "[USAGE] - /givescoreall [AMMOUNT]");
if (score < 1) return SendClientMessage(playerid, COLOR_RED, "[ERROR] - You need to give more than 0 score.");
new
string[74],
name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(string, sizeof(string), "[ADMIN] - %s[%d] has used GIVESCOREALL - %d -", name, playerid, score);
SendMessageToAdmins(string);
format(string, sizeof(string), "* Admin %s[%d] has given %d score to everyone!", name, playerid, score);
SendClientMessageToAll(COLOR_YELLOW, string);
for (new i; i != MAX_PLAYERS; ++i)
{
if (!IsPlayerConnected(i)) continue;
SetPlayerScore(i, GetPlayerScore(i) + score);
}
return 1;
}
CMD:givemoneyall(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_RED, "[ADMIN] - You're not a high enough level to use this command!");
new
money;
if(sscanf(params, "d", money)) return SendClientMessage(playerid, COLOR_RED, "[USAGE] - /givemoneyall [AMMOUNT]");
if( money < 1 ) return SendClientMessage(playerid, COLOR_RED, "[ERROR] - You need to give more than 0$");
new
string[74],
name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(string, sizeof(string), "[ADMIN] - %s[%d] has used GIVEMONEYALL - %d -", name, playerid, money);
SendMessageToAdmins(string);
format(string, sizeof(string), "* Admin %s[%d] has given %d$ to everyone!", name, playerid, money);
SendClientMessageToAll(COLOR_YELLOW, string);
for (new i; i != MAX_PLAYERS; ++i)
{
if (!IsPlayerConnected(i)) continue;
GivePlayerMoney(i, money);
}
return 1;
}