26.11.2011, 19:48
Hi, does anyone have a fs for call 911 (FD and PD9 i cant find one
CMD:call(playerid, params[]) {
new
number,
string[128];
if(isnull(params))
return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/call [number]");
number = strval(params);
if(playerVariables[playerid][pPhoneNumber] == -1) {
SendClientMessage(playerid, COLOR_GREY, "You don't have a phone.");
}
else if(playerVariables[playerid][pPhoneNumber] == number) {
SendClientMessage(playerid, COLOR_GREY, "You're trying to call yourself.");
}
else {
if(playerVariables[playerid][pPhoneStatus] == 1) {
if(playerVariables[playerid][pPhoneCredit] >= 1) {
if(playerVariables[playerid][pPhoneCall] == -1) {
if(number == 911) {
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
playerVariables[playerid][pPhoneCall] = 911;
SendClientMessage(playerid, COLOR_WHITE, "You've called Emergency services, please select the department you desire (i.e: LSPD, LSFMD).");
}
else if(number != -1) {
GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);
format(string, sizeof(string), "* %s takes out their cellphone, and dials in a number.", szPlayerName, number);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
nearByMessage(playerid, COLOR_PURPLE, string);
foreach(Player, i) {
if(playerVariables[i][pPhoneNumber] == number) {
if(playerVariables[i][pStatus] == 1 && playerVariables[i][pSpectating] == INVALID_PLAYER_ID && playerVariables[i][pPhoneStatus] == 1 && playerVariables[i][pPhoneCall] == -1 && playerVariables[i][pPrisonID] != 3) {
GetPlayerName(i, szPlayerName, MAX_PLAYER_NAME);
format(string, sizeof(string), "* %s's cellphone starts to ring...", szPlayerName);
nearByMessage(i, COLOR_PURPLE, string);
SendClientMessage(i, COLOR_WHITE, "Use /p(ickup) to answer your phone.");
SendClientMessage(playerid, COLOR_WHITE, "You can use the 'T' chat to proceed to talk.");
playerVariables[playerid][pPhoneCall] = i;
return 1;
}
else {
SendClientMessage(playerid, COLOR_GREY, "(cellphone) *busy tone*");
return 1;
}
}
}
if(playerVariables[playerid][pPhoneCall] == -1) SendClientMessage(playerid, COLOR_GREY, "(cellphone) *busy tone*");
}
else SendClientMessage(playerid, COLOR_GREY, "Invalid number.");
}
else SendClientMessage(playerid, COLOR_GREY, "You are currently in a call.");
}
else SendClientMessage(playerid, COLOR_GREY, "You have no remaining phone credit - visit a 24/7 to top it up.");
}
else SendClientMessage(playerid, COLOR_GREY, "You must switch your phone on first (/togphone).");
}
return 1;
}
Here is mine:
pawn Код:
|