20.08.2014, 18:22
How can i do this functionally? tell me where to add the line.... in gamemode or fs ?
Код:
if(strcmp(cmd, "/call", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "[Usage:] /call [phonenumber]");
return 1;
}
if(PlayerInfo[playerid][pPhoneNumber] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "[Error:] You do not have a phone");
return 1;
}
if(PlayerInfo[playerid][pSex] == 1)
{
PlayerActionMessage(playerid,15.0,"takes a cell phone from his pocket and dials a number");
}
else
{
PlayerActionMessage(playerid,15.0,"takes a cell phone from her pocket and dials a number");
}
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USECELLPHONE);
new phonenumb = strval(tmp);
if(phonenumb == 911)
{
SendClientMessage(playerid, COLOR_WHITE, "[Operator:] Do you require emergency assistance?");
SendClientMessage(playerid, COLOR_WHITE, "[Info:] Type yes or no");
Mobile[playerid] = 911;
return 1;
}
if(phonenumb == 411)
{
SendClientMessage(playerid, COLOR_WHITE, "[Operator:] Hello, Los Santos Transport Company, how may i be of assistance?");
SendClientMessage(playerid, COLOR_WHITE, "[Info:] Please keep your call brief and all in one sentence");
Mobile[playerid] = 411;
return 1;
}
if(phonenumb == 211)
{
SendClientMessage(playerid, COLOR_WHITE, "[Operator:] Hello, San Andreas News Network, how may i be of assistance?");
SendClientMessage(playerid, COLOR_WHITE, "[Info:] Please keep your call brief and all in one sentence");
Mobile[playerid] = 211;
return 1;
}
if(phonenumb == PlayerInfo[playerid][pPhoneNumber])
{
SendClientMessage(playerid, COLOR_GREY, "[Error:] That line is being used");
return 1;
}
if(Mobile[playerid] != 255)
{
SendClientMessage(playerid, COLOR_GREY, "[Error:] You are already on a call");
return 1;
}
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pPhoneNumber] == phonenumb && phonenumb != 0)
{
giveplayerid = i;
Mobile[playerid] = giveplayerid;
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(PhoneOnline[giveplayerid])
{
SendClientMessage(playerid, COLOR_GREY, "[Error:] That player's phone is turned off");
return 1;
}
if(Mobile[giveplayerid] == 255)
{
format(string, sizeof(string), "[Phone:] Dialing... - ContactID: %s (%d)", GetPlayerNameEx(playerid),PlayerInfo[playerid][pPhoneNumber]);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
PlayerActionMessage(giveplayerid,15.0,"'s phone starts ringing");
StartedCall[playerid] = 1;
StartedCall[giveplayerid] = 0;
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "[Error:] That player is on another phone call");
}
}
}
}
}
return 1;
}

