Pay phones
#1

Hello, i use larp gf edit that i want to make something in it

In the server there is /call for mobiles and /number [playername/id] to get the number.

I want to make that i can only do /number in a certain place and remove for mobiles and 24/7, the pay phones place at los santos (PS: i got the range cords)


And how can i make /call for payphones too (Not the object to be held or something just that i can /call if the player is in rage of someplace !)


Call cmd:
Код:
	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, "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;
	}
The /number cmd:

Код:
	if (strcmp(cmd, "/number", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			if (PlayerInfo[playerid][pPhoneBook] == 1)
			{
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /number [playerid/PartOfName]");
					return 1;
				}
				//giveplayerid = strval(tmp);
				giveplayerid = ReturnUser(tmp);
				if(IsPlayerConnected(giveplayerid))
				{
				    if(giveplayerid != INVALID_PLAYER_ID)
				    {
				        if(PlayerInfo[giveplayerid][pHideNumber] == 1)
				        {
							GetPlayerName(giveplayerid, sendername, sizeof(sendername));
							format(string, 256, "Name: %s, Ph: HIDDEN",sendername);
							SendClientMessage(playerid, COLOR_GRAD1, string);
						}
						else
						{
						    GetPlayerName(giveplayerid, sendername, sizeof(sendername));
							format(string, 256, "Name: %s, Ph: %d",sendername,PlayerInfo[giveplayerid][pPnumber]);
							SendClientMessage(playerid, COLOR_GRAD1, string);
						}
						new y, m, d;
						new h,mi,s;
						getdate(y,m,d);
						gettime(h,mi,s);
						format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /number %s",d,m,y,h,mi,s,sendername,giveplayer);
						CommandLog(string);
					}
				}
				else
				{
					SendClientMessage(playerid, COLOR_GRAD1, "   No Such Player !");
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "   You do not have a PhoneBook !");
			}
		}
		return 1;
	}
The buyable phonebook (24/7):

Код:
				else if (listitem == 2 && GetPlayerMoney(playerid) > 10)
				{
				    if(PlayerInfo[playerid][pTraderPerk] > 0)
				    {
						new skill = 10 / 100;
						new price = (skill)*(PlayerInfo[playerid][pTraderPerk]);
						new payout = 10 - price;
						SafeGivePlayerMoney(playerid,- payout);
						SBizzInfo[9][sbTill] += payout;
						ExtortionSBiz(9, payout);
						GameTextForPlayer(playerid, "~r~-$10", 5000, 1);
					}
					else
					{
					    SafeGivePlayerMoney(playerid,- 10);
						SBizzInfo[9][sbTill] += 10;
						ExtortionSBiz(9, 10);
						format(string, sizeof(string), "~r~-$%d", 100);
						GameTextForPlayer(playerid, string, 5000, 1);
					}
					PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
	                PlayerInfo[playerid][pPhoneBook] = 1;
					format(string, sizeof(string), "   Phone Book Purchased you can look up any Players Number !");
					SendClientMessage(playerid, COLOR_GRAD4, string);
					SendClientMessage(playerid, COLOR_WHITE, "HINT: Type /number <id/name>.");
					return 1;
				}
Reply
#2

Ehhhhh, you should use a different script here man. But what you would do is; for the /pay phone command is copy the /call command and change the command to /payphone, and somewhere in there you would use IsPlayerInRangeOfPoint If you have any idea on scripting you would understand.
Reply
#3

Yeah i understand thanks and about the /number ?
Reply
#4

About /number. You do the same thing and change the command to /phonebook and use IsPlayerInRangeOfPoint
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)