ProberPWN
Ученик
Всем привет, у меня давно появился вопрос "Что такое оптимизация?", вот хочу задать его вам.
Оптимизация это, из такого:
Сделать такое?:
Или что-то еще, объясните пожалуйста.
Оптимизация это, из такого:
PHP:
if(strcmp(cmd, "/ticket", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(IsACop(playerid)){
if(OnDuty[playerid] != 1 && IsACop(playerid))
{
SendClientMessage(playerid, COLOR_GREY, "Вы не на службе!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, ""ERPP" /ticket [ID] [цена] [причина]");
return 1;
}
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, ""ERPP" /ticket [ID] [цена] [причина]");
return 1;
}
moneys = strval(tmp);
if(moneys < 1 || moneys > 10000) { SendClientMessage(playerid, COLOR_GREY, "Цена штрафа должна быть не более 10000$ и не менее 1$!"); return 1; }
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, ""ERPP" /ticket [ID] [цена] [причина]");
return 1;
}
format(string, sizeof(string), "* Bы выдaлu штpаф %s, в paзмepe $%d, npuчuнa: %s", giveplayer, moneys, (result));
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "* %s выдaeт вaм штpаф в paзмepe $%d, npuчuнa: %s", sendername, moneys, (result));
SendClientMessage(giveplayerid, COLOR_WHITE, string);
format(string, sizeof(string), "* %s выписывает квитанцию для %s .", sendername, giveplayer);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SendClientMessage(giveplayerid, COLOR_WHITE, "* Введите /принять штраф чтобы согласиться.");
TicketOffer[giveplayerid] = playerid;
TicketMoney[giveplayerid] = moneys;
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Игрок далеко от вас!");
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Игрок в оффлайне!");
return 1;
}
}
}
return 1;
}
PHP:
if(strcmp(cmd, "/ticket", true) == 0)
{
if(!IsPlayerConnected(playerid)) return 1;
if(!IsACop(playerid)) return 1;
if(OnDuty[playerid] != 1 && IsACop(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Вы не на службе!");
new giveplayerid,moneys,Text[128];
if(sscanf(params,"dds[128]",giveplayerid,moneys,Text)) return SendClientMessage(playerid, COLOR_WHITE, ""ERPP" /ticket [ID] [$] [причина]");
if(moneys < 1 || moneys > 10000) { SendClientMessage(playerid, COLOR_GREY, "Цена штрафа должна быть не более 10000$ и не менее 1$!"); return 1; }
if(!IsPlayerConnected(giveplayerid)) return 1;
if(giveplayerid == INVALID_PLAYER_ID) return 1;
if (!ProxDetectorS(8.0, playerid, giveplayerid)) return 1;
format(string, sizeof(string), "* Bы выдaлu штpаф %s, в paзмepe $%d, npuчuнa: %s", GN(giveplayerid), moneys, Text);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "* %s выдaeт вaм штpаф в paзмepe $%d, npuчuнa: %s", GN(playerid), moneys, Text);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
format(string, sizeof(string), "* %s выписывает квитанцию для %s .", GN(playerid), GN(giveplayerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SendClientMessage(giveplayerid, COLOR_WHITE, "* Введите /принять штраф чтобы согласиться.");
TicketOffer[giveplayerid] = playerid;
TicketMoney[giveplayerid] = moneys;
return 1;
}
