Pay phone calls....
#1

Ok so i tried to make a payphone call like the mobile system i have but it didnt work, I set the point that they can talk from but how can i set that the pay phones cant get calls and when they call they doesn't have number? when i type the cmd for it at the point it starts to call the player with the player's number not the pay phone's.

The normal /call command:
Код:
	if(strcmp(cmd, "/call", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /call [phonenumber]");
				SendClientMessage(playerid, COLOR_GRAD2, "HINT: /calllist (for a list for short numbers)");
				return 1;
			}
			if(PlayerInfo[playerid][pPnumber] == 0)
			{
				SendClientMessage(playerid, COLOR_GRAD2, "** You don't have a cell phone!");
				return 1;
			}
			if(PlayerInfo[playerid][pMuted] == 1)
			{
				SendClientMessage(playerid, TEAM_CYAN_COLOR, "You cannot speak, you have been silenced");
				return 1;
			}

			format(string, sizeof(string), "* %s takes out a cellphone.", sendername);
			SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
			ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
			new phonenumb = strval(tmp);
			if(phonenumb == 115)
			{
			    SendClientMessage(playerid, COLOR_GREEN, "____________Services number list____________");
			    SendClientMessage(playerid, COLOR_WHITE, "111 - pizza stack co., 222 - bus services");
			    SendClientMessage(playerid, COLOR_WHITE, "103 - medics, 444 - taxi, 555 - mechanic");
			    SendClientMessage(playerid, COLOR_WHITE, "150 - ABC Studios, 911 - Emergency");
			    SendClientMessage(playerid, COLOR_GREEN, "____________________________________________");
			    return 1;
			}
			if(phonenumb == 111)
			{
				new pizzaworkers = 0;
			    for(new i=0; i<MAX_PLAYERS; i++)
			    {
			        if(IsPlayerConnected(i))
			        {
			            if(PlayerInfo[i][pJob] == 17 && JobDuty[i] == 1)
			            {
			                pizzaworkers++;
			            }
			        }
			    }

			    if(pizzaworkers < 1)
          		{
          		    SendClientMessage(playerid, TEAM_GROVE_COLOR, "** They Picked up the call.");
          		    SendClientMessage(playerid, 0xF4E19FAA, "Men voice Says (cellphone): Well stacked pizza here.");
          		    SendClientMessage(playerid, 0xF4E19FAA, "Men voice Says (cellphone): We are sorry, we do not have any pizza boys on duty.");
          		    SendClientMessage(playerid, TEAM_CYAN_COLOR, "** They hang up.");
              		return 1;
          		}

       			format(string, sizeof(string), "** %s is in need of a Pizza. (use /accept Pizza to accept the call)", sendername);
       			SendJobMessage(17, COLOR_WHITE, string);
       			SendClientMessage(playerid, TEAM_GROVE_COLOR, "** They Picked up the call.");
       			SendClientMessage(playerid, 0xF4E19DAA, "Mans' voice Says (cellphone): Well stacked pizza here.");
       			if(pizzaworkers == 1) { format(string, sizeof(string), "Mans' voice Says (cellphone): Pizza boy has been informed about your order, sir."); }
       			else { format(string, sizeof(string), "Mans' voice Says (cellphone): We have %d pizza boys on duty, they were all informed about your order !", pizzaworkers); }
				SendClientMessage(playerid, 0xF4E19DAA, string);
 			    SendClientMessage(playerid, TEAM_CYAN_COLOR, "** They hang up.");
       			PizzaCall = playerid;
			    return 1;
			}
   			if(phonenumb == 222)
   			{
   			    new routezonecheck = IsInBusrouteZone(playerid);
				new drivercount = 0;
				if (routezonecheck == 0)
				{
					for (new i=0; i<=MAX_PLAYERS; i++)
					{
						if (IsPlayerConnected(i) && BusrouteEast[i][0] != 0) drivercount++;
					}
					if (drivercount != 0)
					{
						format(string, sizeof(string), "There are currently %d bus drivers on the east route. The route is as follows:", drivercount);
						SendClientMessage(playerid, COLOR_WHITE, string);
						SendBusRoute(playerid, 0);
					}
					else SendClientMessage(playerid, COLOR_GREY, "There are no bus drivers on the east route at this time.");
				}
				else if (routezonecheck == 1)
				{
					for (new i=0; i<=MAX_PLAYERS; i++)
					{
						if (IsPlayerConnected(i) && BusrouteWest[i][0] != 0) drivercount++;
					}
					if (drivercount != 0)
					{
						format(string, sizeof(string), "There are currently %d bus drivers on the west route. The route is as follows:", drivercount);
						SendClientMessage(playerid, COLOR_WHITE, string);
						SendBusRoute(playerid, 1);
					}
					else SendClientMessage(playerid, COLOR_GREY, "There are no bus drivers on the west route at this time.");
				}
				else SendClientMessage(playerid, COLOR_GREY, "No bus services are running in this area at the current time.");
				return 1;
   			}
   			if(phonenumb == 103)
   			{
   			    if(Medics < 1)
		        {
		            SendClientMessage(playerid, COLOR_GREY, "** There are no Medics On Duty at the moment, try again later !");
		            return 1;
		        }

			    format(string, sizeof(string), "** %s is in need of a Medic. (use /accept medic to accept the call)", sendername);
		    	SendRadioMessage(4, TEAM_AZTECAS_COLOR, string);
		    	SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have called for a Medic, wait for a reply.");
		    	MedicCall = playerid;
		    	return 1;
   			}
   			if(phonenumb == 444)
   			{
   			    SendClientMessage(playerid, COLOR_SEA, "Taxi CO.: Please tell us your location !");
   			    Mobile[playerid] = 5554;
   			    return 1;
   			}
   			if(phonenumb == 555)
   			{
   			    SendClientMessage(playerid, COLOR_GREEN, "Impound Dispatcher: Please leave you location after hearing the Beep !");
   			    SendClientMessage(playerid, COLOR_WHITE, "Beep!");
   			    Mobile[playerid] = 5550;
   			    return 1;
   			}
   			if(phonenumb == 151)
   			{
   			    if(PlayerInfo[playerid][pLevel] < 2)
   			    {
   			        SendClientMessage(playerid, COLOR_GREEN, "Advertisement business: We're only advertising well known people's ads.");
   			        SendClientMessage(playerid, TEAM_CYAN_COLOR, "** They hang up...");
   			    }
   			    else
   			    {
   			    	SendClientMessage(playerid, COLOR_WHITE, "HINT: You now use T to talk on your cellphone, type /hangup to hang up");
   			    	SendClientMessage(playerid, COLOR_GREEN, "Advertisement business: Welcome to the advertisement business, what would you like to advertise?");
   			    	SendClientMessage(playerid, COLOR_WHITE, "HINT: Type your ad here. Ex: Selling my Comet");
   			    	Mobile[playerid] = 1180;
				}
   			    return 1;
   			}
   			if(phonenumb == 150)
   			{
   			    SendClientMessage(playerid, COLOR_WHITE, "HINT: You now use T to talk on your cellphone, type /hangup to hang up");
   			    SendClientMessage(playerid, COLOR_GREEN, "ABC Studio: Please leave the message after beep!");
   			    SendClientMessage(playerid, COLOR_WHITE, "Beep!");
   			    Mobile[playerid] = 3900;
   			    return 1;
   			}
			if(phonenumb == 911)
			{
				SendClientMessage(playerid, TEAM_GROVE_COLOR, "HINT: You now use T to talk on your cellphone, type /hangup to hang up");
				SendClientMessage(playerid, COLOR_BLUE, "EMERGENCY: Which Service Do You Require, Police or Paramedic?");
				Mobile[playerid] = 911;
				return 1;
			}
			if(phonenumb == PlayerInfo[playerid][pPnumber])
			{
				SendClientMessage(playerid, TEAM_CYAN_COLOR, "** You just get a busy tone...");
				return 1;
			}
			if(Mobile[playerid] != 255)
			{
				SendClientMessage(playerid, TEAM_CYAN_COLOR, "** You are already on 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; //caller connecting
						if(IsPlayerConnected(giveplayerid))
						{
						    if(giveplayerid != INVALID_PLAYER_ID)
						    {
						        if(PhoneOnline[giveplayerid] > 0)
						        {
						            SendClientMessage(playerid, COLOR_GREY, "** That players Phone is Offline!");
						            return 1;
						        }
								if (Mobile[giveplayerid] == 255)
								{
									format(string, sizeof(string), "Your Mobile is Ringing Type (/pickup) CallerID: %s", sendername);
									SendClientMessage(giveplayerid, COLOR_YELLOW, string);
									GetPlayerName(giveplayerid, sendername, sizeof(sendername));
									RingTone[giveplayerid] = 10;
									format(string, sizeof(string), "* %s's phone begins to ring.", sendername);
									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_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
									CellTime[playerid] = 1;
									return 1;
								}
							}
						}
					}
				}
			}
			SendClientMessage(playerid, TEAM_CYAN_COLOR, "** You just get a Busy tone...");
		}
		return 1;
	}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)