Код:
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, " You havent logged in yet!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/t)ext [phonenumber] [text chat]");
return 1;
}
if(PlayerInfo[playerid][pPnumber] == 0)
{
SendClientMessage(playerid, COLOR_GRAD2, " You don't have a cell phone...");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s takes out a cellphone.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
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, "USAGE: (/t)ext [phonenumber] [text chat]");
return 1;
}
if(phonenumb == 555)
{
if ((strcmp("yes", result, true, strlen(result)) == 0) && (strlen(result) == strlen("yes")))
{
SendClientMessage(playerid, COLOR_WHITE, "Text Message Delivered.");
if (gTeam[playerid] == 2 || gTeam[playerid] == 1)
{
SendClientMessage(playerid, COLOR_YELLOW, "SMS: I have no idea what you're talking about, Sender: MOLE (555)");
RingTone[playerid] = 20;
return 1;
}
return 1;
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, "SMS: A simple Yes will do, Sender: MOLE (555)");
RingTone[playerid] = 20;
return 1;
}
}
for(new i = 0; i < MAX_PLAYERS; 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, " That players Phone is Offline!");
return 1;
}
format(string, sizeof(string), "SMS: %s, Sender: %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, "Text Message Delivered");
SendClientMessage(giveplayerid, COLOR_YELLOW, string);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string, sizeof(string), "~r~$-%d", txtcost);
GameTextForPlayer(playerid, string, 5000, 1);
SafeGivePlayerMoney(playerid,-txtcost);
SBizzInfo[2][sbTill] += txtcost;
ExtortionSBiz(2, txtcost);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
Mobile[playerid] = 255;
return 1;
}
}
}
}
}
SendClientMessage(playerid, COLOR_GRAD2, " Message Delivery Failed...");
}
return 1;
}