yra76
Новичок
сделал команду чтения смс игроков(админам) но она не работает. работает если только ты сам себе смс пишешь .тогда показывает. а так если другие игроки друг другу пишут то нет.подскажите в чем проблема и как исправить?команды ниже
HTML:
if (strcmp(cmd, "/smson", true)==0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pLevel] <= 4 && !IsPlayerAdmin(playerid) && !PlayerInfo[playerid][pAdmin])
{
SendClientMessage(playerid, COLOR_WHITE, "{FF0000}[Ошибка]{ffffff} Недостаточно прав для использования команды!");
return true;
}
else
{
if(ShowSMS[playerid] == 0)
{
SendClientMessage(playerid, COLOR_YELLOW, "Вы вошли в режим чтения sms");
ShowSMS[playerid] = 1;
return true;
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, "Вы вышли из режима чтения sms");
ShowSMS[playerid] = 0;
return true;
}
}
}
return true;
}
if(strcmp(cmd, "/txt", true) == 0 || strcmp(cmd, "/t", true) == 0 || strcmp(cmd, "/sms", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, " Вы не авторизованы.");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, " (/t)ext [номер телефона] [текст чата]");
return 1;
}
if(PlayerInfo[playerid][pPnumber] == 0)
{
SendClientMessage(playerid, COLOR_GRAD2, "У вас нет телефона...");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "достает телефон.");
Action(playerid, string);
new phonenumb = strval(tmp);
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
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, "(/t)ext [телефонный номер] [текст чата]");
return 1;
}
if(phonenumb == 555)
{
if ((strcmp("yes", result, true, strlen(result)) == 0) && (strlen(result) == strlen("yes")))
{
SendClientMessage(playerid, COLOR_WHITE, "Сообщение доставлено.");
if (IsACop(playerid) || gTeam[playerid] == 1)
{
SendClientMessage(playerid, COLOR_YELLOW, "SMS: Я понятия не имею о чем ты говоришь, Отправитель: MOLE (555)");
RingTone[playerid] = 20;
return 1;
}
return 1;
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, "SMS: Да проще сделать это, Отправитель: MOLE (555)");
RingTone[playerid] = 20;
return 1;
}
}
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pPnumber] == phonenumb && phonenumb != 0)
{
giveplayerid = i;
Mobile[playerid] = giveplayerid; //caller connecting
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(PhoneOnline[giveplayerid] > 0)
{
SendClientMessage(playerid, COLOR_GREY, "Игрок не подключен!");
return 1;
}
if(PlayerInfo[i][pAdmin] >= 3 && ShowSMS[i] == 1)
{
format(string, sizeof(string), "Сообщение от %s[%d] к %s[%d]: %s", sendername, playerid, giveplayer, giveplayerid, (result));
SendClientMessage(i, COLOR_LIGHTBLUE, string);
}
format(string, sizeof(string), "SMS: %s, Отправитель: %s (%d)", result,sendername,PlayerInfo[playerid][pPnumber]);
GetPlayerName(giveplayerid, sendername, sizeof(sendername));
//format(string, sizeof(string), "* %s's phone beeps.", sendername);
RingTone[giveplayerid] =20;
SendClientMessage(playerid, COLOR_WHITE, "Сообщение доставлено");
SendClientMessage(giveplayerid, COLOR_YELLOW, string);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string, sizeof(string), "~r~$-%d", txtcost);
GameTextForPlayer(playerid, string, 5000, 1);
PlayerInfo[playerid][pMoney] -= txtcost;
SBizzInfo[2][sbTill] += txtcost;
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
Mobile[playerid] = 255;
return 1;
}
}
}
}
}
SendClientMessage(playerid, COLOR_GRAD2, "Доставка сообщения невозможна.");
}
return 1;
}
