07.07.2015, 01:32
Hello, I have a problem, here I type the command /radio off errer, instead of turning off the radio shows like this: "** Colonel Name: off, over." I made the code below, can anyone help me with a solution please?
PHP код:
if (strcmp(cmd, "/radio", true) == 0 || strcmp(cmd, "/r", true) == 0)
{
if (AccountData[playerid][pRadio] == 1) return SendClientMessage(playerid, COLOR_GRAD1, "ERRO: Vocк nгo possui um rбdio.");
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' ')) idx++;
new offset = idx, result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if (strcmp(tmp, "on", true)) //aqui
{
if (AccountData[playerid][pRadioStats] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "ERRO: Seu rбdio jб estб ligado.");
AccountData[playerid][pRadioStats] = 0;
if (AccountData[playerid][pMascarause] == 1) format(string, sizeof(string), "** Nгo identificбvel ligou o seu rбdio.");
else format(string, sizeof(string), "** %s ligou o seu rбdio.", GetPlayerNameRP(playerid));
ProxDetector(15.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
return 1;
}
if (strcmp(tmp, "off", true)) //aqui
{
if (AccountData[playerid][pRadioStats] == 1) return SendClientMessage(playerid, COLOR_GRAD1, "ERRO: Seu rбdio jб estб desligado.");
AccountData[playerid][pRadioStats] = 1;
if (AccountData[playerid][pMascarause] == 1) format(string, sizeof(string), "** Nгo identificбvel desligou o seu rбdio.");
else format(string, sizeof(string), "** %s desligou o seu rбdio.", GetPlayerNameRP(playerid));
ProxDetector(15.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
return 1;
}
if (!strlen(result)) return 1;
if (AccountData[playerid][pMuted] == 1) return SendClientMessage(playerid, COLOR_GRAD1, "ERRO: Vocк estб impossibilitado de executar estб aзгo.");
if (AccountData[playerid][pRadioStats] == 1) return SendClientMessage(playerid, COLOR_GRAD1, "ERRO: Seu rбdio estб desligado.");
if (GetPlayerOrg(playerid) == 1)
{
if (AccountData[playerid][pCargo] == 9) format(string, sizeof(string), "** Coronel %s: %s, cвmbio. **", GetPlayerNameRP(playerid), result);
else if (AccountData[playerid][pCargo] == 8) format(string, sizeof(string), "** Tenente-Coronel %s: %s, cвmbio. **", GetPlayerNameRP(playerid), result);
else if (AccountData[playerid][pCargo] == 7) format(string, sizeof(string), "** Capitгo %s: %s, cвmbio. **", GetPlayerNameRP(playerid), result);
else if (AccountData[playerid][pCargo] == 6) format(string, sizeof(string), "** Tenente %s: %s, cвmbio. **", GetPlayerNameRP(playerid), result);
else if (AccountData[playerid][pCargo] == 5) format(string, sizeof(string), "** Aspirante %s: %s, cвmbio. **", GetPlayerNameRP(playerid), result);
else if (AccountData[playerid][pCargo] == 4) format(string, sizeof(string), "** Subtenente %s: %s, cвmbio. **", GetPlayerNameRP(playerid), result);
else if (AccountData[playerid][pCargo] == 3) format(string, sizeof(string), "** Sargento %s: %s, cвmbio. **", GetPlayerNameRP(playerid), result);
else if (AccountData[playerid][pCargo] == 2) format(string, sizeof(string), "** Cabo %s: %s, cвmbio. **", GetPlayerNameRP(playerid), result);
else if (AccountData[playerid][pCargo] == 1) format(string, sizeof(string), "** Soldado %s: %s, cвmbio. **", GetPlayerNameRP(playerid), result);
else format(string, sizeof(string), "** Soldado %s: %s, cвmbio. **", GetPlayerNameRP(playerid), result);
SendRadioMessage(1, TEAM_BLUE_COLOR, string);
printf("%s", string);
if (AccountData[playerid][pMascarause] == 1) format(string, sizeof(string), "Nгo identificбvel (Rбdio): %s", result);
else format(string, sizeof(string), "%s diz (Rбdio): %s, cвmbio.", GetPlayerNameRP(playerid), result);
ProxDetector(10.0, playerid, string, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
return 1;
}
//.........
}