Сообщение от
vovandolg
использовать sscanf вместе с такими cmd и будет тебе оптимизация)
Можно тогда на примере моей команды ?
PHP код:
else if(strcmp(cmd, "/sethp", true) == 0)
{
tmp = strcharsplit(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "Введите: /sethp [id] [hp]");
if(anti[playerid] == 1) return SendClientMessage(playerid, COLOR_LIGHTRED, "[Анти-Наказание] Вы словили блок на наказание сроком 5 минут");
new playa = ReturnUser(tmp);
tmp = strcharsplit(cmdtext, idx);
new health = strval(tmp);
if (PlayerInfo[playerid][pAdmin] >= 10)
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
PlayerHealth[playa] = health;
antiwarn[playerid] += 8;
if(antiwarn[playerid] >= 30 && anti[playerid] == 0) anti[playerid] = 1, antiwarn[playerid] = 300;
specid = ReturnUser(tmp);
format(stringer,sizeof(stringer),"Анти-П**р: %s использовал /sethp на [ID'e: %d | HEALTH: %d]",PlayerInfo[playerid][pNames],specid,health),ABroadCast(COLOR_WHITE,stringer,1);
SetPlayerHealthAC(playa, health);
SendClientMessage(playerid, COLOR_WHITE, "Уровень HP игроку установлен!");
}
}
}
else { SendClientMessage(playerid, COLOR_GRAD1, "Вы не уполномочены использовать данную команду!"); }
return true;
}