Here
PHP код:
CMD:sms(playerid, params[])
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, " You haven't logged in yet!");
return 1;
}
if(GetPVarInt(playerid, "Injured") != 0||GetPVarInt(playerid, "Hospital")!=0)
{
SendClientMessage (playerid, COLOR_GRAD2, "You can't do this at this time.");
return 1;
}
if(PlayerTied[playerid] != 0 || PlayerCuffed[playerid] != 0)
{
SendClientMessage(playerid,COLOR_GREY,"You can't use your phone whilist restrained.");
return 1;
}
new string[128], phonenumb, text[100];
if(sscanf(params, "ds[100]", phonenumb, text)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/t)ext [phonenumber] [text chat]");
//if(AntiAdv(playerid, params)) return 1;
if(PlayerInfo[playerid][pNumber] == 0)
{
SendClientMessage(playerid, COLOR_GRAD2, " You don't have a cell phone...");
return 1;
}
if(PlayerInfo[playerid][pJailTime] > 0)
{
SendClientMessage(playerid,COLOR_GREY," You can't use your phone while in jail or prison!");
return 1;
}
if(PhoneOnline[playerid] > 0)
{
SendClientMessage(playerid, COLOR_GREY, "Your phone is off.");
return 1;
}
/*if(PlayerInfo[playerid][pPhoneCredits] < 3)
return SendClientMessage(playerid, COLOR_YELLOW, "Check Operator...");*/
if(Spectating[playerid]==0)
{
if(PlayerInfo[playerid][pMask] == 1) { format(string, sizeof(string), "* Stranger's takes out a cellphone"); }
else { format(string, sizeof(string), "* %s takes out a cellphone.", GetPlayerNameEx(playerid)); }
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
if(phonenumb == 555)
{
SendClientMessage(playerid, COLOR_GREY, "The number you have dialed has not been recognized.");
return 1;
}
foreach(Player, i)
{
if(PlayerInfo[i][pNumber] == phonenumb && phonenumb != 0)
{
new giveplayerid = i;
if(Mobile[giveplayerid] != INVALID_PLAYER_ID)
{
SendClientMessage(playerid, COLOR_GREY, "That player's phone is busy (on a call).");
return 1;
}
Mobile[playerid] = giveplayerid; //caller connecting
if(IsPlayerConnected(giveplayerid)) {
if(giveplayerid != INVALID_PLAYER_ID) {
if(PhoneOnline[giveplayerid] > 0) {
SendClientMessage(playerid, COLOR_GREY, "That player's phone is switched off.");
Mobile[playerid] = INVALID_PLAYER_ID;
return 1;
}
if(PhonePrivacy[playerid] == 1) {
format(string, sizeof(string), "SMS: %s, Sender: Unknown.", text,GetPlayerNameEx(playerid),PlayerInfo[playerid][pNumber]);
} else {
format(string, sizeof(string), "SMS: %s, Sender: %s (%d)", text,GetPlayerNameEx(playerid),PlayerInfo[playerid][pNumber]);
}
SendClientMessage(giveplayerid, COLOR_YELLOW, string);
SendClientMessage(playerid, COLOR_YELLOW, string);
//SendClientMessage(playerid, COLOR_WHITE, "Text Message Delivered");
LastSMS[giveplayerid] = PlayerInfo[playerid][pNumber];
format(string, sizeof(string), "~r~-$2");
GameTextForPlayer(playerid, string, 5000, 1);
GivePlayerCash(playerid, -2);
//PlayerInfo[playerid][pPhoneCredits] -= 3;
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
Mobile[playerid] = INVALID_PLAYER_ID;
return 1;
}
}
}
}
SendClientMessage(playerid, COLOR_GRAD2, " Message delivery failed...");
return 1;
}
PHP код:
CMD:call(playerid, params[])
{
new string[128], phonenumb;
if(sscanf(params, "d", phonenumb)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /call [number]");
phonenumb = strval(params);
if(PlayerInfo[playerid][pJailTime] > 0)
{
SendClientMessage(playerid,COLOR_GREY,"You can't use your phone while in jail.");
return 1;
}
if(PlayerTied[playerid] != 0 || PlayerCuffed[playerid] != 0)
{
SendClientMessage(playerid,COLOR_GREY,"You can't use your phone whilist restrained.");
return 1;
}
if(PlayerInfo[playerid][pNumber] == 0)
{
SendClientMessage(playerid, COLOR_GRAD2, "You don't have a cell phone.");
return 1;
}
if(PhoneOnline[playerid] > 0)
{
SendClientMessage(playerid, COLOR_GREY, "Your phone is off.");
return 1;
}
/*if(PlayerInfo[playerid][pPhoneCredits] < 5)
return SendClientMessage(playerid, COLOR_YELLOW, "Check Operator...");*/
if(PlayerInfo[playerid][pMask] == 1) { format(string, sizeof(string), "*Stranger takes out a cellphone."); }
else { format(string, sizeof(string), "* %s takes out a cellphone.", GetPlayerNameEx(playerid)); }
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
if(phonenumb == 911)
{
if(PlayerInfo[playerid][pJailed] == 3 || PlayerInfo[playerid][pJailed] == 4)
{
SendClientMessage(playerid, COLOR_WHITE, "Can't use this whilst prison!");
return 1;
}
SendClientMessage(playerid, COLOR_WHITE, "HINT: You now use T to talk on your cellphone, type /hangup to hang up.");
SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: Which service do you require, police or paramedic?");
Mobile[playerid] = 911;
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
SetPlayerAttachedObject(playerid, 9, 330, 6);
return 1;
}
if(phonenumb == PlayerInfo[playerid][pNumber])
{
SendClientMessage(playerid, COLOR_GRAD2, " You just get a busy tone...");
return 1;
}
if(Mobile[playerid] != INVALID_PLAYER_ID)
{
SendClientMessage(playerid, COLOR_GRAD2, "You're already in a call...");
return 1;
}
foreach(Player, i)
{
if(PlayerInfo[i][pNumber] == phonenumb && phonenumb != 0)
{
new giveplayerid = i;
Mobile[playerid] = giveplayerid; //caller connecting
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(PhoneOnline[giveplayerid] > 0)
{
SendClientMessage(playerid, COLOR_GREY, "That player's phone is switched off.");
Mobile[playerid] = INVALID_PLAYER_ID;
return 1;
}
if(Mobile[giveplayerid] != INVALID_PLAYER_ID)
{
SendClientMessage(playerid, COLOR_GRAD2, "You just get a busy tone...");
Mobile[playerid] = INVALID_PLAYER_ID;
return 1;
}
if(Spectating[giveplayerid]!=0)
{
SendClientMessage(playerid, COLOR_GRAD2, "You just get a busy tone...");
Mobile[playerid] = INVALID_PLAYER_ID;
return 1;
}
if(Mobile[giveplayerid] == INVALID_PLAYER_ID)
{
format(string, sizeof(string), "Your mobile is ringing - type /p to answer it. [Caller ID: %s]", GetPlayerNameEx(playerid));
SendClientMessage(giveplayerid, COLOR_YELLOW, string);
if(PlayerInfo[giveplayerid][pMask] == 1) { format(string, sizeof(string), "* Stranger's phone begins to ring."); }
else { format(string, sizeof(string), "* %s's phone begins to ring.", GetPlayerNameEx(i)); }
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;
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
SetPlayerAttachedObject(playerid, 9, 330, 6);
return 1;
}
}
}
}
}
SendClientMessage(playerid, COLOR_GRAD2, "Your call can't be completed as dialed, please check the number and try again.");
return 1;
}
And...
PHP код:
CMD:h(playerid,params[])
{
new string[128];
if(GetPVarInt(playerid, "Injured") != 0||PlayerCuffed[playerid]!=0||GetPVarInt(playerid, "Hospital")!=0)
{
SendClientMessage (playerid, COLOR_GRAD2, "You can't do this at this time.");
return 1;
}
new caller = Mobile[playerid];
if((IsPlayerConnected(caller) && caller != INVALID_PLAYER_ID)|| caller == 911 || caller == 912 || caller == 913 || caller == 914)
{
if(caller < 500)
{
SendClientMessage(caller, COLOR_GRAD2, " They hung up.");
if(PlayerInfo[playerid][pMask] == 1) { format(string, sizeof(string), "* Stranger's puts away their cellphone."); }
else { format(string, sizeof(string), "* %s puts away their cellphone.", GetPlayerNameEx(caller)); }
ProxDetector(30.0, caller, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
CellTime[caller] = 0;
Mobile[caller] = INVALID_PLAYER_ID;
}
CellTime[playerid] = 0;
SendClientMessage(playerid, COLOR_GRAD2, " You hung up.");
if(PlayerInfo[playerid][pMask] == 1) { format(string, sizeof(string), "* Stranger's puts away their cellphone"); }
else { format(string, sizeof(string), "* %s puts away their cellphone", GetPlayerNameEx(playerid)); }
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
Mobile[playerid] = INVALID_PLAYER_ID;
CellTime[playerid] = 0;
SetPlayerSpecialAction(caller, SPECIAL_ACTION_STOPUSECELLPHONE);
RemovePlayerAttachedObject(caller, 9);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
RemovePlayerAttachedObject(playerid, 9);
return 1;
}
SendClientMessage(playerid, COLOR_GRAD2, " Your phone is in your pocket.");
return 1;
}
CMD:number(playerid, params[]) {
if(PlayerInfo[playerid][pPhoneBook] == 1) {
new
iTarget;
if(sscanf(params, "u", iTarget)) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /number [playerid/partofname]");
}
else if(IsPlayerConnected(iTarget)) {
new
szNumber[16 + MAX_PLAYER_NAME];
format(szNumber, sizeof(szNumber), "* %s (%i)", GetPlayerNameEx(iTarget), PlayerInfo[iTarget][pNumber]);
SendClientMessage(playerid, COLOR_GRAD1, szNumber);
}
else SendClientMessage(playerid, COLOR_GRAD1, "Invalid player specified.");
}
else SendClientMessage(playerid, COLOR_GRAD1, "You don't have a phone book.");
return 1;
}