pawn Код:
if(strcmp(cmd, "/call", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /call [phonenumber]");
return 1;
}
if(PlayerInfo[playerid][pNumber] == 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);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
new phonenumb = strval(tmp);
if(phonenumb == 555)
{
SendClientMessage(playerid, COLOR_GREY, " They Picked up the call.");
SendClientMessage(playerid, 0xBBE1F2AA, "Man voice says (cellphone): Hello, what is your location?");
Mobile[playerid] = 555;
MechanicCall = 1;
return 1;
}
if(phonenumb == PlayerInfo[playerid][pNumber])
{
SendClientMessage(playerid, COLOR_GRAD2, " You just get a busy tone...");
return 1;
}
if(Mobile[playerid] != 255)
{
SendClientMessage(playerid, COLOR_GRAD2, " You are already on a call...");
return 1;
}
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pNumber] == 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;
}
if (Mobile[giveplayerid] == 255)
{
format(string, sizeof(string), "Your Mobile is Ringing Type (/pickup) CallerID: %s", sendername);
SendClientMessage(giveplayerid, COLOR_YELLOW, string);
GetPlayerName(giveplayerid, sendername, sizeof(sendername));
RingTone[giveplayerid] = 10;
format(string, sizeof(string), "* %s's phone begins to ring.", sendername);
SendClientMessage(playerid, COLOR_WHITE, "HINT: You now use T to talk on your cellphone, type /hangup to hang up");
ProxDetector(30.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
CellTime[playerid] = 1;
return 1;
}
}
}
}
}
}
SendClientMessage(playerid, COLOR_GRAD2, " You just get a Busy tone...");
}
return 1;
}