Phone call problem thingy.
#1

I made that the players can use /payphone on a certain places 'Pay phones' but when the player uses /payphone he can uses /payphone anywhere except the points i made, lol


Код:
		if(strcmp(cmd, "/payphone", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
  		if (IsPlayerInRangeOfPoint(playerid, 5,1805.7631,-1600.7742,13.5469) || IsPlayerInRangeOfPoint(playerid, 6,1722.1570,-1720.8690,13.8170))
		{
		return 1;
		}
			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][pPhoneCard] == 1)
			{
				SendClientMessage(playerid, COLOR_GRAD2, "** You don't have a Phone Card !");
				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 lifts up the payphone's speaker.", 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, "151 - Advertisement Agency, 150 - ABC Studios");
			    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)
   			{
			    if(TaxiDrivers < 1)
		        {
          			 SendClientMessage(playerid, COLOR_GREY, "** There are no Taxi Drivers On Duty at the moment, try again later!");
				     return 1;
		        }
		        if(TransportDuty[playerid] > 0)
		        {
		            SendClientMessage(playerid, COLOR_GREY, "** You can't call for a Taxi now !");
		            return 1;
		        }

			    format(string, sizeof(string), "** %s is in need of a Taxi Driver. (use /accept taxi to accept the call)", sendername);
		    	SendJobMessage(13, TEAM_AZTECAS_COLOR, string);
	    		SendClientMessage(playerid, TEAM_GROVE_COLOR, "** They Picked up the call.");
		    	SendClientMessage(playerid, 0xF4E19FAA, "Men voice Says (cellphone): All taxi drivers have been informed about your call.");
		    	SendClientMessage(playerid, TEAM_CYAN_COLOR, "** They hang up.");
		    	TaxiCall = playerid;
		    	return 1;
	    	}
   			if(phonenumb == 555)
   			{
   			    new mechanicworkers = 0;
			    for(new i=0; i<MAX_PLAYERS; i++)
			    {
			        if(IsPlayerConnected(i))
			        {
			            if(PlayerInfo[i][pJob] == 7 && JobDuty[i] == 1)
			            {
			                mechanicworkers++;
			            }
			        }
			    }
   			    if(mechanicworkers < 1)
		        {
		            SendClientMessage(playerid, TEAM_GROVE_COLOR, "** They Picked up the call.");
		            SendClientMessage(playerid, 0xBBE1F2AA, "Men voice Says (cellphone): Sorry we have no mechanics available at the moment.");
		            SendClientMessage(playerid, TEAM_CYAN_COLOR, "** They hang up.");
		            return 1;
		        }

			    format(string, sizeof(string), "** %s is in need of a Car Mechanic. (use /accept mechanic to accept the call)", sendername);
		    	SendJobMessage(7, COLOR_WHITE, string);
		    	SendClientMessage(playerid, TEAM_GROVE_COLOR, "** They Picked up the call.");
		       	SendClientMessage(playerid, 0xBBE1F2AA, "Men voice Says (cellphone): Hello, all mechanics at your area have been informed about your call.");
				SendClientMessage(playerid, TEAM_CYAN_COLOR, "** They hang up.");
		    	MechanicCall = playerid;
		    	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
#2

Instead of this:
pawn Код:
if (IsPlayerInRangeOfPoint(playerid, 5,1805.7631,-1600.7742,13.5469) || IsPlayerInRangeOfPoint(playerid, 6,1722.1570,-1720.8690,13.8170))
        {
        return 1;
        }
It's got be like this:
pawn Код:
if (!IsPlayerInRangeOfPoint(playerid, 5,1805.7631,-1600.7742,13.5469) || !IsPlayerInRangeOfPoint(playerid, 6,1722.1570,-1720.8690,13.8170))
        {
        return 1;
        }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)