06.10.2010, 19:05
pawn Код:
if(strcmp(cmd, "/call", true) == 0 || strcmp(cmd, "/tf", true) ==0 )
{
for(new i=0;i<sizeof(Locations);i++)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, Locations[i][0], Locations[i][1], Locations[i][2]))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
//SetPlayerSpecialAction(playerid,SPECIAL_ACTION_STOPUSECELLPHONE);
SendClientMessage(playerid, COLOR_GRAD2, "Use: /call [number]");
return 1;
}
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GRAD2, " You should logg in.");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
new phonenumb = strval(tmp);
if(phonenumb == 911)
{
SendClientMessage(playerid, COLOR_GREY, "911 is not available yet.");
//ShowEmergencyOneDialog(playerid,DEMERGENCY1);
return 1;
}
if(phonenumb == PlayerInfo[playerid][pPnumber])
{
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_STOPUSECELLPHONE);
SendClientMessage(playerid, COLOR_GRAD2, " The numner is busy.");
return 1;
}
if(Mobile[playerid] != 9999)
{
SendClientMessage(playerid, COLOR_GRAD2, "You are already in a call.");
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;
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(PhoneOnline[giveplayerid] > 0)
{
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_STOPUSECELLPHONE);
SendClientMessage(playerid, COLOR_GREY, " The number is busy,please try again later.");
return 1;
}
}
}
}
}
}
SendClientMessage(playerid, COLOR_GRAD2, " The number is busy now.");
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_STOPUSECELLPHONE);
return 1;
}
}
SendClientMessage(playerid, COLOR_GRAD2, " You can't call anyone at this location.");
return 1;
}