10.08.2009, 16:02
Код:
dcmd_call(playerid, params[]) { if(Phone[playerid] != 1) { SCM(playerid, COLOR_RED, "You do not have a cell phone!"); return 1; } if (player[playerid][calling] || player[playerid][caller] != 255) { SendClientMessage(playerid, 0xBFC0C2FF, "You are already on the phone. use /hangup to hangup"); return 1; } if (!strlen(params)) { SendClientMessage(playerid, 0xBFC0C2FF, "USAGE: /call <phonenumber>"); return 1; } new name[16]; GetPlayerName(playerid, name, 16); new string[41]; format(string, sizeof(string), "* %s takes out a cellphone.", name); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); new phonenumb = strval(params); for(new i = 0; i <= MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(Number[i] == phonenumb && phonenumb != 0 && player[i][calling] && player[i][caller] == 255 && i != playerid) { format(string, sizeof(string), "Caller ID: %s", name); SendClientMessage(i, 0xFFFF00AA, string); SendClientMessage(i, 0xFFFFFFFF, "Tip: Use /pickup to answer your phone"); GetPlayerName(i, name, sizeof(name)); format(string, sizeof(string), "You are calling %s...", name); SendClientMessage(playerid, 0xFFFFFFAA, string); SendClientMessage(i, 0xFFFFFFFF, "TIP: to hangup, type /hangup"); startphone(playerid); player[playerid][calling] = false; player[playerid][caller] = i; player[i][calling] = false; player[i][caller] = playerid; return 1; } } } return 1; }